Tuesday, May 16, 2023
HomeSoftware EngineeringLearn how to Drop a MySQL Desk in Python

Learn how to Drop a MySQL Desk in Python


First, you’ll need the mysql.connector. If you’re uncertain of learn how to get this setup, consult with Learn how to Set up MySQL Driver in Python.

Learn how 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)

Learn how 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

Most Popular

Recent Comments