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

Update create_table.sql

parent 83523257
Create table Client (
ID_Client INT NOT NULL IDENTITY primary key,
ID_Client INT NOT NULL,
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) ~'[0-9]{10}'NOT NULL /*Nous ne pouvons pas mettre le contraint, mais nous pouvons le faire en passant par la condition sur pHp*/
Numero_de_telephone varchar(10) NOT NULL,
CHECK(Numero_de_telephone LIKE '[0-9]{10}'),
PRIMARY KEY(ID_Client)
);
Create table Classe_animal (
ID_classes INT NOT NULL IDENTITY primary key,
ID_classes INT NOT NULL primary key,
Nom varchar(30) NOT NULL
);
Create table Veterinaire (
ID_personnel INT NOT NULL IDENTITY primary key,
ID_personnel INT NOT NULL 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)
Specialite INT,
foreign key (Specialite) references Classe_animal(ID_classes)
);
Create table Assistant (
ID_personnel INT NOT NULL IDENTITY primary key,
ID_personnel INT NOT NULL 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)
Specialite INT,
foreign key (Specialite) references Classe_animal(ID_classes)
);
Create table Espece (
ID_espece INT NOT NULL IDENTITY primary key,
ID_espece INT NOT NULL primary key,
Nom varchar(30) NOT NULL,
Classe INT foreign key references Classe_animal(ID_classes)
Classe INT,
foreign key(Classe) references Classe_animal(ID_classes)
);
Create table Animal (
ID_Animal INT NOT NULL IDENTITY primary key,
ID_Animal INT NOT NULL primary key,
Nom varchar(30) NOT NULL,
Poids FLOAT NOT NULL,
Taille FLOAT NOT NULL,
Date_de_naissance date NOT NULL,
ID_Espece INT foreign key references Espece(ID_espece),
ID_Client INT foreign key references Client(ID_Client),
ID_Espece INT,
foreign key(ID_Espece) references Espece(ID_espece),
ID_Client INT,
foreign key(ID_Client) references Client(ID_Client),
CHECK (Poids > 0),
CHECK (Taille > 0)
);
Create table Effets_secondaires (
ID_effet_secondaire INT NOT NULL IDENTITY primary key,
ID_effet_secondaire INT NOT NULL primary key,
Effets varchar(100) NOT NULL
);
Create table Medicament (
ID_Medicament INT NOT NULL IDENTITY primary key,
ID_Medicament INT NOT NULL 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)
Medicament INT,
foreign key(Medicament) references Medicament(ID_Medicament),
Effets_secondaires INT,
foreign key(Effets_secondaires) 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),
ID_Medicament INT,
foreign key(ID_Medicament) references Medicament(ID_Medicament),
ID_espece INT,
foreign key(ID_Espece) references Espece(ID_espece),
);
Create table Traitement (
ID_Traitement INT NOT NULL IDENTITY primary key,
ID_Traitement INT NOT NULL 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,
ID_Animal INT,
foreign key(ID_Animal) references Animal(ID_Animal),
Veterinaire INT,
foreign key(Veterinaire) 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),
Traitement INT,
foreign key(Traitement) references Traitement(ID_Traitement),
ID_Medicament INT,
foreign key(ID_Medicament) 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