1 -- standalone, data table
8 -- 1 single FK import, data table
13 foreign key (b_id) references b (b_id),
17 -- 2 single FK import, link table between 'a' and 'b'
18 -- note that 'a' both imports a FK from 'b', as well as links to 'b' via 'a_b'
20 a_b_id serial not null,
23 foreign key (a_id) references a (a_id),
25 foreign key (b_id) references b (b_id)
28 -- 1 single FK import, data table
33 foreign key (b_id) references b (b_id),
37 -- 1 single FK import, data table
42 foreign key (c_id) references c (c_id),
46 -- standalone, data table
53 -- 2 single FK import, link table between 'c' and 'e'
55 c_e_id serial not null,
58 foreign key (c_id) references c (c_id),
60 foreign key (e_id) references e (e_id)
63 -- 1 triple FK import, link table between 'e', 'e', and 'e'
68 foreign key (e1_id) references e (e_id),
70 foreign key (e2_id) references e (e_id),
72 foreign key (e3_id) references e (e_id)
75 -- 1 single FK import, 1 double FK import, link table between 'a', 'e', and 'e'
80 foreign key (a_id) references a (a_id),
82 foreign key (e1_id) references e (e_id),
84 foreign key (e2_id) references e (e_id)
87 -- 1 double FK import, 1 triple FK import, link table between 'a', 'a', 'e', 'e', and 'e'
92 foreign key (a1_id) references a (a_id),
94 foreign key (a2_id) references a (a_id),
96 foreign key (e1_id) references e (e_id),
98 foreign key (e2_id) references e (e_id),
100 foreign key (e3_id) references e (e_id)
103 -- 3 single FK import, link table between 'b', 'c', and 'd'
105 i_id serial not null,
108 foreign key (b_id) references b (b_id),
110 foreign key (c_id) references c (c_id),
112 foreign key (d_id) references d (d_id)
115 insert into b (name) values ('balloon');
116 insert into b (name) values ('bangup');
117 insert into b (name) values ('beluga');
118 insert into b (name) values ('blanch');
119 insert into b (name) values ('botch');
120 insert into b (name) values ('brooch');
121 insert into b (name) values ('broccoli');
122 insert into b (name) values ('blitz');
123 insert into b (name) values ('blintz');
124 insert into a (name,b_id) values ('alkane',1);
125 insert into a (name,b_id) values ('alkyne',2);
126 insert into a (name,b_id) values ('amygdala',3);
127 insert into a (name,b_id) values ('aorta',4);
128 insert into a_b (a_id,b_id) values (1,5);
129 insert into c (name,b_id) values ('cairn',6);
130 insert into c (name,b_id) values ('cootie',7);
131 insert into c (name,b_id) values ('cochlea',8);
132 insert into d (name,c_id) values ('drake',1);
133 insert into e (name) values ('ear');
134 insert into e (name) values ('element');
135 insert into e (name) values ('embryo');
136 insert into e (name) values ('encumber');
137 insert into e (name) values ('enhance');
138 insert into e (name) values ('ependyma');
139 insert into e (name) values ('epididymis');
140 insert into e (name) values ('ergot');
141 insert into e (name) values ('esophagus');
142 insert into c_e (c_id,e_id) values (2,1);
143 insert into f (e1_id,e2_id,e3_id) values (2,3,4);
144 insert into g (a_id,e1_id,e2_id) values (2,5,6);
145 insert into h (a1_id,a2_id,e1_id,e2_id,e3_id) values (3,4,7,8,9);
146 insert into i (b_id,c_id,d_id) values (9,3,1);