In this article we will see "How to use DELETE in MySql" to DELETE data in a table and "DELETE query syntax with example".

DELETE query in MySql syntax

The DELETE statement is used to DELETE data in a table, syntax is as follows:


DELETE FROM tableName
WHERE condition;


DELETE query in MySql example

The DELETE statement is used to DELETE data in a table, as shown below:


/*Example EMPLOYEE table */
+----+--------+---------+
| id | name   | email   |
+----+--------+---------+
|  1 | name-1 | email-1 |
|  2 | name-2 | email-2 |
|  3 | name-3 | email-3 |
|  4 | name-4 | email-4 |
|  5 | name-1 | email-5 |
|  6 | name-2 | email-6 |
+----+--------+---------+



We will now apply DELETE on above table to DELETE a row based on id:


DELETE FROM EMPLOYEE WHERE ID = 4;

Output: Output will be something like this:


/* Table data after deletion*/
+----+--------+---------+
| id | name   | email   |
+----+--------+---------+
|  1 | name-1 | email-1 |
|  2 | name-2 | email-2 |
|  3 | name-3 | email-3 |
|  5 | name-1 | email-5 |
|  6 | name-2 | email-6 |
+----+--------+---------+


In this article we have seen "How to use DELETE in MySql" and "DELETE query syntax with example", in upcoming articles we will see more about Mysql syntax and queries with example.
  • By Techburps.com
  • Oct 20, 2017
  • MySql