Commit 69d3b178 authored by Nu Huyen Trang Pham's avatar Nu Huyen Trang Pham
Browse files

Code SQL Création des tables

parent 0ede7414
Create table Client (
ID_Client INT NOT NULL IDENTITY primary key,
Nom varchar(30) NOT NULL,
Prenom varchar(30) NOT NULL,
Date_de_naissance date NOT NULL,
Addresse varchar(100) NOT NULL,
Numero_de_telephone varchar(10) NOT NULL /*Nous ne pouvons pas mettre le contraint, mais nous pouvons le faire en passant par la condition sur pHp*/
);
Create table Classe_animal (
ID_classes INT NOT NULL IDENTITY primary key,
Nom varchar(30) NOT NULL
);
Create table Veterinaire (
ID_personnel INT NOT NULL IDENTITY primary key,
Nom varchar(30) NOT NULL,
prenom varchar(30) NOT NULL,
Date_de_naissance date NOT NULL,
Addresse varchar(100) NOT NULL,
Numero_de_telephone varchar(30) NOT NULL,
Specialite INT foreign key references Classe_animal(ID_classes)
);
Create table Assistant (
ID_personnel INT NOT NULL IDENTITY primary key,
Nom varchar(30) NOT NULL,
prenom varchar(30) NOT NULL,
Date_de_naissance date NOT NULL,
Addresse varchar(100) NOT NULL,
Numero_de_telephone varchar(30) NOT NULL,
Specialite INT foreign key references Classe_animal(ID_classes)
);
Create table Espece (
ID_espece INT NOT NULL IDENTITY primary key,
Nom varchar(30) NOT NULL,
Classe INT foreign key references Classe_animal(ID_classes)
);
Create table Animal (
ID_Animal INT NOT NULL IDENTITY primary key,
Nom varchar(30) NOT NULL,
Poids FLOAT NOT NULL,
Taille FLOAT NOT NULL,
Date_de_naissance date NOT NULL,
ID_Espèce INT foreign key references Espece(ID_espece),
ID_Client INT foreign key references Client(ID_Client)
CHECK (Poids > 0)
CHECK (Taille > 0)
);
Create table Effets_secondaires (
ID_effet_secondaire INT NOT NULL IDENTITY primary key,
Effets varchar(100) NOT NULL
);
Create table Medicament (
ID_Medicament INT NOT NULL IDENTITY primary key,
Nom_de_molecule varchar(30) NOT NULL,
Description varchar(100) NOT NULL,
);
Create table Medicament_Effet (
Medicament INT foreign key references Medicament(ID_Medicament),
Effets_secondaires INT foreign key references Effets_secondaires(ID_effet_secondaire)
);
Create table Med_correspond_Ani (
ID_Medicament INT foreign key references Medicament(ID_Medicament),
ID_espece INT foreign key references Espece(ID_espece),
);
Create table Traitement (
ID_Traitement INT NOT NULL IDENTITY primary key,
Debut Time NOT NULL,
Duree Time NOT NULL,
Nom varchar(30) NOT NULL,
ID_Animal INT foreign key references Animal(ID_Animal),
Veterinaire INT foreign key references Veterinaire,
CHECK (Duree > 0)
);
Create table Traitement_Medicament (
Traitement INT foreign key references Traitement(ID_Traitement),
ID_Medicament INT foreign key references Medicament(ID_Medicament),
Quantite_medicaments_pj INT NOT NULL
CHECK (Quantite_medicaments_pj > 0)
);
Supports Markdown
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