What is MySQL DELETE command used for?



MySQL DELETE command is used to delete the row/s from a table. It is used with WHERE clause.

Syntax

DELETE From Table_name WHERE Condition;

Example

In the example below, we have deleted the rows from table ‘employee’ where id >=100.

mysql> select * from employee; +------+--------+ | Id   | name   | +------+--------+ | 100  | Ram    | | 200  | Gaurav | | 300  | MOHAN  | +------+--------+ 3 rows in set (0.00 sec) mysql> delete from employee where id >=100; Query OK, 3 rows affected (0.06 sec) mysql> select * from employee; Empty set (0.00 sec)
Updated on: 2020-06-20T06:01:49+05:30

276 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements