Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to join two tables on a single condition.
SQL
SELECT * FROM orders INNER JOIN customers ON orders.customer_id [1] customers.id; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '=' causes no matching rows.
Using '<' or '>' is incorrect for join conditions.
✗ Incorrect
The INNER JOIN requires the condition to match keys exactly, so '=' is used.
2fill in blank
mediumComplete the code to join on two conditions using AND.
SQL
SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.id [1] orders.status = 'shipped';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using OR would join rows that meet only one condition.
NOT and XOR are not valid for join conditions.
✗ Incorrect
Use AND to require both conditions to be true for the join.
3fill in blank
hardFix the error in the join condition by choosing the correct operator.
SQL
SELECT * FROM orders INNER JOIN customers ON orders.customer_id [1] customers.id AND orders.region = customers.region; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' or '<>' causes no matching rows.
LIKE is for pattern matching, not key equality.
✗ Incorrect
The join condition must use '=' to match customer IDs exactly.
4fill in blank
hardFill both blanks to join orders and customers on customer_id and region.
SQL
SELECT * FROM orders INNER JOIN customers ON orders.[1] = customers.id [2] orders.region = customers.region;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using OR instead of AND joins too many rows.
Using wrong column names causes errors.
✗ Incorrect
The join uses customer_id to match IDs and AND to combine conditions.
5fill in blank
hardFill all three blanks to join orders and customers on customer_id, region, and status.
SQL
SELECT * FROM orders INNER JOIN customers ON orders.[1] = customers.id [2] orders.region = customers.region [3] orders.status = customers.status;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using OR causes incorrect joins with partial matches.
Using wrong column names causes errors.
✗ Incorrect
All three conditions must be true, so use AND between them and customer_id as the key.