clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
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. 2335738 fiddles created (27465 in the last week).

create table tab1(tab1_id serial primary key); create table tab2(tab2_id serial primary key); create table scope(scope_id serial primary key, scope_name text); create table scope_tab1(scope_id integer references scope, tab1_id integer references tab1, val text, primary key(scope_id,tab1_id)); insert into scope(scope_name) values ('English'),('French'); insert into tab1(tab1_id) select generate_series(1,5); insert into tab2(tab2_id) select generate_series(1,5); insert into scope_tab1(scope_id,tab1_id,val) values (1,1,'Green'),(2,1,'Verde');
2 rows affected
5 rows affected
5 rows affected
2 rows affected
 hidden batch(es)


select tab1_id , (select val from scope_tab1 where scope_id=1 and tab1_id=tab1.tab1_id) val_s1 , (select val from scope_tab1 where scope_id=2 and tab1_id=tab1.tab1_id) val_s2 from tab1;
tab1_id val_s1 val_s2
1 Green Verde
2
3
4
5
 hidden batch(es)