DROP TABLE Command

  • DROP TABLE command is used to delete entire table from the database
  • Once a table is dropped it can’t be recovered.

Syntax:

DROP TABLE <table name>;

Example:

DROP TABLE student;

TRUNCATE TABLE Command:

  • This command is similar to delete command.
  • The main different between DELETE and TRUNCATE TABLE command is that DELETE command deletes record row by row while TRUNCATE TABLE command deletes entire table and recreates table with the same structure.
  • It is faster than deleting all the records row by row.
  • If we apply truncate table command then records can be recover by using ROLL BACK
  • This command is faster compare to delete command.

Syntax:

TRUNCATE TABLE <table name>;

Example:

TRUNCATE TABLE student;