Hello guys , I am sharing CHECK constraint with you.
Following is the example to apply SQL CHECK Constraint on CREATE TABLE
CREATE TABLE Employee
Following is the example to DROP a CHECK Constraint
CHECK constraints CHECK constraint is used to limiting
the values that are accepted by one or more columns.
Following is the example to apply SQL CHECK Constraint on CREATE TABLE
CREATE TABLE Employee
(
Id int
NOT NULL CHECK (Id>0),
Name varchar(255) NOT NULL,
Address varchar(255),
Age int,
)
Following is the example to apply SQL CHECK Constraint on ALTER TABLE
)
Following is the example to apply SQL CHECK Constraint on ALTER TABLE
ALTER TABLE Employee
ADD CONSTRAINT chk_Employee CHECK
(Id>0
AND age> 20)
Following is the example to DROP a CHECK Constraint
ALTER TABLE Employee
DROP CONSTRAINT chk_Employee
No comments:
Post a Comment
Note: only a member of this blog may post a comment.