Recall & Review
beginner
What does the SQL
UPDATE statement do?The
UPDATE statement changes existing data in a table. It modifies one or more columns for rows that match a condition.Click to reveal answer
beginner
How do you update a single column in SQL?
Use
UPDATE table_name SET column_name = new_value WHERE condition; to change one column's value in rows that meet the condition.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 an example SQL query to update the
salary column to 5000 for employees with id 3.Example: <br>
UPDATE employees SET salary = 5000 WHERE id = 3;Click to reveal answer
intermediate
What happens if you run
UPDATE employees SET salary = 5000; without a WHERE clause?All rows in the
employees table will have their salary set to 5000, which might not be what you want.Click to reveal answer
Which SQL keyword is used to change data in a table?
✗ Incorrect
The
UPDATE keyword modifies existing data in a table.What does the
WHERE clause do in an UPDATE statement?✗ Incorrect
The
WHERE clause limits the rows affected by the update.How do you update only the
price column in a table named products?✗ Incorrect
You must use
SET to specify the column and WHERE to limit rows.What happens if you omit the
WHERE clause in an UPDATE?✗ Incorrect
Without
WHERE, all rows in the table are updated.Which of these is a valid SQL update statement for a single column?
✗ Incorrect
The correct syntax is
UPDATE table SET column = value WHERE condition;.Explain how to update a single column in a SQL table safely.
Think about how to change only certain rows without affecting the whole table.
You got /4 concepts.
What could happen if you forget the WHERE clause in an UPDATE statement?
Consider the impact on the entire table.
You got /4 concepts.