DML & Transactions · Question 11 · Medium
DML & Transactions question 11
Table Account:
acc_no | holder | balance
101 | Farah | 5000
102 | Gopal | 12000
103 | Hema | 800
104 | Imran | 7000
Table Blocked:
acc_no
102
104
Which holders are left in Account after the DELETE?
DELETE FROM Account
WHERE acc_no IN (SELECT acc_no FROM Blocked);
SELECT holder FROM Account ORDER BY acc_no;
- Gopal; Imran
- Farah; Gopal; Hema; Imran
- No rows
- Farah; Hema
Answer and explanation
Answer: D. Farah; Hema
Explanation: The subquery returns the account numbers 102 and 104. The DELETE removes the Account rows with those numbers (Gopal and Imran), leaving Farah and Hema. The Blocked table itself is not changed.
Previous: Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |… · Next: Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
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 Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
- Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
- Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
- Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
- A session is in autocommit mode (the default in MySQL, PostgreSQL and SQLite)…
- Table Cart: item | qty Rice | 1 Which items does the SELECT return after these…
- Table Account: acc_no | holder | balance 101 | Farah | 5000 102 | Gopal |…
- 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 |…
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