SQL DELETE statement is used to delete existing records in a table.

SYNTAX

Where,

  • DELETE                                             : keyword used delete records from a certain table based on the where condition

  • Table_name                                      : The name of the table from where you want to fetch the data.

  • Column1Name, Column2Name         : The name of the columns of the table which you want to fetch.

NOTE: We must always use the WHERE clause with the DELETE query to eliminate the required rows, otherwise all the rows would be deleted.

EXAMPLE

Let us consider a demo database with table name Persons.

     The above Query will delete a record from table Persons where the FirstName is ‘Erichsen’;

Figure 28.1. DELETE QUERY & OUTPUT;

 

Figure 28.1. Select * from Persons;

 

PRACTICE YOURSELF 

 

©2020 by Pavan Lalwani. 

  • Udemy
  • Facebook
  • Twitter
  • YouTube
  • Linkedin