SAP HANA - Difference Between TRUNCATE, DeLETE and DROP Commands
SAP HANA - Difference Between TRUNCATE, DeLETE and DROP Commands
NOTE:
The WHERE clause in the SQL DELETE command is optional and it identifies the rows in the
column that gets deleted. If you do not include the WHERE clause all the rows in the table are
deleted, so be careful while writing a DELETE query without WHERE clause.
After performing a DELETE operation, you need to COMMIT or ROLLBACK the transaction to
make the change permanent or to undo it. Note that this operation will cause all DELETE triggers on
the table to fire.
Example:
To Create a Table:
"ID" integer,
"Name" nvarchar(35)
);
· Does not require a WHERE clause, so you cannot filter rows while Truncating
Example:
To Truncate a Table:
DELETE TRUNCATE
· If you drop a table, all the rows in the table is deleted and the table structure is removed
from the database.
· Once a table is dropped we cannot get it back, so be careful while using DROP
command.
· When a table is dropped all the references to the table will not be valid.
· All the tables' rows, indexes, and privileges will also be removed.
· Cannot drop a table that is referenced by any Foreign Key constraint.
Example:
To Drop a Table:
DROP TRUNCATE
If a table is Dropped, Data and the table But, if a table is truncated, the table structure
structure will not exist. remains the same and Data will not exist