SQL & Relational Databases (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is the difference between `DELETE`, `TRUNCATE`, and `DROP`?
junior Levelsql-databasesBasic
In Simple Words:
DELETE(DML): Removes rows matching aWHEREcondition one by one. Logs each row deletion in transaction logs, fires triggers, and can be rolled back inside a transaction. Slower on large tables.TRUNCATE(DDL): Deallocates entire physical data pages to empty the table. Resets auto-increment counters, does not fire row triggers, and runs significantly faster.DROP(DDL): Completely deletes both the data and the table structure/schema definition from the database catalog.