Computer Science, asked by khan17089, 10 months ago

Differentiate between drop and truncate.

Answers

Answered by manjitdas221
6
\huge\mathfrak\red{hey\:mate}
DROP & TRUNCATE statement both are DDL, or Data Definition Languages. - DROP statement is used to delete or remove a table from a database. - TRUNCATE statement is used to delete/remove all records form a table, the table still exists in the database.
Please mark as brainlist.

manjitdas221: please mark as brainlist if you like my answer
manjitdas221: thnks
Answered by np4529508
1
The DROP command removes a table from the database.

All the tables' rows, indexes and privileges will also be removed.

No DML triggers will be fired.

The operation cannot be rolled back.

DROP and TRUNCATE are DDL commands, whereas DELETE is a DML command.

DELETE operations can be rolled back (undone), while DROP and TRUNCATE operationsTRUNCATE is a DDL command

TRUNCATE is executed using a table lock and whole table is locked for remove all records.

We cannot use Where clause with TRUNCATE.

TRUNCATE removes all rows from a table.

Minimal logging in transaction log, so it is performance wise faster.

TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log.

Identify column is reset to its seed value if table contains any identity column.

To use Truncate on a table you need at least ALTER permission on the table.

Truncate uses the less transaction space than Delete statement.

Truncate cannot be used with indexed views



Similar questions