Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to update the salary of employees by joining with the departments table.
MySQL
UPDATE employees e JOIN departments d ON e.department_id = d.id SET e.salary = e.salary * 1.1 WHERE d.name = [1];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to use quotes around string values.
Using double quotes instead of single quotes for strings.
✗ Incorrect
In SQL, string literals must be enclosed in single quotes. So 'Sales' is correct.
2fill in blank
mediumComplete the code to update the status of orders by joining with the customers table.
MySQL
UPDATE orders o JOIN customers c ON o.customer_id = c.id SET o.status = 'shipped' WHERE c.country = [1];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted strings for string values.
Using double quotes instead of single quotes.
✗ Incorrect
String literals in MySQL must be enclosed in single quotes, so 'USA' is correct.
3fill in blank
hardFix the error in the code to update product prices by joining with the categories table.
MySQL
UPDATE products p [1] categories c ON p.category_id = c.id SET p.price = p.price * 0.9 WHERE c.name = 'Electronics';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding extra keywords like 'ON' after JOIN.
Using INNER JOIN which is valid but not required here.
✗ Incorrect
In MySQL, the correct syntax is UPDATE ... JOIN ... ON ... without extra keywords. So 'JOIN' is correct.
4fill in blank
hardFill both blanks to update employee titles by joining with the roles table.
MySQL
UPDATE employees e [1] roles r [2] e.role_id = r.id SET e.title = CONCAT('Senior ', e.title) WHERE r.level = 'Manager';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHERE instead of ON for join condition.
Using USING keyword incorrectly here.
✗ Incorrect
The correct syntax is UPDATE ... JOIN ... ON ... to join tables. So 'JOIN' and 'ON' are correct.
5fill in blank
hardFill all three blanks to update the stock quantity by joining products and suppliers.
MySQL
UPDATE products p [1] suppliers s [2] p.supplier_id = s.id SET p.stock = p.stock + [3] WHERE s.region = 'North';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHERE instead of ON for join condition.
Forgetting to provide a numeric value for stock increment.
✗ Incorrect
The correct syntax uses JOIN and ON for the join, and 10 as the increment value for stock.