Вы находитесь на странице: 1из 1

create table CLIENT(

CUSID numeric(6) primary key not null


);
create table DEPT(
DEPTNO numeric(2) PRIMARY KEY NOT NULL,
DNAME varchar(14),
LOC varchar (13)
);
create table EMP(
EMPNO numeric(4) PRIMARY KEY NOT NULL,
ENAME varchar(10),
JOB varchar(9),
MGR numeric(4),
HIREDATE date,
SAL numeric(7,2),
COMM numeric(7,2),
DEPTNO numeric(2) NOT NULL,
FOREIGN KEY(DEPTNO) REFERENCES DEPT(DEPTNO)
);
create table SALGRADE(
GRADE numeric,
LOSAL numeric,
HISAL numeric
);
create table PRODUCT(
PRODID numeric(6) PRIMARY KEY NOT NULL,
DESCRIP varchar(30)
);
create table ORD(
ORDID numeric(4) PRIMARY KEY NOT NULL,
ORDERDATE date,
COMMPLAN varchar(1),
CUSID numeric(6) NOT NULL,
FOREIGN KEY(CUSID) REFERENCES CLIENT(CUSID),
SHIPDATE date,
TOTAL numeric(8,2)
);
create table ITEM(
ORDID numeric(4) NOT NULL,
FOREIGN KEY (ORDID) REFERENCES ORD(ORDID),
ITEMID numeric(6) PRIMARY KEY,
PRODID numeric(6) NOT NULL,
FOREIGN KEY (PRODID) REFERENCES PRODUCT(PRODID),
ACTUALPRICE numeric(8,2),
QTY numeric(8),
ITEMTOTAL numeric(8,2)
);