Hosted by Dailymotion. For legal issues report at the Copyright Center, report us on DMC, or use the Instant Removal tool.
SQL SERVER 2017 TUTORIAL 8 : Constraints
Description
SQL constraints are used to specify rules for the data in a table.
Constraints let you define the way the Database Engine automatically enforces the integrity of a database. Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. Using constraints is preferred to using DML Triggers, rules, and defaults. The query optimizer also uses constraint definitions to build high-performance query execution plans.
Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the table. If there is any violation between the constraint and the data action, the action is aborted.
Constraints can be column level or table level. Column level constraints apply to a column, and table level constraints apply to the whole table.
The following constraints are commonly used in SQL:
NOT NULL - Ensures that a column cannot have a NULL value
UNIQUE - Ensures that all values in a column are different
PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
FOREIGN KEY - Uniquely identifies a row/record in another table
CHECK - Ensures that all values in a column satisfies a specific condition
DEFAULT - Sets a default value for a column when no value is specified
INDEX - Used to create and retrieve data from the database very quickly
Constraints let you define the way the Database Engine automatically enforces the integrity of a database. Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. Using constraints is preferred to using DML Triggers, rules, and defaults. The query optimizer also uses constraint definitions to build high-performance query execution plans.
Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the table. If there is any violation between the constraint and the data action, the action is aborted.
Constraints can be column level or table level. Column level constraints apply to a column, and table level constraints apply to the whole table.
The following constraints are commonly used in SQL:
NOT NULL - Ensures that a column cannot have a NULL value
UNIQUE - Ensures that all values in a column are different
PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
FOREIGN KEY - Uniquely identifies a row/record in another table
CHECK - Ensures that all values in a column satisfies a specific condition
DEFAULT - Sets a default value for a column when no value is specified
INDEX - Used to create and retrieve data from the database very quickly
Keywords & Tags
#SQL Server Constraints
#check constraints in sql
#sql check constraint multiple values
#not null constraints in sql
#sql not null query
#UNIQUE
#NOT NULL
#PRIMARY KEY
#FOREIGN KEY
#CHECK
#DEFAULT
#INDEX
#Constraints
#sql server 2017
#sql server 2016
#sql server
#sql server 2017 constraints
#types of constraints in sql
#types of data integrity
#data integrity
#database
#tsql free training
#sql
#mssql
#mssql training
#unique not null
#sql server tutorials
#sql server training
#sql server constraint
#check constraint in sql
#how to create constraint in sql server table
#index constraint
#sql not nul query
#primary key
#foreign key
#types of constraint
More from User
02:24
Dubai Nightlife
FAST tech
05:02
Las Vegas Strip : Nightlife
FAST tech
04:49
SSRS & BI TUTORIAL : 02 (PREREQUISITE & CUSTOMIZATION)
FAST tech
03:09
SSRS BI TUTORIAL : 01 (INTRODUCTION)
FAST tech
06:01
SQL SERVER 2017 TUTORIAL 11 : Store Image Files
FAST tech
03:00
SQL SEVER 2017 TUTORIAL 10: Scheduled Backup
FAST tech
Related Videos
09:53
Part-3 Table Constraints in SQL NOT NULL , DEFAULT
ALLCPL
02:55
SQL Server 2012 Applying data constraints and indexes in T-SQL
TrainingOnlineFree
42:30
Microsoft SQL Server 2012 tutorial 5- Creating and Modifying Constraints
Wrestle TV
06:28
SQL NOT NULL Constraint
CodeOfDotNet
08:34
How To Identify The Key Constraints In Your Life
BQ Podcast
00:39
Financial constraints will not be an obstacle in the treatment of any child: Anushree Shailendra Jain
Patrika