Recall & Review
beginner
What does the
UPDATE statement do in SQL?The
UPDATE statement changes existing data in a table. It modifies one or more rows based on given conditions.Click to reveal answer
beginner
Why is the
WHERE clause important in an UPDATE statement?The
WHERE clause limits which rows get updated. Without it, all rows in the table will be changed.Click to reveal answer
beginner
Write the syntax of an
UPDATE statement with a WHERE clause.UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
Click to reveal answer
intermediate
What happens if you run an
UPDATE statement without a WHERE clause?All rows in the table will be updated with the new values, which might cause unintended data changes.
Click to reveal answer
beginner
How can you update multiple columns in one
UPDATE statement?You list each column and its new value separated by commas after
SET. For example: SET col1 = val1, col2 = val2.Click to reveal answer
What does the
WHERE clause do in an UPDATE statement?✗ Incorrect
The
WHERE clause filters rows so only those matching the condition get updated.What happens if you omit the
WHERE clause in an UPDATE statement?✗ Incorrect
Without
WHERE, the update applies to every row in the table.Which of these is the correct syntax to update the 'price' column to 10 where 'id' equals 5?
✗ Incorrect
The correct syntax places
SET before the column assignments and WHERE after.How do you update multiple columns in one
UPDATE statement?✗ Incorrect
Multiple columns are separated by commas after the
SET keyword.Which keyword is mandatory to specify which rows to update?
✗ Incorrect
The
WHERE clause specifies the condition to select rows for updating.Explain how to safely update a specific row in a table using the
UPDATE statement with a WHERE clause.Think about how to avoid changing all rows accidentally.
You got /3 concepts.
Describe what could happen if you forget the
WHERE clause in an UPDATE statement.Consider the impact on the whole table.
You got /3 concepts.