sql创建带约束的表

时间:2015-09-14 08:25:27

标签: sql oracle

当我运行此代码时出错,

  

SQL错误:ORA-00905:缺少关键字   00905. 00000 - “缺少关键字”

     

*原因:
  *动作:在ORACLE上运行它。不知道如何解决它。

CREATE TABLE LAB4 (
  ROOMID1 NUMBER(8) NOT NULL,
  BUILDING1 VARCHAR2(25) NOT NULL,
  ROOMNO1 VARCHAR2(25) NOT NULL,
  CONSTRAINT ROOMPK1 PRIMARY KEY(ROOMID1));

CREATE TABLE BOOKING (
  BOOKINGID NUMBER(4) NOT NULL ,
  DAYOFWEEK CHAR(15) NOT NULL,
  TIMEOFDAY CHAR(8) NOT NULL,
  DURATION VARCHAR2(20)NOT NULL,
  UNITCODE NUMBER(8)NOT NULL,
  ROOMID NUMBER(4) NOT NULL, 
  CONSTRAINT BOOKINGPK PRIMARY KEY(BOOKINGID),
  CONSTRAINT LABFK FOREIGN KEY(ROOMID)
    REFERENCES LAB(ROOMID)
     ON UPDATE NO ACTION
    ON DELETE NO ACTION
  );

0 个答案:

没有答案