Do you know what is the use of TRUNCATE statement? How is it different from DELETE statement?

Submitted by: Muhammad
TRUNCATE TABLE statement is used to delete a table permanently. It deletes all the records from the table.

Syntax:
TRUNCATE [TABLE] [database_name.]table_name;

Difference between DELETE and TRUNCATE statement:
☛ DELETE statement is used to remove one or more columns from a table as well as whole table. On the other hand, TRUNCATE TABLE statement is used to delete the whole table permanently.
☛ TRUNCATE TABLE statement is same as DELETE statement without a WHERE clause.
Submitted by: Muhammad

Read Online MariaDB Job Interview Questions And Answers