clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2555381 fiddles created (37430 in the last week).

CREATE TABLE product( id INTEGER NOT NULL, title TEXT NOT NULL );
 hidden batch(es)


CREATE TABLE property( id INTEGER NOT NULL, title TEXT NOT NULL );
 hidden batch(es)


CREATE TABLE value( id INTEGER NOT NULL, property_id INTEGER NOT NULL, product_id INTEGER NOT NULL, value TEXT NOT NULL DEFAULT '' );
 hidden batch(es)


INSERT INTO product(id, title) VALUES (1, 'Тельавизор'), (2, 'Плазма'), (3, 'Монитор')
3 rows affected
 hidden batch(es)


INSERT INTO property(id, title) VALUES (1, 'Диагональ'), (2, 'Тип вещания'), (3, 'Звук'), (4, 'Разъемы')
4 rows affected
 hidden batch(es)


INSERT INTO value(id, property_id,product_id, value) VALUES (1, 1, 1, '88см'), (2, 1, 2, '108см'), (3, 1, 3, '128см')
3 rows affected
 hidden batch(es)


SELECT pt.title, p.title, v.value AS value_list FROM product AS pt LEFT JOIN value AS v ON v.product_id = pt.id LEFT JOIN property as p ON v.property_id = p.id
title title value_list
Тельавизор Диагональ 88см
Плазма Диагональ 108см
Монитор Диагональ 128см
 hidden batch(es)