How to Delete Rows in Oracle SQL

How to Delete Rows in Oracle SQL

How to delete rows or records from a table in SQL


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 is as given below

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’;