Database / SQLite Interview questions
What is the difference between DELETE, TRUNCATE, and DROP in SQLite?
SQLite doesn't actually have a TRUNCATE statement at all — that's a notable difference
from many other SQL databases. The remaining two behave distinctly.
| DELETE FROM table | DROP TABLE |
| Removes rows (optionally filtered by WHERE); the table structure remains. | Removes the entire table, including its schema, indexes, and all data. |
| Can be selective, targeting specific rows. | All-or-nothing; the table ceases to exist afterward. |
| Logged row-by-row in the rollback journal/WAL. | A schema-level operation. |
DELETE FROM person; -- removes all rows, table still exists, empty DROP TABLE person; -- table itself is gone entirely
DELETE FROM table with no WHERE clause is the closest equivalent to what other
databases call TRUNCATE, though internally it's still implemented as a row-by-row delete rather
than the specialized fast-path some other engines use for true truncation.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
