Home » SQL

SQL - DELETE Statement (to delete records/table)

SQL - DELETE command: Learn about the DELETE command, its syntax examples etc with queries.
Submitted by Shubham Singh Rajawat, on September 17, 2017

DELETE statement is use to delete a record from the table or delete the whole table.

DELETE is a Data Manipulation Language (DML) command which means it only works on the data not on the structure i.e. if the data of the whole table is delete even then the table exists means its structure does not get deleted.

Syntax:

DELETE FROM table_name WHERE condition;

Here,
table_name: name of the table.
condition: condition according to which a particular record is selected.

SQL - Delete command

Queries

1. Delete all the records from the table

DELETE FROM Student;

Above statement will delete all the data/records/student from the table Student.

2. Delete multiple records from the table

For example: If we want to delete all the students who live in the City Gwalior then the following statement will be used

DELETE FROM Student WHERE City='Gwalior';
SQL - Delete query





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.