Set Default Values
Examples:
To Fixed / Check / Restrict values for Column
Examples:
Examples:
CREATE TABLE ExampleTable
(
Id int NOT NULL,
Frequency varchar2(200) default 'Daily');
ALTER TABLE exampleTable ADD COLUMN new_column VarChar2(20) DEFAULT 'value1';
To Fixed / Check / Restrict values for Column
Examples:
CREATE TABLE ExampleTable
(
Id int NOT NULL,
Frequency varchar2(200),
CONSTRAINT chk_Frequency CHECK (Frequency IN ('Daily', 'Weekly', 'Monthly', 'Yearly'))
);
alter table ExampleTable
add (new_column varchar2(20) default 'value1',
constraint ckExampleTable check (new_column in ('value1', 'value2', 'value3')));
No comments:
Post a Comment