Script du projet

parent e88ce038
DROP TABLE IF EXISTS Client;
CREATE TABLE Client (
idClient int NOT NULL,
nom varchar (20) NOT NULL,
prenom varchar (20) NOT NULL,
ddn date NOT NULL,
adresse varchar (100),
numero integer,
PRIMARY KEY (idClient)
);
DROP TABLE IF EXISTS Assistant;
CREATE TABLE Assistant(
idAssistant int NOT NULL,
nom varchar (20) NOT NULL,
prenom varchar (20) NOT NULL,
ddn date NOT NULL,
adresse varchar (100),
numero integer,
specialite varchar (50),
PRIMARY KEY (idAssistant)
);
DROP TABLE IF EXISTS Veterinaire;
CREATE TABLE Veterinaire(
idVet int NOT NULL,
nom varchar (20) NOT NULL,
prenom varchar (20) NOT NULL,
ddn date NOT NULL,
adresse varchar (100),
numero integer,
specialite varchar (50),
PRIMARY KEY (idVet)
);
DROP TABLE IF EXISTS ClasseEspece;
CREATE TABLE ClasseEspece (
nomClasse varchar (20) NOT NULL,
PRIMARY KEY (nomClasse)
);
DROP TABLE IF EXISTS Espece;
CREATE TABLE Espece (
nomEspece varchar (30) NOT NULL,
nomClasse varchar (20) NOT NULL,
PRIMARY KEY (nomEspece),
FOREIGN KEY (nomClasse) REFERENCES ClasseEspece (nomClasse)
);
DROP TABLE IF EXISTS Animal;
CREATE TABLE Animal(
idAnimal int NOT NULL,
nom varchar (20) NOT NULL,
poids float NOT NULL,
taille float NOT NULL,
ddn date,
PRIMARY KEY (idAnimal)
);
DROP TABLE IF EXISTS Medicament;
CREATE TABLE Medicament(
nomMolec varchar (30) NOT NULL,
description varchar (100) NOT NULL,
PRIMARY KEY (nomMolec)
);
DROP TABLE IF EXISTS Espece_Med;
CREATE TABLE Espece_Med(
nomEspece varchar (30) NOT NULL,
nomMolec varchar (30) NOT NULL,
PRIMARY KEY (nomEspece,nomMolec),
FOREIGN KEY (nomEspece) REFERENCES Espece (nomEspece),
FOREIGN KEY (nomMolec) REFERENCES Medicament (nomMolec)
);
DROP TABLE IF EXISTS Traitement;
CREATE TABLE Traitement(
idTraitement int NOT NULL,
idAnimal int NOT NULL,
idVet int NOT NULL,
PRIMARY KEY (idTraitement),
FOREIGN KEY (idAnimal) REFERENCES Animal (idAnimal),
FOREIGN KEY (idVet) REFERENCES Veterinaire (idVet)
);
DROP TABLE IF EXISTS Posologie;
CREATE TABLE Posologie(
idTraitement int NOT NULL,
nomMolec varchar (30) NOT NULL,
PRIMARY KEY (idTraitement,nomMolec),
FOREIGN KEY (idTraitement) REFERENCES Traitement (idTraitement),
FOREIGN KEY (nomMolec) REFERENCES Medicament (nomMolec)
);
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