From the course: Querying Microsoft SQL Server 2022
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Cross joins - SQL Server Tutorial
From the course: Querying Microsoft SQL Server 2022
Cross joins
- [Instructor] Most of the time you want to join data tables based on common values to find the information that relates together. But you can also join data tables that have no relationship to each other in something called a cross join. Cross joins are literally the cross product that you get from combining every record in one table with every record from the other. To see how this works, we'll take a look at two SELECT queries. One that pulls the Name column from the HumanResources.Department table and the other one that pulls the Name column from the Person.AddressType table. Let me highlight both of these and press Execute to see the results. At the top, we have these 16 names of our departments. Then below that we have the six names of our AddressTypes. A cross product would multiply the tables together. So you'd have Document Control and Archive, Document Control and Billing, Document Control and Home, and so on.…
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
-
-
-
-
-
Table joins and relationships3m 42s
-
(Locked)
Inner joins8m 8s
-
(Locked)
Left, right, and full outer joins4m 37s
-
(Locked)
Cross joins4m 39s
-
(Locked)
Challenge: Return data from multiple tables1m 6s
-
(Locked)
Solution: Return data from multiple tables6m 12s
-
(Locked)
Solution: Join data in multiple tables4m 4s
-
-
-
-
-
-
-
-