Deleting Element from Table in MySql using Python Last Updated : 03 Jan, 2021 Comments Improve Suggest changes Like Article Like Report Prerequisite: Python: MySQL Create Table In this article, we are going to see how to get the size of a table in MySQL using Python. Python allows the integration of a wide range of database servers with applications. A database interface is required to access a database from Python. MySQL Connector-Python module is an API in python for communicating with a MySQL database. Approach: Import module.Make a connection request with the database.Create an object for the database cursor.Execute the following MySQL query:DELETE FROM TABLE_NAME WHERE Column Name = 'Value'; Example 1: In this example we are using this database table with the following query; Below is the implementation: Python3 # Establish connection to MySQL database import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="root123", database = "geeks" ) mycursor = mydb.cursor() query = " DELETE FROM EMPLOYEE WHERE INCOME = '5000';" mycursor.execute(query) mydb.commit() print(mycursor.rowcount, "record(s) deleted") mydb.close() Output: 1 record(s) deleted After deleting the element our table looks like this: Example 2: In this example we are going to delete the same table with a different column name: Python3 # Establish connection to MySQL database import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="root123", database = "geeks" ) mycursor = mydb.cursor() query = " DELETE FROM EMPLOYEE WHERE LAST_NAME = 'Mohan';" mycursor.execute(query) mydb.commit() print(mycursor.rowcount, "record(s) deleted") mydb.close() Output: 1 record(s) deleted After deleting the element our table looks like this: Comment More infoAdvertise with us Next Article Deleting Element from Table in MySql using Python kumar_satyam Follow Improve Article Tags : Python Python-mySQL Practice Tags : python Similar Reads Add comment to column in MySQL using Python MySQL server is an open-source relational database management system which is a major support for web-based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web. In order to access MySQL databases from a 3 min read How to Copy a Table in MySQL Using Python? In this article, we will create a table in MySQL and will create a copy of that table using Python. We will copy the entire table, including all the columns and the definition of the columns, as well as all rows of data in the table. To connect to MySQL database using python, we need PyMySql module. 3 min read How to Copy a Table Definition in MySQL Using Python? Python requires an interface to access a database server. Python supports a wide range of interfaces to interact with various databases. To communicate with a MySQL database, MySQL Connector Python module, an API written purely in Python, is used. This module is self-sufficient meaning that it does 6 min read How to Show All Tables in MySQL using Python? A connector is employed when we have to use mysql with other programming languages. The work of mysql-connector is to provide access to MySQL Driver to the required language. Thus, it generates a connection between the programming language and the MySQL Server. In order to make python interact with 1 min read Python MariaDB - Drop Table using PyMySQL MariaDB is an open source Database Management System and its predecessor to MySQL. The pymysql client can be used to interact with MariaDB similar to that of MySQL using Python. In this article we will look into the process of Dropping a table from a database using pymysql. To drop a table use any o 2 min read Adding new enum column to an existing MySQL table using Python Prerequisite: Python: MySQL Create Table In this article, we are going to see how to add a new enum column to an existing MySQL table using Python. Python allows the integration of a wide range of database servers with applications. A database interface is required to access a database from Python. 1 min read Python MariaDB - Delete Query using PyMySQL DELETE is an SQL query, that is used to delete one or more entries from a table with a given condition. To connect with MariaDB database server with Python, we need to import pymysql client. After connecting with the database in MySQL we can create tables in it and can manipulate them. Syntax: DELET 2 min read Export Data From Mysql to Excel Sheet Using Python We are given a MySQL database and our task is to export the data into an excel sheet using Python. In this article, we will see how to export data from MySQL to Excel Sheets using Python. Export Data From Mysql to Excel Sheet Using PythonBelow are some of the ways by which we can export data from My 3 min read Python MySQL - Insert into Table MySQL is a Relational Database Management System (RDBMS) whereas the structured Query Language (SQL) is the language used for handling the RDBMS using commands i.e Creating, Inserting, Updating and Deleting the data from the databases. SQL commands are case insensitive i.e CREATE and create signify 3 min read Grant MySQL table and column permissions using Python MySQL server is an open-source relational database management system that is a major support for web-based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web. In order to access MySQL databases from a w 2 min read Like