CREATE TABLE TEMP_STUDENT
(STUDID NUMBER(8,0) NOT NULL PRIMARY KEY,
FIRST_NAME VARCHAR2(25),
LAST_NAME VARCHAR2(25),
ZIP VARCHAR2(5) FOREIGN KEY REFERENCES ZIPCODE(ZIP),
REGISTRATION_DATE DATE NOT NULL CHECK (REGISTRATION_DATE > TO_DATE('1-JAN-2000 00:00:00','DD-MON-YYYY HH24:MI:SS')))
这有什么问题,请帮忙。我收到错误:'错过了正确的家长'
答案 0 :(得分:1)
问题在于您的FOREIGN KEY REFERENCES
检查。
您想要this:
create table zipcode
(
zip varchar2(5) primary key
);
CREATE TABLE TEMP_STUDENT
(STUDID NUMBER(8,0) NOT NULL PRIMARY KEY,
FIRST_NAME VARCHAR2(25),
LAST_NAME VARCHAR2(25),
ZIP VARCHAR2(5),
REGISTRATION_DATE DATE NOT NULL CHECK (REGISTRATION_DATE > TO_DATE('1-JAN-2000 00:00:00','DD-MON-YYYY HH24:MI:SS')),
constraint foreign key REFERENCES ZIPCODE(ZIP));
答案 1 :(得分:-1)
alter TEMP_STUDENT add constraint REGISTRATION_DATE_CHK check (REGISTRATION_DATE > TO_DATE('1-JAN-2000 00:00:00','DD-MON-YYYY HH24:MI:SS'))