I want to represent a many to many relationship in a relational model and I'm having some doubts.
CREATE TABLE TipoDeSeguro
(
tipoSeguro TEXT NOT NULL,
tipoDeSeguroID INTEGER NOT NULL PRIMARY KEY
)
;
CREATE TABLE Cobertura
(
nome TEXT NOT NULL,
coberturaID INTEGER NOT NULL PRIMARY KEY
)
;
These are the tables I want to join using a many to many relationShip.
CREATE TABLE JoinTipoDeSeguroToCobertura
(
coberturaID INTEGER,
tipoDeSeguroID INTEGER
)
;
This is my junction table. Are both of these tuples PRIMARY KEYS? Should they both reference to their main class?
Best regards
Aucun commentaire:
Enregistrer un commentaire