CREATE TABLE Employee(
  EmployeeNo    char(8)                 not null,            /*员工编号*/
  EmployeeName  varchar2(30)            not null,            /*员工姓名*/
  DepartmentNo  char(2)                 not null,            /*所属部门*/
  Sex           varchar(2)
             check(sex in('男','女'))   not null,            /*性别*/
  EmployeeDate  date                    null,                /*出生日期*/
  WorkDate      date                    null,                /*工作日期*/
  NationNo      char(3)                 null,                /*民族*/
  PostNo        char(3)                 null,                /*岗位*/
   constraint Employee_PK primary key(EmployeeNo),
   constraint EmployeeDEpartment_FX1 foreign key(DepartmentNo),
              references DEpartment(DEpartmentNo),
   constraint DepartmentNo_FK2 foreign key(NationNo) references DCNation(NationNo),
   constraint EmployeePost_FK3 foreign key(PostNo)   references DCPost(PostNO)
 );
这段代码有错误,希望那为指出来, 谢谢!

解决方案 »

  1.   

    把错误帖出来,现在看至少
    ---------------------------------------------------------------
       constraint EmployeeDEpartment_FX1 foreign key(DepartmentNo),
                  references DEpartment(DEpartmentNo),
    ---------------------------------------------------------------
    foreign key(DepartmentNo),多了个逗号.
      

  2.   

    CREATE TABLE Employee(
      EmployeeNo    char(8)                 not null,            /*员工编号*/
      EmployeeName  varchar2(30)            not null,            /*员工姓名*/
      DepartmentNo  char(2)                 not null,            /*所属部门*/
      Sex           varchar(2)
                 check(sex in('男','女'))   not null,            /*性别*/
      EmployeeDate  date                    null,                /*出生日期*/
      WorkDate      date                    null,                /*工作日期*/
      NationNo      char(3)                 null,                /*民族*/
      PostNo        char(3)                 null,                /*岗位*/
       constraint Employee_PK primary key(EmployeeNo),
       constraint EmployeeDEpartment_FX1 foreign key(DepartmentNo),/*报错缺少关键字*/
                  references DEpartment(DEpartmentNo),
       constraint DepartmentNo_FK2 foreign key(NationNo) references DCNation(NationNo),
       constraint EmployeePost_FK3 foreign key(PostNo)   references DCPost(PostNO)