Skip to main content

Posts

Showing posts with the label DROP and TRUNCATE in SQL Difference between DELETE

Difference between DELETE, DROP and TRUNCATE in SQL Vijay Sinha The Crazy Programmer

In this article, we look into the difference between DELETE, DROP and TRUNCATE commands in SQL. We will also see the general syntax related to each of the commands and the corresponding queries to implement these commands in SQL. DELETE The SQL DELETE command is used to delete existing records or rows from a table. The query can be used to delete one or multiple records from an existing table depending on the condition specified. The DELETE command is a Data Manipulation Language (DML) command. This command returns the number of records deleted after execution. With this command, we can also delete all the records of the table if we do not specify the condition in the WHERE clause. DELETE Command Syntax to REMOVE all Rows: DELETE FROM Table_Name; This query deletes all records from the given table name. DELETE Command Syntax with WHERE Clause: DELETE FROM Table_Name WHERE [Conditions]; Note: We do not need to list fields or column names of the table because the entire row or