

Deleting Specific Rows Based on Multiple Conditions More than one condition can be applied to the columns using a single query. We can also delete multiple rows using a single query.įrom the table displayed above, we need to delete all the employee records with salary less than 60000:Īs we can see, four rows have been deleted.The query above will result in the following: From the table above, we need to delete the record of the employee with the name “Arun”:Īs we can see, “Name” is of character string data type, so the value being specified has to be enclosed in single inverted commas, without which the system will return a syntax error.

To check the result of the query in the table above, we’ll use the ‘SELECT *’ command:Īs we can see, one record has been deleted based on the condition specified in the WHERE clause.From the table depicted above, to delete the employee’s record with “EmployeeID” equal to one, we’ll use the following query:.Let’s take a sample “Employee_details” table Deleting Specific Rows Based on a Single Condition Let’s apply the concepts stated above to the rows of a table. Multiple conditions can be specified in the WHERE clause with the help of AND and OR operators. NOTE: Extra caution needs to be taken with the WHERE clause as, without it, all the rows from the table will get deleted. There is an optional WHERE clause in which we can specify the condition according to which the rows should get deleted.The table from which we want to delete rows is specified in the table_name parameter of the DELETE FROM statement.The Syntax for Using the SQL Delete Command
