HomeSoftware EngineeringEasy methods to Drop a MySQL Desk in Python

Easy methods to Drop a MySQL Desk in Python


First, you will have the mysql.connector. If you’re uncertain of get this setup, check with Easy methods to Set up MySQL Driver in Python.

Easy methods to Delete/Drop a MySQL Desk in Python

import mysql.connector

mydb = mysql.connector.join(
  host = "localhost",
  consumer = "username",
  password = "YoUrPaSsWoRd",
  database = "your_database"
)

mycursor = mydb.cursor()
sql = "DROP TABLE clients"
mycursor.execute(sql)

Easy methods to Delete/Drop Provided that MySQL Desk Exists in Python

import mysql.connector

mydb = mysql.connector.join(
  host = "localhost",
  consumer = "username",
  password = "YoUrPaSsWoRd",
  database = "your_database"
)

mycursor = mydb.cursor()
sql = "DROP TABLE IF EXISTS clients"
mycursor.execute(sql)
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments