From the course: Microsoft SQL Server 2022 Essential Training
Unlock this course with a free trial
Join today to access over 24,000 courses taught by industry experts.
Foreign keys - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Foreign keys
- [Instructor] The entire value of a relational database and what makes them so efficient for storing data comes from the fact that data tables relate to one another. This means that you can take a piece of information from a record in one table, take that information to another table, and find additional details that have a relationship to the original data. We can see how this works by digging into the Wide World Importer's example database. I'll go ahead and expand the tables for that database. Now, there are lots of tables here, and you can see that they're using that concept of a schema that I touched on briefly to help organize them. So we have the application schema and several tables in that schema. We then have the purchasing schema with its own set of tables, as well as a sales schema with some additional tables there. The table that I want to start with is the Sales.Customers table. Let's right-click on it and…
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
-
-
-
-
-
-
-