Database / SQLite Interview questions
How do you update a record in SQLite?
The UPDATE statement modifies existing rows matching a WHERE condition —
omitting the WHERE clause updates every row in the table, which is a common and dangerous mistake
if done accidentally.
UPDATE person SET age = 35, email = 'ada.new@example.com' WHERE id = 1;
It's good practice to first run the equivalent SELECT ... WHERE ... to confirm exactly which
rows would be affected before running the actual UPDATE, especially for a condition you're not
fully confident about — since an UPDATE without a safety net can silently modify far more
rows than intended.
More Related questions...