Selecting Data from Multiple Tables Using T-SQL for Joins and Unions in SQL Server

  • John Deardurff

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

You're watching a preview of subscription content. Log in to check access

Extend your SELECT statements to retrieve data simultaneously from multiple tables in a SQL Server database. This video covers these joins and shows how they are fundamental to getting maximum value from any relational database engine. It is impossible to write professional-level queries without a solid grounding in joins. Selecting Data from Multiple Tables helps you to attain that level of expertise.

You will start with an introduction to relationships and joins with a look at the differences between a parent and child table. You’ll learn how to define rows in two tables to correspond to each other through a common value column, or through a set of such columns held in common in both tables. The examples show that such relationships can record and store a wide variety of master-detail data points such as, for example, the line items in a customer order.

Segments in the video examine the major different join types, including inner joins, left and right outer joins, and full outer joins. You’ll also work with self joins and cross joins. Finally, the video goes through various union operations that you can also use to combine rows from two or more tables, but in a manner different from a join. Union operations covered in this video include the basic union, and intersection and exception operations.

What You Will Learn

  • Identify parent key and foreign keys to establish table relationships.

  • Return parent rows even in the absence of corresponding child rows

  • Correctly choose between LEFT, RIGHT, and FULL outer joins

  • Query for rows that are held in common between two tables

  • Combine rows from multiple result sets using union operations

Who This Video Is For

Business analysts, developers, and others whose career will benefit from knowledge of the SQL language for accessing Microsoft SQL Server databases and the data they contain.

About The Author

John Deardurff

John Deardurff is a Microsoft Certified Trainer with close to 20 years’ experience teaching Microsoft SQL Server, Exchange Server, and Windows Server certification courses. He has been a database and networking consultant for a majority of that time, and currently holds over 48 Microsoft certifications. John is an MCT Regional Lead for the eastern United States, and formerly a Data Platform MVP …


About this video

John Deardurff
Online ISBN
Total duration
44 min
Copyright information
© John Deardurff 2019

Video Transcript

Welcome to the T-SQL querying video on selecting from multiple tables. My name is John Deardurff. I’ve been a Microsoft Certified Trainer for 20 years. And I was previously an MVP on SQL data platform. And I recently earned my MBA on IT management.

In this video series, we’re going to discuss how to select records from multiple tables. We will also look at how tables are related with each other and how this helps us define parent tables versus child tables. This is an important concept to understand when we start talking about joins, such as inner joins, left outer joins, right outer joins, and full outer joins.

Next, we’ll talk about self joins and cross joins. Finally, in this video series, we’ll talk about set operators that will combine record sets, such as the union and union all statements, and the intersect and except.

Now, some prerequisites for this course is a knowledge of writing T-SQL select statements or, if you have watched my previous video on T-SQL querying, writing a select statement. You will need to get a copy of SQL Server if you’ve not done so already. And I have created a specific database for this video. You will need a copy of the bookstore database to practice.

To get a copy of the bookstore database, look on the beginning page of this video series and click on the View Source Code at GitHub. When you click that, it will take you out to the GitHub site for Apress T-SQL Querying. And you will want to download a copy of the .zip file. When you download the .zip file, go ahead and click Save. And that will save it to your Downloads folder.

Once you have downloaded that, then you will need to go into your SQL Server Management Studio, click on File, Open, and File, and navigate to your Downloads folder, select T-SQL Querying Master, and then again select T-SQL Querying Master. And that will have your bookstore file. Double click on the bookstore file and this will open up the bookstore.sql file within your SQL Server Management Studio. Go ahead and click Execute. And that will set up the tables that we’re going to use for this video series.

So we hope you enjoy this T-SQL querying video on selecting from multiple tables.