DML & Transactions · Question 15 · Medium

DML & Transactions question 15

Table Account:
acc_no | holder | balance
101 | Farah | 5000
102 | Gopal | 12000
103 | Hema | 800
104 | Imran | 7000

No account is held by Kiran. What does the SELECT return after the UPDATE?

UPDATE Account SET balance = 0
WHERE holder = 'Kiran';
SELECT COUNT(*) FROM Account WHERE balance = 0;
  1. 0
  2. 4
  3. 1
  4. Nothing: the UPDATE fails, because no row matches
Answer and explanation

Answer: A. 0

Explanation: An UPDATE whose WHERE matches no row is not an error; it simply changes 0 rows. No balance becomes 0, so the count is 0.

Previous: Table Cart: item | qty Rice | 1 Which items does the SELECT return after these… · Next: Table Wallet: user_name | points Lalit | 100 Mona | NULL Nitin | 50 Every user…

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

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