当我运行我的脚本时,我一直在名册表上得到上面的错误,请问我做错了什么?有什么建议吗?
CREATE TABLE SHIFT (
Shift_ID NUMBER(5),
Shift_Type VARCHAR2(20),
Start_Time VARCHAR2(10),
End_Time VARCHAR2(10),
CONSTRAINT PK_SHIFT PRIMARY KEY (Shift_ID, Start_Time, End_Time)
-- CONSTRAINT CHECK_SHIFT_TYPE CHECK (SHIFT_Type IN ('Day', 'Night'))
-- CONSTRAINT CHECK_TOTAL_HOURS CHECK (Total_Hours IN (6, 8, 12))
);
CREATE TABLE ROSTER(
Roster_ID NUMBER(5),
Shift_Date DATE,
Shift_End_Date DATE,
Total_Hours NUMBER(2),
Shift_ID NUMBER(5) REFERENCES SHIFT(Shift_ID),
Start_Time VARCHAR2(10) REFERENCES SHIFT(Start_Time),
End_Time VARCHAR2(10) REFERENCES SHIFT(End_Time),
Ward_ID NUMBER(5) REFERENCES WARD (Ward_ID),
Ward_Name VARCHAR2(25) REFERENCES WARD (Ward_Name),
CONSTRAINT PK_ROSTER PRIMARY KEY (Roster_ID)
);
1条答案
按热度按时间ngynwnxp1#
如果你需要创建一个包含多个列的外键,或者希望命名它,你不能使用列级语法...你必须在最后添加一个
CONSTRAINT
,像这样: