Commit 7d6cfc75 authored by Robin Bouvier's avatar Robin Bouvier
Browse files

Update JSON_CREATE.sql

parent 364fd30d
......@@ -4,5 +4,45 @@ CREATE TABLE Animal VALUES (
dernierPoids INTEGER NOT NULL,
derniereTaille INTEGER NOT NULL,
dateNaissance INTEGER NOT NULL,
traitements JSON
espece VARCHAR(50) NOT NULL,
traitements JSON,
PRIMARY KEY (id),
FOREIGN KEY (espece) REFERENCES Especes(nom),
CHECK (dernierPoids > 0),
CHECK (derniereTaille > 0)
);
CREATE TABLE Classes(
nom VARCHAR(50),
PRIMARY KEY (nom)
);
CREATE TABLE Especes(
nom VARCHAR(50),
classe VARCHAR(50) NOT NULL,
PRIMARY KEY (nom),
FOREIGN KEY (classe) REFERENCES Classes(nom)
);
CREATE TABLE Clients(
id INTEGER,
telephone INTEGER NOT NULL,
nom VARCHAR(50) NOT NULL,
prenom VARCHAR(50) NOT NULL,
date_naissance DATE NOT NULL,
adresse VARCHAR(255) NOT NULL,
PRIMARY KEY (id),
CHECK (telephone > 100000000 AND telephone < 999999999)
);
CREATE TABLE Proprietaires(
client INTEGER,
animal INTEGER,
PRIMARY KEY (client, animal),
FOREIGN KEY (client) REFERENCES Clients(id),
FOREIGN KEY (animal) REFERENCES Animaux(id)
);
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