Challenge - 5 Problems
UPDATE Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output after this UPDATE?
Consider a table Employees with columns
What will be the
id, name, and salary. Initially, the table has:1, 'Alice', 5000
2, 'Bob', 6000
3, 'Charlie', 7000
What will be the
salary of Bob after running this query?UPDATE Employees SET salary = salary + 500 WHERE name = 'Bob';
Attempts:
2 left
💡 Hint
The WHERE clause limits which rows get updated.
✗ Incorrect
Only Bob's salary is increased by 500, so 6000 + 500 = 6500.
📝 Syntax
intermediate2:00remaining
Which UPDATE query is syntactically correct?
Choose the correct MySQL UPDATE statement that increases salary by 1000 for employees with salary less than 6000.
Attempts:
2 left
💡 Hint
Remember the syntax: UPDATE table SET column = value WHERE condition;
✗ Incorrect
Option A follows correct syntax with SET and WHERE clauses properly used.
❓ optimization
advanced2:00remaining
Which UPDATE query is more efficient for updating multiple rows?
You want to increase salary by 500 for all employees in department 'Sales'. The table has an index on the
Which query is more efficient?
department column.Which query is more efficient?
Attempts:
2 left
💡 Hint
Using indexed columns in WHERE clause improves performance.
✗ Incorrect
Option B uses the indexed column with an exact match, making it efficient.
🔧 Debug
advanced2:00remaining
What error does this UPDATE query raise?
Given a table
Products with columns id, name, and price, what error occurs when running:UPDATE Products SET price = price + 10 WHERE;
Attempts:
2 left
💡 Hint
Check the WHERE clause syntax.
✗ Incorrect
The WHERE clause is incomplete and causes a syntax error.
🧠 Conceptual
expert2:00remaining
What happens if UPDATE has no WHERE clause?
If you run:
What is the effect on the table?
UPDATE Employees SET salary = salary + 1000;
What is the effect on the table?
Attempts:
2 left
💡 Hint
Think about what happens when WHERE is omitted.
✗ Incorrect
Without WHERE, UPDATE affects every row in the table.