Monday, June 1, 2009

What is the difference between drop, delete & truncate in sql?

1 comment:

  1. Delete is a DML(Data Manipulation Language). Delete command is deletes the record from the existing table.The systax for Delete is

    1)sql> Delete from Table_Name.

    This Deletes All the Record From The TAble

    2) sql> Delete from Table_Name

    Where condition_Statment

    This deletes a perticular set of record.

    Note:Delete is not Autocommit Statment(Infact None os the DML are auto commit)

    Drop and Truncate both are DDL(Data Definition Language).

    Drop {Delete or drops} the table with it's structure. It is as autocommit statment.Drops Once fired can not be rolled back.

    syntax:

    sql>drop table Table_Name

    Trucate is the command used to delete all record from table. but the structure of the table remain same.It is also a autocommit statment.

    syntax;

    sql>truncate table Table_name

    ReplyDelete