Sql Delete Rows Command

Sql Delete Rows Command


In this post Sql Delete Rows Command , we will have idea about deletion of data from sql tables. Sometimes we need to delete data from sql tables, there might be so many reasons for this deletion.
For sql delete rows, we have to use delete command of sql.

Sql Delete Rows Command 1

Sql Delete Rows Command


Delete Command


Delete Command is used to delete records from a database table, we can delete any number of records at a time in a single Delete Command. Delete Command of SQL uses Delete keyword.

The general syntax of Delete Command


Delete table name [where condition];

Example
Delete employee;

This will delete all the records from employee table.
We can delete particular rows or records  of a table.

Delete employee where ename=’Smith’;
This will delete record of Smith only.

We can use multiple conditions in Delete Command.
Suppose we want to delete records of all that employees whose city is Chandigarh and name is Smith.

The SQL delete statement will be like this:
Delete employee where ename=’Smith’ and ecity=’Chandigarh’;

This was all about sql delete rows command