您的位置:首页 > 数据库 > Oracle

oracle 20130913级联

2013-11-12 15:38 363 查看
 

部门表:

createtable DEPARTMENT

(

  ID  
NUMBERnotnull,

  NAMEVARCHAR2(20)

)

tablespaceMAINTABLESPACE

  pctfree10

  initrans1

  maxtrans255

  storage

  (

    initial64K

    minextents1

    maxextentsunlimited

  );

-- Create/Recreate primary,unique and foreign key constraints

altertable DEPARTMENT

  addconstraint PK1
primarykey (ID)

  usingindex

  tablespace MAINTABLESPACE

  pctfree10

  initrans2

  maxtrans255

  storage

  (

    initial64K

    minextents1

    maxextentsunlimited

  );

 

员工表:

createtable EMPLYEE

(

  ID    
NUMBER,

  NAME  
VARCHAR2(20),

  DEPTID
NUMBER

)

tablespace MAINTABLESPACE

  pctfree10

  initrans1

  maxtrans255

  storage

  (

    initial64K

    minextents1

    maxextentsunlimited

  );

-- Create/Recreate primary, uniqueand foreign key constraints

altertable EMPLYEE

  addconstraint FK1
foreignkey (DEPTID)

  references DEPARTMENT (ID)
ondeletecascade;

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: