From the course: Microsoft SQL Server 2022 Essential Training
Unlock this course with a free trial
Join today to access over 24,100 courses taught by industry experts.
Check constraints - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Check constraints
- [Instructor] When your data is expected to meet some criteria, you can ensure that what gets entered is valid with a check constraint. Check constraints are very 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've specified. I want to add a check constraint to the Red30 Tech customers table. So I'll right-click on it and open it up in the design window. To add a check constraint to your data table, click on the Manage Check Constraint button up here in the toolbar. Looks like a little grid, or you can right-click on any column, and in the popup menu, there's also an option to go to your check constraints. Check constraints are a table-level property. They're not really attached to any specific column, so it doesn't really matter…
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
-
-
-
-
-
-
Choose appropriate data types2m 46s
-
(Locked)
SQL Server data type options7m 19s
-
(Locked)
Automatically assign record identities4m 54s
-
(Locked)
Primary key fields4m 35s
-
(Locked)
Establish a default value5m 1s
-
(Locked)
Check constraints5m 10s
-
(Locked)
Unique constraints6m 23s
-
(Locked)
Foreign keys4m 16s
-
(Locked)
Create a foreign key column5m 16s
-
(Locked)
Create relationships between tables5m 6s
-
-
-
-
-
-
-