1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
drop table commande cascade constraints;
drop table produit cascade constraints;
drop table prodcde cascade constraints;
create table produit(
idprod integer primary key,
libprod varchar(50) not null,
puprod decimal(6,2) not null
);
/
create table commande(idcde integer primary key,
datecde date not null);
/
create table Prodcde (idprod integer references produit(idprod),
idcde integer references commande(idcde),
qte integer default 1 not null,
constraint pk_prodcde primary key(idprod, idcde));
/
insert into produit (idprod,libprod,puprod) values (100,'stylo',55);
insert into produit (idprod,libprod,puprod) values (101,'gomme',114);
insert into produit (idprod,libprod,puprod) values (102,'règle',13.9);
insert into commande(idcde, datecde) values (1234, sysdate);
insert into commande(idcde, datecde) values (1235, sysdate);
insert into prodcde(idcde, idprod, qte) values (1234,100,12);
insert into prodcde(idcde, idprod, qte) values (1234,101,8);
insert into prodcde(idcde, idprod, qte) values (1235,100,6);
insert into prodcde(idcde, idprod, qte) values (1235,101,14);
insert into prodcde(idcde, idprod, qte) values (1235,102,9);
commit;
select * from commande;
select * from prodcde;
select * from produit; |
Partager