SQL DELETE Command : Introduction
- The SQL DELETE Command is a type of SQL SDML Command and is used to delete pre-existing records or values or rows of the tables present in the database.
- The advantage of using SQL DELETE Command is, only the values or records from table gets deleted and the overall structure(containing attributes) remains untouched. Let’s check the syntax first and then we will try to implement this command with an example.
SQL DELETE Command : Syntax
- The syntax for SQL DELETE Command is pretty simple. There are two possible basic syntax based on conditions. Below is their illustration.

SQL DELETE Command : Syntax
OR

SQL DELETE Command : Syntax
SQL DELETE Command : Example
- Consider the table of student_details that was created earlier.
Table : student_details
Example-1 : If we wish to delete the whole student_details table, it can be done by executing below query.
Query : DELETE FROM student_details;
|
Output : No rows to display.
Example-2 : If we wish to delete a particular row from the student_details, it can be done by executing below query.
Query : DELETE FROM student_details WHERE Name = ‘Rakesh’;
|
Output :
NOTE : As the structure of table remains untouched even after deletion of table data. If we need to insert values in the table again, it can be done without creating a new table and by directly inserting values to the table through INSERT command.
|