From the course: Microsoft SQL Server 2019 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Check constraints - SQL Server Tutorial
From the course: Microsoft SQL Server 2019 Essential Training
Check constraints
- [Instructor] When your data is expected to meet some criteria, you can ensure that what gets entered into your data tables is valid with a check constraint. Check constraints are similar to the data validation features of spreadsheet programs like Excel. With a check constraint on your table, SQL Server will make sure that the values that are being written to your data tables meet the requirements that you specified. I want to add a check constraint to the Landon Hotel guest table. So I'm going to right-click on it and go into design. To add a check constraint to your data table click on the manage check constraint buttons on the toolbar here or you can right-click on any field and choose check constraints from the popup menu. Check constraints are a table-level property. They're not attached to any specific column so it doesn't matter which column you right-click on to get here. That will open up the check constraints window. I'll go ahead and press the add button to add in a new…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Understand data types6m 46s
-
Table column properties4m 7s
-
(Locked)
Primary key fields3m 46s
-
(Locked)
Establish a default value4m
-
(Locked)
Check constraints4m 7s
-
(Locked)
Unique constraints5m 39s
-
(Locked)
Foreign keys3m 59s
-
(Locked)
Create a foreign key column3m 30s
-
(Locked)
Create relationships between tables4m 19s
-
(Locked)
-
-
-
-
-
-
-