Adding a check constraint|SQL Check Constraints|MYSQL|DBMS|CTTUTORIAL|Oracle|Netezza

Published: 09 September 2020
on channel: CT TUTORIAL
246
2

Adding a check constraint|SQL Check Constraints|MYSQL|DBMS|CTTUTORIAL|Oracle

#CTTUTORIAL #SQL #CHECK #CONSTRAINTS
In this video we will learn
1. How to add a check constraint in SQL Server
2. The purpose or use of check constraint
CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int
CHECK (Age greater than=18)
);
*Use Greater than symbol instead of text "Greater Than".
Insert into persons (`EMPID`,`LastName`,`FirstName`,`Age`)
values (1,"Ramesh","Sharma",16)

To add check constraints in multiple columns:
CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
City varchar(255),
CONSTRAINT CHK_Person CHECK (Age greater than=18 AND City='Sandnes')
);

ALTER TABLE Persons
ADD CONSTRAINT CHK_PersonAge CHECK (Age greater than=18AND City='Sandnes');

ALTER TABLE Persons
DROP CHECK CHK_PersonAge;


check constraint,sql server,purpose,use,table check constraint,table level check constraint sql server,restrict column values in sql server,alter table check constraint,alter table check constraint sql server,alter table add check constraint sql server,drop check constraint sql server,add check constraint to existing column


On this page of the site you can watch the video online Adding a check constraint|SQL Check Constraints|MYSQL|DBMS|CTTUTORIAL|Oracle|Netezza with a duration of hours minute second in good quality, which was uploaded by the user CT TUTORIAL 09 September 2020, share the link with friends and acquaintances, this video has already been watched 246 times on youtube and it was liked by 2 viewers. Enjoy your viewing!