Update create.sql

parent da87aa59
......@@ -52,7 +52,9 @@ CREATE TABLE Animal(
especeNom VARCHAR(30),
PRIMARY KEY(idAnimal),
FOREIGN KEY (idClient) REFERENCES Client(idClient),
FOREIGN KEY (especeNom) REFERENCES Espece(nomEspece)
FOREIGN KEY (especeNom) REFERENCES Espece(nomEspece),
CHECK (POIDS > 0),
CHECK (TAILLE > 0)
);
CREATE TABLE Medicament(
......@@ -74,7 +76,8 @@ CREATE TABLE Espece_Med(
nomEspece VARCHAR(30) NOT NULL,
nomMolec VARCHAR(30) NOT NULL,
FOREIGN KEY(nomEspece) REFERENCES Espece(nomEspece),
FOREIGN KEY(nomMolec) REFERENCES Medicament(nomMolec)
FOREIGN KEY(nomMolec) REFERENCES Medicament(nomMolec),
PRIMARY KEY(nomEspece, nomMolec)
);
CREATE TABLE Posologie(
......@@ -83,7 +86,9 @@ CREATE TABLE Posologie(
debut DATE NOT NULL,
duree INT NOT NULL,
nbJourna INT NOT NULL,
PRIMARY KEY(idAnimal, nomMolec, debut)
PRIMARY KEY(idAnimal, nomMolec, debut),
CHECK (duree > 0),
CHECK (nbJourna > 0)
);
/* Methodes */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment