After reading several articles on n-ary database relationships I'm still in the dark on some aspects of them.
I draw the ER diagram below myself and I purposedly used fake, made-up English words that cannot convey any semantics:
Does it mean that:
- Each abacot kimes at most once with a gimble, and with many dords and wabes?
- Similarly, each gimble kimes at most once with an abacot, and with many dords and wabes?
- Each kiming relationship may include several dords and/or wabes?
- Will I need three tables to represent this relationship, or one will suffice?
But above all, is it possible to generate a database schema with this diagram alone, without any extra explanations? The database exercises I see in books don't include anything else besides the diagram.
This is how I see it so far:
CREATE TABLE kiming (
kiming_id INT PRIMARY KEY NOT NULL,
abacot_id INT NOT NULL REFERENCES abacot (abacot_id),
gimble_id INT NOT NULL REFERENCES gimble (gimble_id),
UNIQUE (abacot_id), -- is this necessary?
UNIQUE (gimble_id) -- is this necessary?
);
CREATE TABLE kiming_wabe ( -- do I need this table?
kiming_id INT REFERENCES kiming (kiming_id),
wabe_id INT REFERENCES wabe (wabe_id)
);
CREATE TABLE kiming_dord ( -- do I need this table?
kiming_id INT REFERENCES kiming (kiming_id),
dord_id INT REFERENCES dord (dord_id)
);