Need some help with this:
Create a table called TEMP_STUDENT with the following columns and constraints: a column STUD_ID for the student ID and is the
Try this
CREATE TABLE Temp_Student
(STUD_ID NUMBER (8,0),
FIRST_NAME VARCHAR2(25) NOT NULL,
LAST_NAME VARCHAR2(25) NOT NULL,
ZIP VARCHAR2(5),
REGISTRATION_DATE DATE NOT NULL,
CONSTRAINT STUD_ID_PK PRIMARY KEY(STUD_ID),
CONSTRAINT ZIP_FK FOREIGN KEY (ZIP)
REFERENCES ZIPCODE (ZIP),
CONSTRAINT chk_REGISTRATION_DATE CHECK (REGISTRATION_DATE> TO_DATE('26-AUGUST-2005'))
)
You have several errors in your expression:
to_date()
not to date()
(note the underscore)to_date(..)
, not 'to_date(...)'
>
operator which is also wrong.So the correct expression is this:
CONSTRAINT chk_REGISTRATION_DATE
CHECK (REGISTRATION_DATE > TO_DATE('2005-08-26', 'yyyy-mm-dd'))
Note that you should always specify a format when using to_date()
otherwise the conversion is subject to the NLS setting of the server and the client and might produce strange errors.
And even if you use a format mask you should not use a literal that depends on the current NLS language. AUGUST
might not work for all languages as the month name. It's better to use the month number.