advertise here

Drop Delete Truncate Differences Mysql

Difference between drop delete and truncate. learn where to use drop delete and truncate in mysql,sql server,oracle and more databases


drop delete truncate mysql sql server oracle and more databases with differences

Drop

Syntax for table - Drop table students;
Syntax for database - Drop database student_details;


  • Drop this is a DDl(data definition language) command
  • Drop will remove entire table including structures and datatype you declared before
  • you can not rollback after execute Drop command
  • you can not use where clause to execute Drop command
  • you can use this command to Drop both database and tables

  • Delete

    Syntax - Delete from students;
    Syntax with where clause - Delete from students where id = 1;


  • Delete this is a DML(data manipulation language) command
  • Delete will remove specific rows from a table
  • if you not specified any rows or where clause to delete it will remove all rows from a table
  • you can use where clause to execute Delete command
  • you can rollback after execute Delete command

  • Truncate

    Syntax - Truncate table students;


  • Truncate this is a DDL command
  • Truncate will remove all rows from a table
  • you can not rollback after execute truncate command
  • you can not use where clause to execute truncate command
  • structures constraints and datatypes you declared before remain same after truncate a table
  • advertise here