while inserting record into the table constraints must be satisfied for columns, then Row will insert.
multiple columns come into the condition.
(
[ID] INT PRIMARY KEY,
[AdmissionDate] DATE NOT NULL,
[DischargeDate] DATE NOT NULL,
[OpearationDate] DATE NOT NULL,
CONSTRAINT Check_OpearationDate CHECK( [OpearationDate] BETWEEN [AdmissionDate] AND [DischargeDate])
)
Column Level Constraints
while inserting record into the table constraints must be satisfied (only specific to the column), then Row will insert.
only limited to one column.
Default & check constraint are the example of column level constraint.
Create table [Customer]
(
[ID] INT PRIMARY KEY,
[FirstName] varchar(10),
[LastName] varchar(10),
[DateOfBirth] DATE NOT NULL,
CONSTRAINT Check_BirthDate CHECK( [DateOfBirth]>'1980-01-01')
)
Comments
Post a Comment
If you have any doubt then please let me know in comment section.