scott用户的四张表(emp,dept,bonus,salgrade)的建表语句
emp
-- Create tablecreate table EMP( empno NUMBER(4) not null, ename VARCHAR2(10), job VARCHAR2(9), mgr NUMBER(4), hiredate DATE, sal NUMBER(7,2), comm NUMBER(7,2), deptno NUMBER(2))tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );-- Create/Recreate primary, unique and foreign key constraints alter table EMP add constraint PK_EMP primary key (EMPNO) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );alter table EMP add constraint FK_DEPTNO foreign key (DEPTNO) references DEPT (DEPTNO);
dept
-- Create tablecreate table DEPT( deptno NUMBER(2) not null, dname VARCHAR2(14), loc VARCHAR2(13))tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );-- Create/Recreate primary, unique and foreign key constraints alter table DEPT add constraint PK_DEPT primary key (DEPTNO) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );
bonus
-- Create tablecreate table BONUS( ename VARCHAR2(10), job VARCHAR2(9), sal NUMBER, comm NUMBER)tablespace USERS pctfree 10 initrans 1 maxtrans 255;
salgrade
-- Create tablecreate table SALGRADE( grade NUMBER, losal NUMBER, hisal NUMBER)tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K noracle账号ext 1M minextents 1 maxextents unlimited );