MariaDB DELETE Data

The MariaDB DELETE statement is used to delete one or more records from the table in MariaDB database.

Syntax:


DELETE FROM table
[WHERE conditions]
[ORDER BY expression [ ASC | DESC ]]
[LIMIT number_rows]; 

# DELETE data using one condition

Let's delete data using one condition.

Example:


DELETE FROM Students
WHERE student_name = 'Mahesh'; 
Mariadb Delete data 1

Query is executed successfully. You can now see that selected data is deleted.


SELECT * FROM Students;

Output:

Mariadb Delete data 2

You can see that "Mahesh" is not available in table.


# DELETE data using multiple condition


DELETE FROM Students
WHERE student_name = 'Aryan'
AND student_id >= 1; 
Mariadb Delete data 3

Query is executed successfully. You can now see that selected data is deleted.


SELECT * FROM Students;

Output:

Mariadb Delete data 4

You can see that "Aryan" is not available in table.