DML & Transactions · Question 19 · Hard
DML & Transactions question 19
Table Coupon(code PRIMARY KEY) holds one row, DIWALI. In PostgreSQL, MySQL (InnoDB) and SQLite, the single statement INSERT INTO Coupon VALUES ('HOLI'), ('DIWALI'), ('EID') is run and fails on the duplicate DIWALI. How many rows does Coupon hold afterwards?
- 2
- 3
- 1
- 0
Answer and explanation
Answer: C. 1
Explanation: A single SQL statement is atomic: if any of its rows breaks a constraint, the whole statement is undone. HOLI is not kept and EID is never added, so the table still holds only the original DIWALI row.
Previous: Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |… · Next: Table Customer: id | name | total 1 | Omkar | 0 2 | Pallavi | 0 3 | Qasim | 0…
Practise dml & transactions
Try a fresh set of dml & transactions questions with an explanation after every answer, free and without signing up: DML & Transactions practice. Or sit a full placement mock test.
More dml & transactions questions
- Table Wallet: user_name | points Lalit | 100 Mona | NULL Nitin | 50 Every user…
- Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
- Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
- Table Customer: id | name | total 1 | Omkar | 0 2 | Pallavi | 0 3 | Qasim | 0…
More sql practice
SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge