Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Review the joins presented in the previous videos, and get some hands-on practice.
Cross Joins
You might be thinking, βWhat on earth is a Cross Join?β We didnβt cover Cross Joins because they are not very common, but they do serve a purpose. And being able to recognize a Cross Join can actually help you if youβre troubleshooting sometimes.
A Cross Join takes each row from the first table and matches it with every row in the second table. This can be useful if you ever need to select all possible combinations of rows from two tables. For instance, if I had two tables with 10 rows each and I cross joined them, I would get a 100 row result set back.
Where this knowledge really comes in handy is if you ever see data that is being duplicated many times over unexpectedly in a query result, you may have done something wrong in your Inner Join that caused the matching criteria to be ignored. Itβs a sign to go back and double check that you have the proper equality statement in the ON portion of the Inner Join section.
Resources:
Wikipedia: Cross Joins
W3Schools: Cross Joins
Cheat Sheet
See all of the SQL used in Querying Relational Databases in the Querying Relational Databases Cheat Sheet.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up