From the course: Learning Microsoft SQL Server 2019

Unlock the full course today

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

Join tables together with keys

Join tables together with keys - SQL Server Tutorial

From the course: Learning Microsoft SQL Server 2019

Start my 1-month free trial

Join tables together with keys

- [Instructor] Because we're using a primary key column in our data tables to uniquely identify individual records, we can use this information in other tables to make relationships between them. By formalizing the connections between your data tables, we can take advantage of the interconnected nature of the information that we're storing. Let's suppose that we want to create a new table to collect information about hotel reservations, and we want to make sure that we know the guest that's placing the reservation. We can use the same guest ID number that we previously attached to the person in the Reservations table so that we can have an easy way to refer back to the individual that made the reservation. So let's go through the process of creating a new reservations table. Once again, in the LandonHotel database, I'm going to right click on the Tables folder, point to New and click on Table. The first column will be the ID column for this table. It's going to be ReservationID. The…

Contents