DROP TABLE exemplaire;
DROP TABLE repas;
DROP TABLE platboisson;
DROP TABLE tablee;
DROP TABLE serveur;

CREATE TABLE serveur(code_serveur varchar(20) PRIMARY KEY);
CREATE TABLE tablee (code_table varchar(5) PRIMARY KEY, serveur varchar(20) REFERENCES serveur);
CREATE TABLE platboisson (code_plat varchar(20) PRIMARY KEY, prix real);
CREATE TABLE repas (code_repas varchar(20) PRIMARY KEY, tablee varchar(5) REFERENCES tablee);
CREATE TABLE exemplaire ( statut varchar(20), code varchar PRIMARY KEY, repas varchar(20) REFERENCES repas, typee varchar(20) REFERENCES platboisson); 

INSERT INTO  serveur values ('ali'), ('mouss'), ('coco'), ('hank') ;
INSERT INTO tablee values ('t1','ali'),('t2','ali'),('t3','mouss'),('t4','mouss'),('t5','coco'),('t6','coco'), ('t7','hank'), ('t8','hank');
INSERT INTO platboisson values ( 'steackfrite', 5),('hamburger',3),('galette',2),('crepe',1.50),('pate',3),('pizza',4),('salade',3),('orangina',1.50),('cocacola',1.50),('cidre',2),('vin',2);
INSERT INTO repas values ('001','t1'),('002','t2'),('009','t2'),('003','t3'),('004','t4'),('005','t5'),('006','t5'),('007','t7'),('008','t8');
INSERT INTO exemplaire values ('P','01','001','steackfrite'),('C','02','002','galette'),('P','03','003','hamburger'),('P','04','004','galette'),('S','05','004','cidre'),('C','06','002','vin'),('C','08','002','vin'),('S','07','008','salade');