Hello I need help translating this E.R diagram to table
Do I create a table for each entity and relationship ?
Hello I need help translating this E.R diagram to table
Do I create a table for each entity and relationship ?
Create Table E ( Id VARCHAR(10) PRIMARY KEY)
CREATE TABLE R(ID VARCHAR(10) FOREIGN KEY
REFERENCES E(Id)) , Value VARCHAR(10))
INSERT INTO E VALUES("R1");
INSERT INTO E VALUES("R2");
INSERT INTO R VALUES("R1",A1);
INSERT INTO R VALUES("R2",A2);
Meaning each entity
E
is anID
andId
has a Value (1-1) meaning for each id one value but E has many ids (0-n). But you should agree that the relationships are impractical and are of no use.
As far as I understand, this means that entities E1
and E2
have one-to-many relation with the entity E
. In a way, you could define a table for each entity E
, E1
and E2
and define the foreign keys of E1
and E2
in the E
table.