Recall & Review
beginner
What does a CROSS JOIN do in SQL?
A CROSS JOIN returns the Cartesian product of two tables, combining every row from the first table with every row from the second table.
Click to reveal answer
beginner
How many rows will the result have when you CROSS JOIN a table with 3 rows and another with 4 rows?
The result will have 3 × 4 = 12 rows, because each row from the first table pairs with every row from the second table.
Click to reveal answer
beginner
Write a simple SQL query using CROSS JOIN for tables 'A' and 'B'.
SELECT * FROM A CROSS JOIN B;
Click to reveal answer
intermediate
What is the difference between CROSS JOIN and INNER JOIN?
CROSS JOIN returns all combinations of rows from both tables without any condition. INNER JOIN returns only rows where there is a match based on a condition.
Click to reveal answer
intermediate
Can CROSS JOIN be used without the keyword CROSS? If yes, how?
Yes, you can write CROSS JOIN by listing tables separated by commas in the FROM clause, like: SELECT * FROM A, B; which behaves like a CROSS JOIN.
Click to reveal answer
What does a CROSS JOIN return?
✗ Incorrect
A CROSS JOIN returns the Cartesian product, meaning every row from the first table combined with every row from the second table.
If table X has 5 rows and table Y has 2 rows, how many rows will SELECT * FROM X CROSS JOIN Y return?
✗ Incorrect
The result will have 5 × 2 = 10 rows because CROSS JOIN pairs every row from X with every row from Y.
Which SQL keyword is used to perform a CROSS JOIN explicitly?
✗ Incorrect
The keyword CROSS JOIN explicitly performs a Cartesian product of two tables.
What is the result of SELECT * FROM A, B; in SQL?
✗ Incorrect
Listing tables separated by commas in FROM clause performs a CROSS JOIN (Cartesian product).
Which join type should you use if you want only matching rows between two tables?
✗ Incorrect
INNER JOIN returns only rows where there is a match based on a condition, unlike CROSS JOIN which returns all combinations.
Explain what a CROSS JOIN does and give a simple example query.
Think about pairing every row from one table with every row from another.
You got /3 concepts.
Describe the difference between CROSS JOIN and INNER JOIN in SQL.
Consider when you want all pairs versus only related pairs.
You got /3 concepts.