0
0
MySQLquery~5 mins

CROSS JOIN in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AAll possible combinations of rows from both tables
BOnly matching rows based on a condition
CRows from the first table only
DRows from the second table only
If table X has 5 rows and table Y has 2 rows, how many rows will SELECT * FROM X CROSS JOIN Y return?
A2
B10
C7
D5
Which SQL keyword is used to perform a CROSS JOIN explicitly?
ACROSS JOIN
BLEFT JOIN
CINNER JOIN
DOUTER JOIN
What is the result of SELECT * FROM A, B; in SQL?
AAn INNER JOIN
BA LEFT JOIN
CA CROSS JOIN
DAn error
Which join type should you use if you want only matching rows between two tables?
ACARTESIAN JOIN
BCROSS JOIN
CFULL JOIN
DINNER JOIN
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.