From the course: Microsoft SQL Server 2016 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create relationships between tables

Create relationships between tables - SQL Server Tutorial

From the course: Microsoft SQL Server 2016 Essential Training

Start my 1-month free trial

Create relationships between tables

- [Instructor] In this section, we're going to explore some of the relationships between tables. Microsoft SQL Server is a relational database management system, and therefore it supports relationships between tables, using primary keys and foreign keys. We're going to look around the World Wide Importers database. To explore this, I'll open that up. I'll open up the list of tables, and in the first table alphabetically, which is Application.Cities, we open that up, we see Keys underneath it, and if we open that up, we see three keys. The first one is a PK, meaning a primary key, and the next two are FK, meaning foreign key. So judging by the names, it looks like the Cities table is linked to the People table, probably telling us which city a person lives in. And the Cities table is also linked to the State table, telling us which state the city is in. Looking through these primary keys and foreign keys can be a bit tedious. Fortunately, SQL Server provides a tool to display this…

Contents