Change values for rows that match a filter.
Section: insert, update, and delete
Update matching rows
sql
sql
UPDATE users SET is_active = 0 WHERE email LIKE '%@old-domain.com';Explanation
Always include a restrictive `WHERE` clause unless you intentionally want to update every row.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing insert, update, and delete
Truncate a table
Remove all rows quickly and reset auto-increment counters.
Upsert with ON DUPLICATE KEY UPDATE
Insert a row or update it when a unique key already exists.
Replace a row using REPLACE
Insert or delete-and-insert based on unique key conflicts.