Vous êtes sur la page 1sur 1

;

create table supplier(sno char(2) primary key, sname varchar2(15) not null, sal
numeric(5));
create table part(pno char(2) primary key, pname varchar2(15) not null);
create table supply(sno char(2) constraint fk_sno references supplier,
pno char(2) constraint fk_pno references part,
qty numeric(3) not null,
primary key(sno,pno));
create table supply(sno char(2), pno char(2), qty number(3) not null,
constraint fk_sno foreign key(sno) references supplier,
constraint fk_pno foreign key(pno) references part,
primary key(sno, pno));
create table supply(sno char(2), pno char(2), qty number(3) not null,
constraint fk_sno foreign key(sno) references supplier on del
ete cascade,
constraint fk_pno foreign key(pno) references part on delete
cascade,
primary key(sno, pno));
alter table supply add constraint chk_qty check(qty > 0);
select constraint_name, constraint_type
from user_constraints
where table_name='SUPPLY';
create table supply(sno char(2),pno char(2),qty number(3) not null,
constraint pk_sno_pno primary key(sno,pno),
constraint fk_sno foreign key(sno) references supplier,
constraint fk_pno foreign key(pno) references part,
constraint chk_qty check(qty>0));
select
from
where

constraint_name, column_name
user_cons_columns
table_name='SUPPLY';