1

Here is my table declaration for Oracle SQL.

create table students (
    sid char(4) primary key check (sid like 'B%'),
    firstname varchar2(15) not null,
    lastname varchar2(15) not null,
    status varchar2(10) check (status in (‘freshman’, ‘sophomore’, ‘junior’, ‘senior’, ‘graduate’)),
    gpa number(3,2) check (gpa between 0 and 4.0),
    email varchar2(20) unique
    );

Why does the following error occur

ORA-02438: Column check constraint cannot reference other columns

1 Answer 1

3

Use single quotes: 'freshman',...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.