Practice Questions — INSERT, UPDATE, DELETE - Manipulating Data
← Back to NotesTopic-Specific Questions
Question 1
Easy
Write an INSERT statement to add a student (id=6, name='Diya Kapoor', city='Chennai', marks=88) to the students table, specifying columns explicitly.
INSERT INTO table (cols) VALUES (vals).
INSERT INTO students (id, name, city, marks)
VALUES (6, 'Diya Kapoor', 'Chennai', 88);Question 2
Easy
Write a single multi-row INSERT that adds three new students: Diya (Chennai, 88), Arjun (Ahmedabad, 81), Sneha (Jaipur, 90). IDs 6, 7, 8.
VALUES (...), (...), (...);
INSERT INTO students (id, name, city, marks) VALUES
(6, 'Diya Kapoor', 'Chennai', 88),
(7, 'Arjun Mehta', 'Ahmedabad', 81),
(8, 'Sneha Patel', 'Jaipur', 90);Question 3
Easy
Write an UPDATE to change Rohan Verma's marks (id=3) to 85.
UPDATE ... SET ... WHERE ...
UPDATE students
SET marks = 85
WHERE id = 3;Question 4
Easy
Write an UPDATE to change Vikram Singh's marks to 90 AND his city to 'Mumbai' in one statement (id=5).
SET col1 = ..., col2 = ...
UPDATE students
SET marks = 90, city = 'Mumbai'
WHERE id = 5;Question 5
Easy
Write a DELETE to remove the student with id=5 from students.
DELETE FROM ... WHERE ...
DELETE FROM students WHERE id = 5;Question 6
Easy
What happens if you run
UPDATE students SET marks = 0; (no WHERE)?Every row is affected.
Every row in the students table gets marks = 0. There is no error message from MySQL. If the table had 10 million rows, all 10 million now have marks = 0.
Question 7
Easy
What happens if you run
DELETE FROM students; (no WHERE)?Every row deleted, table structure stays.
Every row is removed. The table still exists (with its columns and constraints), but it is empty. AUTO_INCREMENT is NOT reset (unlike TRUNCATE).
Question 8
Medium
Write SQL to give every student from Mumbai a 5-mark bonus.
SET marks = marks + 5.
UPDATE students
SET marks = marks + 5
WHERE city = 'Mumbai';Question 9
Medium
Write SQL to delete all students whose marks are strictly less than 70.
DELETE FROM ... WHERE marks < 70.
DELETE FROM students WHERE marks < 70;Question 10
Medium
Write SQL to INSERT all high-scoring students (marks > 90) from
students into a new top_students table. Assume top_students already exists with the same structure.INSERT INTO ... SELECT ...
INSERT INTO top_students (id, name, city, marks)
SELECT id, name, city, marks
FROM students
WHERE marks > 90;Question 11
Medium
What is SQL_SAFE_UPDATES and how do you enable it?
It's a server variable.
SQL_SAFE_UPDATES is a MySQL session variable. When set to 1, MySQL refuses to execute UPDATE or DELETE statements that don't include a WHERE clause referencing a KEY column. Enable it with:
SET SQL_SAFE_UPDATES = 1;Question 12
Medium
Write an INSERT IGNORE to try to add a student with id=1 (which already exists). What happens?
INSERT IGNORE instead of INSERT.
INSERT IGNORE INTO students (id, name, city, marks)
VALUES (1, 'Someone Else', 'Kolkata', 77);Result: No error; a warning is emitted. The existing row for id=1 is not changed.Question 13
Medium
Write an ON DUPLICATE KEY UPDATE that inserts a student (id=10, marks=85) if new, or updates marks to 85 if id=10 already exists.
INSERT ... ON DUPLICATE KEY UPDATE.
INSERT INTO students (id, name, city, marks)
VALUES (10, 'New Student', 'Noida', 85)
ON DUPLICATE KEY UPDATE marks = VALUES(marks);Question 14
Medium
Explain the difference between INSERT IGNORE and ON DUPLICATE KEY UPDATE.
One skips, the other updates.
INSERT IGNORE: if the row would violate a unique key, skip the insert silently. The existing row is unchanged. ON DUPLICATE KEY UPDATE: if the row would violate a unique key, update specific columns of the existing row instead.
Question 15
Medium
What is the main risk of using REPLACE INTO?
Columns you don't mention.
REPLACE internally DELETEs the existing row and INSERTs a new one. Any columns you don't specify are reset to their DEFAULT (or NULL) — so REPLACE can silently wipe data you forgot to list. It also resets AUTO_INCREMENT-generated fields, fires DELETE triggers, and can cascade FK deletes.
Question 16
Hard
Write SQL to archive all inactive students (active = 0) into
students_archive, then DELETE them from students. Use a transaction for safety.START TRANSACTION; INSERT SELECT; DELETE; COMMIT;
START TRANSACTION;
INSERT INTO students_archive
SELECT * FROM students WHERE active = 0;
DELETE FROM students WHERE active = 0;
COMMIT;Question 17
Hard
The client calls with an emergency: you accidentally deleted rows with id between 5 and 10. Luckily you had a backup table. Write SQL to restore those rows from
students_backup into students, assuming there's no conflict.INSERT ... SELECT ... WHERE id BETWEEN 5 AND 10.
INSERT INTO students (id, name, city, marks, active)
SELECT id, name, city, marks, active
FROM students_backup
WHERE id BETWEEN 5 AND 10;Question 18
Hard
A developer ran
UPDATE students SET city = 'Mumbai' WHERE id = 2 OR 3; intending to set cities for id 2 AND 3 to Mumbai. Why did it update ALL rows and how do you fix it?OR 3 is not a condition on id.
id = 2 OR 3 is parsed as (id = 2) OR (3). The integer 3 is truthy in SQL, so the WHERE evaluates to TRUE for every row. Fix: UPDATE students SET city = 'Mumbai' WHERE id = 2 OR id = 3;
-- Or the cleaner:
UPDATE students SET city = 'Mumbai' WHERE id IN (2, 3);Question 19
Hard
Write a single UPDATE that doubles the marks of students in Mumbai and halves the marks of students in Pune.
CASE WHEN ... in the SET clause.
UPDATE students
SET marks = CASE
WHEN city = 'Mumbai' THEN marks * 2
WHEN city = 'Pune' THEN marks / 2
ELSE marks
END
WHERE city IN ('Mumbai', 'Pune');Question 20
Hard
You have a page_views table (student_id PK, view_count INT). Every time a student visits a page, you want to increment their count, or create a new row with count=1 if they've never visited. Write the best single SQL.
ON DUPLICATE KEY UPDATE with increment.
INSERT INTO page_views (student_id, view_count)
VALUES (?, 1)
ON DUPLICATE KEY UPDATE view_count = view_count + 1;(Replace ? with the actual student_id.)Mixed & Application Questions
Question 1
Easy
Given students with 5 rows, what does this return?
UPDATE students SET marks = 100 WHERE id = 2;
SELECT marks FROM students WHERE id = 2;One row affected.
100Question 2
Easy
Write SQL to insert a row where only id=10 and name='Test User' are given. Other columns should use their defaults.
Specify only the columns you want to provide.
INSERT INTO students (id, name)
VALUES (10, 'Test User');Question 3
Medium
Spot the bug:
UPDATE students SET marks = marks * 1.1 WHERE id > 0;The intent was to give a 10% bonus to everyone.id > 0 probably matches everyone anyway.
Not necessarily a bug — the WHERE
id > 0 likely matches every row in a typical AUTO_INCREMENT table, so the intent is achieved. But it's a code smell: if you want "every row", be explicit. Use WHERE 1=1 (clearly universal) or disable SQL_SAFE_UPDATES and drop the WHERE entirely.Question 4
Medium
Write SQL to delete every student whose name starts with the letter 'V'.
LIKE 'V%'.
DELETE FROM students WHERE name LIKE 'V%';Question 5
Medium
What happens?
-- students has 5 rows
START TRANSACTION;
DELETE FROM students;
SELECT COUNT(*) FROM students; -- line A
ROLLBACK;
SELECT COUNT(*) FROM students; -- line BDELETE is transactional.
Line A:
0 (all rows deleted in the transaction). Line B: 5 (ROLLBACK restores them).Question 6
Medium
What happens?
-- students has 5 rows
START TRANSACTION;
TRUNCATE TABLE students;
ROLLBACK;
SELECT COUNT(*) FROM students;TRUNCATE is DDL with implicit COMMIT.
0. TRUNCATE is DDL and implicitly commits. The ROLLBACK has nothing to undo.Question 7
Medium
Write SQL to UPDATE the students table so that anyone with marks >= 90 gets active = 1, and anyone with marks < 90 gets active = 0.
CASE WHEN in SET.
UPDATE students
SET active = CASE
WHEN marks >= 90 THEN 1
ELSE 0
END;Question 8
Hard
Why does this fail?
INSERT INTO students (id, name, city, marks)
VALUES (1, 'Aarav Sharma', 'Mumbai', 87);(students already has id=1)Primary key violation.
id is the PRIMARY KEY and already has value 1. Inserting another row with id=1 raises
ERROR 1062 (23000): Duplicate entry '1' for key 'students.PRIMARY'. Fix: use a different id, or use INSERT IGNORE, or ON DUPLICATE KEY UPDATE.Question 9
Hard
You're building a likes counter for a post. Table: post_likes (post_id INT PK, likes INT NOT NULL DEFAULT 0). Write the SQL that runs when a user clicks Like — increment the count, or create a row with likes=1 if the post has no likes yet.
ON DUPLICATE KEY UPDATE.
INSERT INTO post_likes (post_id, likes)
VALUES (?, 1)
ON DUPLICATE KEY UPDATE likes = likes + 1;Question 10
Hard
You need to remove 500M rows from a 1B-row table without locking it for hours. What approach would you take?
Chunk the DELETE.
Chunk the DELETE: run
DELETE FROM t WHERE ... LIMIT 10000; in a loop until no more rows match. Between chunks, sleep a few milliseconds to let replication catch up and avoid long locks. Many teams use a stored procedure or a cron job for this.Question 11
Hard
Write SQL to copy the entire students table into students_copy, then modify students_copy so that every marks value is increased by 10, in a single script.
CREATE TABLE LIKE + INSERT SELECT + UPDATE.
-- 1. Clone schema
DROP TABLE IF EXISTS students_copy;
CREATE TABLE students_copy LIKE students;
-- 2. Copy data
INSERT INTO students_copy SELECT * FROM students;
-- 3. Bump marks by 10
UPDATE students_copy SET marks = marks + 10;
SELECT * FROM students_copy;Question 12
Hard
Before running a DELETE on a big table, what's the best way to preview which rows will be affected?
SELECT with the same WHERE.
Run a
SELECT * FROM t WHERE ... with the EXACT same WHERE clause you plan to use in DELETE. Review the result. Then replace SELECT with DELETE. Optionally wrap in START TRANSACTION so ROLLBACK remains an option.Multiple Choice Questions
MCQ 1
Which SQL command adds a new row to a table?
Answer: A
A is correct. INSERT INTO table VALUES (...) adds new rows. The other options are not valid SQL.
A is correct. INSERT INTO table VALUES (...) adds new rows. The other options are not valid SQL.
MCQ 2
Which command modifies existing rows?
Answer: C
C is correct. UPDATE is the DML command to change existing rows. MODIFY is part of ALTER TABLE (for changing column definitions, not data).
C is correct. UPDATE is the DML command to change existing rows. MODIFY is part of ALTER TABLE (for changing column definitions, not data).
MCQ 3
What is the risk of running
UPDATE students SET marks = 0; without WHERE?Answer: C
C is correct. Without WHERE, UPDATE applies to every row. On a production table this is catastrophic. Always preview with SELECT first.
C is correct. Without WHERE, UPDATE applies to every row. On a production table this is catastrophic. Always preview with SELECT first.
MCQ 4
Which is the correct multi-row INSERT?
Answer: B
B is correct. Multiple value tuples separated by commas in one VALUES clause. One semicolon at the end.
B is correct. Multiple value tuples separated by commas in one VALUES clause. One semicolon at the end.
MCQ 5
Which deletes only rows with marks below 50?
Answer: B
B is correct. DELETE FROM table WHERE condition; is standard syntax. The others have wrong syntax or use non-existent keywords.
B is correct. DELETE FROM table WHERE condition; is standard syntax. The others have wrong syntax or use non-existent keywords.
MCQ 6
INSERT IGNORE does what when a PRIMARY KEY conflict would occur?
Answer: C
C is correct. INSERT IGNORE skips conflicting rows silently. A warning is emitted but no error. Other integrity violations (NOT NULL, foreign key) may also become warnings, which is why IGNORE should be used carefully.
C is correct. INSERT IGNORE skips conflicting rows silently. A warning is emitted but no error. Other integrity violations (NOT NULL, foreign key) may also become warnings, which is why IGNORE should be used carefully.
MCQ 7
Given students with 5 rows, after
DELETE FROM students WHERE city = 'Mumbai'; (1 Mumbai row), how many rows remain?Answer: B
B is correct. One row (Aarav from Mumbai) is deleted. 5 - 1 = 4 rows remain.
B is correct. One row (Aarav from Mumbai) is deleted. 5 - 1 = 4 rows remain.
MCQ 8
Which statement about ON DUPLICATE KEY UPDATE is TRUE?
Answer: B
B is correct. ON DUPLICATE KEY UPDATE atomically inserts a new row or updates specified columns of the existing row. It does NOT delete the existing row (that's REPLACE). It is not the same as REPLACE.
B is correct. ON DUPLICATE KEY UPDATE atomically inserts a new row or updates specified columns of the existing row. It does NOT delete the existing row (that's REPLACE). It is not the same as REPLACE.
MCQ 9
Which UPDATE syntax changes two columns at once?
Answer: B
B is correct. Comma-separated assignments in SET. Option A works but is two statements. Option C is PostgreSQL-specific. Option D is invalid.
B is correct. Comma-separated assignments in SET. Option A works but is two statements. Option C is PostgreSQL-specific. Option D is invalid.
MCQ 10
After
DELETE FROM students; on a 10-row table, what does SELECT COUNT(*) return?Answer: B
B is correct. All 10 rows are deleted. The table still exists (unlike DROP), so COUNT(*) returns 0 — an empty set.
B is correct. All 10 rows are deleted. The table still exists (unlike DROP), so COUNT(*) returns 0 — an empty set.
MCQ 11
Which is the recommended way to insert new rows into a table, copying data from another table?
Answer: B
B is correct. INSERT INTO new_t SELECT ... FROM old_t; is the standard way. COPY and DUPLICATE are not MySQL commands (COPY exists in PostgreSQL for bulk load from files).
B is correct. INSERT INTO new_t SELECT ... FROM old_t; is the standard way. COPY and DUPLICATE are not MySQL commands (COPY exists in PostgreSQL for bulk load from files).
MCQ 12
What does MySQL return when you run
UPDATE students SET marks = 100 WHERE id = 999; but no row has id=999?Answer: B
B is correct. UPDATE silently affects 0 rows when the WHERE matches nothing. No error. If you expected to update a row, check the output — "0 rows affected" means nothing happened.
B is correct. UPDATE silently affects 0 rows when the WHERE matches nothing. No error. If you expected to update a row, check the output — "0 rows affected" means nothing happened.
MCQ 13
Which is TRUE about REPLACE INTO?
Answer: B
B is correct. REPLACE does DELETE-then-INSERT internally on key conflict. Columns you don't specify are reset to DEFAULT/NULL. Prefer ON DUPLICATE KEY UPDATE for safer, more targeted updates.
B is correct. REPLACE does DELETE-then-INSERT internally on key conflict. Columns you don't specify are reset to DEFAULT/NULL. Prefer ON DUPLICATE KEY UPDATE for safer, more targeted updates.
MCQ 14
Which is an atomic "insert or increment counter" query?
Answer: B
B is correct. Atomic single-statement upsert/increment. Option A has a race condition (two users can both see no row and both INSERT). Option C fails if the row doesn't exist. Option D sets count to 1 every time — not an increment.
B is correct. Atomic single-statement upsert/increment. Option A has a race condition (two users can both see no row and both INSERT). Option C fails if the row doesn't exist. Option D sets count to 1 every time — not an increment.
MCQ 15
Why should you prefer explicit column lists in INSERT statements?
Answer: A
A is correct. Explicit column lists are stable against schema changes. If someone adds a new column in the middle,
A is correct. Explicit column lists are stable against schema changes. If someone adds a new column in the middle,
INSERT INTO t VALUES (...) (Form 1) breaks. INSERT INTO t (col1, col2) VALUES (...) (Form 2) continues to work.MCQ 16
Inside a transaction, you run DELETE FROM students; then ROLLBACK; then SELECT COUNT(*). What do you see?
Answer: B
B is correct. DELETE is transactional. ROLLBACK undoes it. The original rows are visible again. This is why wrapping destructive statements in a transaction is a safety net.
B is correct. DELETE is transactional. ROLLBACK undoes it. The original rows are visible again. This is why wrapping destructive statements in a transaction is a safety net.
MCQ 17
If a table has 1M rows and you need to delete 500K based on some condition, what is the safest production approach?
Answer: B
B is correct. Chunked DELETE avoids long table locks and huge transaction logs. Option A can lock the table for minutes. Options C and D remove too much (all rows or the whole table). Percona's pt-archiver tool automates chunked deletion.
B is correct. Chunked DELETE avoids long table locks and huge transaction logs. Option A can lock the table for minutes. Options C and D remove too much (all rows or the whole table). Percona's pt-archiver tool automates chunked deletion.
MCQ 18
Which of the following DOES NOT modify data?
Answer: D
D is correct. SELECT is a read-only query that does not modify data. INSERT, UPDATE, and DELETE all modify rows.
D is correct. SELECT is a read-only query that does not modify data. INSERT, UPDATE, and DELETE all modify rows.
MCQ 19
You need to bulk-insert 1 million rows. Which is fastest in MySQL?
Answer: B
B is correct. Multi-row INSERT dramatically reduces network round-trips and per-statement parsing overhead. 1000 rows per INSERT is a sweet spot; beyond that, packet size limits and memory kick in. Even faster:
B is correct. Multi-row INSERT dramatically reduces network round-trips and per-statement parsing overhead. 1000 rows per INSERT is a sweet spot; beyond that, packet size limits and memory kick in. Even faster:
LOAD DATA INFILE for loading from a file.MCQ 20
Which is the most PROFESSIONAL way to handle a destructive UPDATE in production?
Answer: B
B is correct. Preview + transaction + verify is the professional pattern. On critical systems, add backup, code review, and off-peak scheduling. This single habit prevents almost all UPDATE/DELETE disasters.
B is correct. Preview + transaction + verify is the professional pattern. On critical systems, add backup, code review, and off-peak scheduling. This single habit prevents almost all UPDATE/DELETE disasters.
Coding Challenges
Challenge 1: Seed and Preview
EasyCreate a students table with id (PK), name, city, marks. Multi-insert 5 students (Aarav Mumbai 87, Priya Bengaluru 92, Rohan Delhi 78, Ananya Hyderabad 95, Vikram Pune 65). Preview them with SELECT.
Sample Input
(No input)
Sample Output
Table with 5 rows returned by SELECT *.
Use a single multi-row INSERT.
DROP TABLE IF EXISTS students;
CREATE TABLE students (
id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL,
city VARCHAR(30),
marks INT
);
INSERT INTO students (id, name, city, marks) VALUES
(1, 'Aarav Sharma', 'Mumbai', 87),
(2, 'Priya Iyer', 'Bengaluru', 92),
(3, 'Rohan Verma', 'Delhi', 78),
(4, 'Ananya Reddy', 'Hyderabad', 95),
(5, 'Vikram Singh', 'Pune', 65);
SELECT * FROM students;Challenge 2: Precision UPDATE
EasyFrom the students table, update Vikram Singh's marks to 80 AND his city to 'Mumbai' in a single statement.
Sample Input
(No input)
Sample Output
id=5 has marks=80 and city='Mumbai'.
Use a single UPDATE. Include WHERE.
UPDATE students
SET marks = 80, city = 'Mumbai'
WHERE id = 5;
-- Verify
SELECT * FROM students WHERE id = 5;
-- Expected:
-- | 5 | Vikram Singh | Mumbai | 80 |Challenge 3: Group Bonus
MediumGive every student in Mumbai or Bengaluru a 5-mark bonus. Then list everyone's id, name, city, and updated marks.
Sample Input
(No input)
Sample Output
Mumbai and Bengaluru students have marks +5; others unchanged.
Use a single UPDATE with IN (...).
UPDATE students
SET marks = marks + 5
WHERE city IN ('Mumbai', 'Bengaluru');
SELECT id, name, city, marks FROM students ORDER BY id;
-- Aarav: 92 (was 87), Priya: 97 (was 92), others unchanged.Challenge 4: Upsert Counter
MediumBuild a click_counts table (page VARCHAR(100) PK, clicks INT). Write 5 INSERT ... ON DUPLICATE KEY UPDATE statements simulating clicks on '/home' (3 times) and '/about' (2 times). End with a SELECT showing the final counts.
Sample Input
(No input)
Sample Output
'/home' clicks = 3, '/about' clicks = 2.
Use ON DUPLICATE KEY UPDATE.
DROP TABLE IF EXISTS click_counts;
CREATE TABLE click_counts (
page VARCHAR(100) PRIMARY KEY,
clicks INT NOT NULL DEFAULT 0
);
-- 3 clicks on /home
INSERT INTO click_counts (page, clicks) VALUES ('/home', 1)
ON DUPLICATE KEY UPDATE clicks = clicks + 1;
INSERT INTO click_counts (page, clicks) VALUES ('/home', 1)
ON DUPLICATE KEY UPDATE clicks = clicks + 1;
INSERT INTO click_counts (page, clicks) VALUES ('/home', 1)
ON DUPLICATE KEY UPDATE clicks = clicks + 1;
-- 2 clicks on /about
INSERT INTO click_counts (page, clicks) VALUES ('/about', 1)
ON DUPLICATE KEY UPDATE clicks = clicks + 1;
INSERT INTO click_counts (page, clicks) VALUES ('/about', 1)
ON DUPLICATE KEY UPDATE clicks = clicks + 1;
SELECT * FROM click_counts;
-- Expected:
-- +--------+--------+
-- | page | clicks |
-- +--------+--------+
-- | /home | 3 |
-- | /about | 2 |
-- +--------+--------+Challenge 5: Archival Pattern
HardCreate an employees table with id, name, salary, active. Seed 5 employees (2 inactive). Archive all inactive employees into an employees_archive table, then DELETE them from employees. Use a transaction so both steps succeed together or not at all.
Sample Input
(No input)
Sample Output
3 rows remain in employees; 2 rows in employees_archive.
Wrap the INSERT-DELETE in a transaction.
-- Setup
DROP TABLE IF EXISTS employees;
DROP TABLE IF EXISTS employees_archive;
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL,
salary DECIMAL(10,2) NOT NULL,
active TINYINT DEFAULT 1
);
CREATE TABLE employees_archive LIKE employees;
INSERT INTO employees VALUES
(101, 'Kavya Nair', 60000, 1),
(102, 'Arjun Mehta', 85000, 1),
(103, 'Sneha Patel', 72000, 0), -- inactive
(104, 'Rahul Joshi', 95000, 1),
(105, 'Meera Gupta', 65000, 0); -- inactive
-- Atomic archive
START TRANSACTION;
INSERT INTO employees_archive
SELECT * FROM employees WHERE active = 0;
DELETE FROM employees WHERE active = 0;
COMMIT;
-- Verify
SELECT COUNT(*) AS live FROM employees; -- 3
SELECT COUNT(*) AS archived FROM employees_archive; -- 2
SELECT * FROM employees_archive;Challenge 6: Professional Destructive Update
HardA client asks: "Move all students from 'Delhi' to 'New Delhi' and increase their marks by 10." Show the FULL professional workflow: preview, transaction, apply, verify, commit or rollback. Use appropriate SELECTs before and after.
Sample Input
(No input)
Sample Output
Preview shows affected rows. UPDATE runs. Post-check verifies. COMMIT finalizes.
Use START TRANSACTION / COMMIT. Include comments explaining each step.
-- STEP 1: Preview — what rows will be affected?
SELECT id, name, city, marks
FROM students
WHERE city = 'Delhi';
-- (confirm the list looks right before proceeding)
-- STEP 2: Begin transaction so we can ROLLBACK if something looks wrong.
START TRANSACTION;
-- STEP 3: Apply the change
UPDATE students
SET city = 'New Delhi',
marks = marks + 10
WHERE city = 'Delhi';
-- STEP 4: Post-check — do the updated rows look right?
SELECT id, name, city, marks
FROM students
WHERE city = 'New Delhi';
-- If the rows look correct, proceed. If not, ROLLBACK.
-- STEP 5: Commit or rollback based on verification
COMMIT;
-- OR:
-- ROLLBACK;
-- This workflow — preview, transaction, apply, verify, commit — is how
-- senior engineers handle production updates. Never skip the preview.
-- Never skip the verify. If ANYTHING looks wrong, ROLLBACK.Need to Review the Concepts?
Go back to the detailed notes for this chapter.
Read Chapter NotesWant to master SQL and databases with a mentor?
Explore our MySQL Masterclass