SQL DELETE

It delete rows in a table.

SQL DELETE Syntax

DELETE FROM table_name WHERE some_column=some_value

MySQL Table – users

+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | JS   |
|  3 | HTML |
|  4 | PHP  |
|  5 | ASP  |
+—-+——+

Example

mysql> DELETE FROM users WHERE id = 4;
Query OK, 1 row affected (0.00 sec)

mysql> select * from users  ;
+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | JS   |
|  3 | HTML |
|  5 | ASP  |
+—-+——+
4 rows in set (0.00 sec)

Share