0
0
SQLquery~10 mins

CROSS JOIN cartesian product in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all columns from both tables using a CROSS JOIN.

SQL
SELECT * FROM products [1] orders;
Drag options to blanks, or click blank then click option'
ACROSS JOIN
BINNER JOIN
CLEFT JOIN
DRIGHT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN instead of CROSS JOIN.
Forgetting that CROSS JOIN returns all combinations.
2fill in blank
medium

Complete the code to count the total number of rows produced by a CROSS JOIN between two tables.

SQL
SELECT COUNT(*) FROM customers [1] products;
Drag options to blanks, or click blank then click option'
ACROSS JOIN
BLEFT JOIN
CINNER JOIN
DFULL JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN which requires a condition.
Using LEFT JOIN which keeps all rows from the left table only.
3fill in blank
hard

Fix the error in the CROSS JOIN syntax to correctly produce the Cartesian product.

SQL
SELECT * FROM sales [1] JOIN products;
Drag options to blanks, or click blank then click option'
AINNER
BRIGHT
CLEFT
DCROSS
Attempts:
3 left
💡 Hint
Common Mistakes
Using only CROSS without JOIN.
Using INNER JOIN instead of CROSS JOIN.
4fill in blank
hard

Fill both blanks to write a query that selects product names and customer names from a CROSS JOIN.

SQL
SELECT products.name AS product_name, customers.name AS customer_name FROM products [1] [2] customers;
Drag options to blanks, or click blank then click option'
ACROSS JOIN
BINNER JOIN
CLEFT JOIN
DJOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN which requires a condition.
Using LEFT JOIN which filters rows differently.
5fill in blank
hard

Fill all three blanks to write a query that counts the Cartesian product rows and filters products with price greater than 100.

SQL
SELECT COUNT(*) FROM products [1] [2] orders WHERE products.price [3] 100;
Drag options to blanks, or click blank then click option'
ACROSS JOIN
B>
C<
DJOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN instead of CROSS JOIN.
Using < instead of > in the WHERE clause.