Reputation: 11
The task is: a new table, BENEFITS
, must be created to store the available benefit plan options and must contain the following columns:
Ben_id
: a numeric column similar to the one added to the ACCTMANAGER
tableBen_plan
: a character column that can store a single character valueBen_provider
: a numeric column that can store a three-digit integerActive
: a character column that can hold a value of Y
or N
So far I have
CREATE TABLE Benefits
(
Ben_id NUMBER(2),
Ben_plan VARCHAR2(1),
Ben_provider NUMBER(3),
Active VARCHAR2(1)
);
But how can I make the Active
only accepts Y
or N
? I'm learning on using the CONSTRAINT
, just still can't understand it.
Upvotes: 0
Views: 33
Reputation: 11
CREATE TABLE Benefits
(Ben_id NUMBER(2),
Ben_plan VARCHAR2(1),
Ben_provider NUMBER(3),
Active VARCHAR2(1) CHECK (Active = 'Y' OR Active = 'N'));
Upvotes: 1