![]() |
VOOZH | about |
In MySQL, the DELETE query is used to remove rows from a table based on a specific condition defined in the WHERE clause. Without a WHERE clause, the entire table will be emptied.
DELETE FROM table_name WHERE condition;
Make sure you have created a database and an active MySQL server, if not then visit here to learn about it: Python MySQL CRETE Table
Hereโs a program to connect to a MySQL database, create a table, insert data, and delete a row based on a specific condition (e.g., deleting a student by their roll number).
Explanation:
We can also use a parameterized DELETE query to remove records from the STUDENT table.
Syntax:
DELETE FROM TABLE_NAME WHERE ATTRIBUTE_NAME = ATTRIBUTE_VALUE
Below is a program to delete a query from the table in the database.
Output:๐ python-mysql-delete
Explanation: