From the course: Querying 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.

Cross joins

Cross joins - SQL Server Tutorial

From the course: Querying Microsoft SQL Server 2019

Start my 1-month free trial

Cross joins

- [Narrator] Most of the time, you'll want to join data tables based off of 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 at one table with every record in the other. To see how this works, I'm going to write out two select queries. The first will select out the department name column from the Human Resources.department table. And the second, we'll grab the address type name from the person.addresstype table. I'll execute the query and that'll return two results windows down below. If you click into each one, you can see how many records are returned by each query. This first one is the department names, and if I click here, I can see that there are 16 rows in this result. And the second one down here at the…

Contents