Oracle SQL/PLSQL Section 2.5: Create a table
Below we are going to create a table with 3 columns.
The column Id must be filled is, so we define it NOT NULL.
On the column Contract we also add a check so that the only value allowed is 'Y' or 'N'. If an insert in done and this
column is not specified during the insert then default a 'N' is inserted.
CREATE TABLE Employee (
Id NUMBER NOT NULL,
Name VARCHAR2(60),
Contract CHAR DEFAULT 'N' NOT NULL,
CONSTRAINT p_Id PRIMARY KEY(Id),
CONSTRAINT c_Contract CHECK (Contract IN('Y','N'))
);
0 Comments