0
0
DBMS Theoryknowledge~10 mins

Cartesian product and joins in DBMS Theory - Interactive Code Practice

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

Complete the SQL query to select all columns from two tables using a Cartesian product.

DBMS Theory
SELECT * FROM employees [1] departments;
Drag options to blanks, or click blank then click option'
AJOIN
BLEFT JOIN
CINNER JOIN
DCROSS JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN without an ON condition causes an error.
Using LEFT JOIN or JOIN without specifying join conditions.
2fill in blank
medium

Complete the SQL query to join two tables on a matching column.

DBMS Theory
SELECT * FROM orders [1] customers ON orders.customer_id = customers.id;
Drag options to blanks, or click blank then click option'
AINNER JOIN
BCROSS JOIN
CFULL JOIN
DRIGHT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using CROSS JOIN when a matching condition is needed.
Using FULL JOIN without understanding it returns all rows from both tables.
3fill in blank
hard

Fix the error in the SQL join query by completing the missing keyword.

DBMS Theory
SELECT * FROM products [1] ON products.category_id = categories.id;
Drag options to blanks, or click blank then click option'
ACROSS JOIN
BINNER JOIN
CJOIN
DLEFT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using CROSS JOIN with an ON condition causes syntax errors.
Using JOIN without specifying INNER or LEFT can cause ambiguity.
4fill in blank
hard

Fill both blanks to create a query that selects employee names and department names using an INNER JOIN.

DBMS Theory
SELECT employees.name, departments.name FROM employees [1] departments [2] employees.department_id = departments.id;
Drag options to blanks, or click blank then click option'
AINNER JOIN
BON
CWHERE
DCROSS JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHERE instead of ON for join conditions.
Using CROSS JOIN when a condition is specified.
5fill in blank
hard

Fill all three blanks to write a query that selects all orders and their customers, including orders without customers, using a LEFT JOIN.

DBMS Theory
SELECT orders.id, customers.name FROM orders [1] customers [2] orders.customer_id = customers.id [3];
Drag options to blanks, or click blank then click option'
ALEFT JOIN
BON
CORDER BY orders.id
DWHERE customers.id IS NULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN excludes orders without customers.
Using WHERE to filter join results instead of ON.