TP1 SQL Restaurant
TP1 SQL Restaurant
create table restaurants (idR varchar2(20) primary key, nom varchar2(20) Unique,
create table livreurs (idl int primary key, cin Number(8) not null unique, nom
varchar2(30),
prenom varchar2(30), tel number(8), daterec date,
constraint L_ck check (cin between 00000000 and 99999999));
create table commandes (idc int primary key, idl int, idcli int, total
number(4),
datehcom timestamp, datehliv timestamp, paye integer,
constraint C_FK1 Foreign Key (idl) references livreurs (idL),
constraint C_FK2 Foreign Key (idCli) references clients (idcli));
create table clients (idcli int primary key, login varchar2(20) unique,
mdp varchar2(20), nom varchar2(30), prenom varchar2(30),
tel number(8), ville varchar2(20),
constraint Cl_ck check (tel between 00000000 and 99999999)
);
create table lignecommande (idc int, ref_P int, quantite int not null,
Constraint LC_Pk Primary Key(idc,ref_P),
constraint LC_FK1 Foreign key(idc) references commandes (idc),
constraint LC_FK2 Foreign key(ref_P) references plats (ref_P));
--Question 2
--Question 3