Commit 129107c4 authored by Gaetan Carabetta's avatar Gaetan Carabetta

Update SQL

parent 0a1dd7a7
,sillaw,v50,04.04.2019 19:10,file:///home/sillaw/.config/libreoffice/4;
\ No newline at end of file
CREATE TABLE ClasseEspece(
nomClasse VARCHAR(30) NOT NULL,
PRIMARY KEY(nomClasse)
);
CREATE TABLE Client(
idClient INT NOT NULL,
nom VARCHAR(30) NOT NULL,
prenom VARCHAR(30) NOT NULL,
ddn DATE NOT NULL,
adresse VARCHAR(100) NOT NULL,
numero NUMERIC(10) NOT NULL,
PRIMARY KEY(idClient)
numero INT NOT NULL,
PRIMARY KEY(idClient),
CHECK (numero >= 0100000000 AND numero <= 0799999999)
);
CREATE TABLE Assistant(
......@@ -14,10 +20,11 @@ CREATE TABLE Assistant(
prenom VARCHAR(30) NOT NULL,
ddn DATE NOT NULL,
adresse VARCHAR(100) NOT NULL,
numero NUMERIC(10) NOT NULL,
numero INT NOT NULL,
specialite VARCHAR(30),
PRIMARY KEY(idAssistant),
FOREIGN KEY(specialite) REFERENCES ClasseEspece(nomClasse)
FOREIGN KEY(specialite) REFERENCES ClasseEspece(nomClasse),
CHECK (numero >= 0100000000 AND numero <= 0799999999)
);
CREATE TABLE Veterinaire(
......@@ -26,15 +33,11 @@ CREATE TABLE Veterinaire(
prenom VARCHAR(30) NOT NULL,
ddn DATE NOT NULL,
adresse VARCHAR(100) NOT NULL,
numero NUMERIC(10) NOT NULL,
numero INT NOT NULL,
specialite VARCHAR(30),
PRIMARY KEY(idVeterinaire),
FOREIGN KEY(specialite) REFERENCES ClasseEspece(nomClasse)
);
CREATE TABLE ClasseEspece(
nomClasse VARCHAR(30) NOT NULL,
PRIMARY KEY(nomClasse)
FOREIGN KEY(specialite) REFERENCES ClasseEspece(nomClasse),
CHECK (numero >= 0100000000 AND numero <= 0799999999)
);
CREATE TABLE Espece(
......@@ -77,9 +80,9 @@ CREATE TABLE Traitement(
CREATE TABLE Espece_Med(
nomEspece VARCHAR(30) NOT NULL,
nomMolec VARCHAR(30) NOT NULL,
PRIMARY KEY(nomEspece, nomMolec)
PRIMARY KEY(nomEspece, nomMolec),
FOREIGN KEY(nomEspece) REFERENCES Espece(nomEspece),
FOREIGN KEY(nomMolec) REFERENCES Medicament(nomMolec),
FOREIGN KEY(nomMolec) REFERENCES Medicament(nomMolec)
);
CREATE TABLE Posologie(
......
......@@ -9,7 +9,7 @@ DROP TABLE IF EXISTS Traitement;
DROP TABLE IF EXISTS Medicament;
DROP TABLE IF EXISTS Animal;
DROP TABLE IF EXISTS Espece;
DROP TABLE IF EXISTS ClasseEspece;
DROP TABLE IF EXISTS Veterinaire;
DROP TABLE IF EXISTS Assistant;
DROP TABLE IF EXISTS Client;
DROP TABLE IF EXISTS ClasseEspece;
This diff is collapsed.
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