Python MariaDB - Drop Table using PyMySQL Last Updated : 14 Oct, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 of the below syntax: Syntax : DROP TABLE tablename; DROP TABLE IF EXISTS tablename; The following programs will help you understand this better. Example 1 : Program to demonstrate drop if exists. We will try to drop a table which does not exist in the above database. Python3 import pymysql # Create a connection object # IP address of the MySQL database server Host = "localhost" # User name of the database server User = "user" # Password for the database user Password = "" database = "GFG" conn = pymysql.connect(host=Host, user=User, password=Password, database) # Create a cursor object cur = conn.cursor() query = f"DROP TABLE IF exists Employee" cur.execute(query) conn.close() Output : Before After Example 2 : Here we will drop the student table. Python3 import pymysql # Create a connection object conn = pymysql.connect('localhost', 'user', 'password', 'database') # Create a cursor object cur = conn.cursor() query = f"DROP TABLE IF exists Student" cur.execute(query) rows = cur.fetchall() conn.close() for row in rows : print(row) Output : Before After Comment More infoAdvertise with us Next Article Python MariaDB - Select Query using PyMySQL P pratapworkmail Follow Improve Article Tags : Python Python-MariaDB Practice Tags : python Similar Reads Python MariaDB - Insert into 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 inserting rows to a table of the database using pymysql. You can insert o 2 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 Python MariaDB - Select Query 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 querying data from a table of the database using pymysql. Â To query data 2 min read Python MariaDB - Update Query 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 using the UPDATE query on a table of the database using pymysql. Â The up 2 min read Python MySQL - Drop Table 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.Drop Table CommandDrop command affects 2 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 Like