Roadmap › SQL Server & T-SQL › Module: Database Design
Lessons in this course (19)

3. DDL vs DML; DELETE vs TRUNCATE vs DROP

BasicMediumLesson 3 of 19
DELETETRUNCATEDROP
TypeDMLDDLDDL
RemovesRows (with optional WHERE)All rowsThe whole table (structure + data)
LoggingEach row loggedPage deallocations logged (minimal)Metadata
TriggersFires DELETE triggersNoNo
IdentityNot resetReset to seedGone
RollbackYes (in a transaction)Yes, inside a transaction in SQL ServerYes, inside a transaction
FK-referenced tableAllowedNot allowedNot allowed
SpeedSlowerFastFast