목차
MySQL 테이블 삭제
테이블 삭제. (※ 테이블 비 존재 시, 에러 발생.) DROP TABLE table_name 테이블이 존재할 때만 삭제. (권장) ★ DROP TABLE IF EXISTS table_name [일반 삭제] ※ 테이블 존재 안 할 시, 에러 발생. import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="autoset", database="hz" ) mycursor = mydb.cursor() sql = "DROP TABLE hz_member" mycursor.execute(sql) [테이블 존재하면 삭제] (권장) ★ import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="autoset", database="hz" ) mycursor = mydb.cursor() sql = "DROP TABLE IF EXISTS hz_member" mycursor.execute(sql)
테이블 삭제. (※ 테이블 비 존재 시, 에러 발생.)
DROP TABLE table_name
테이블이 존재할 때만 삭제. (권장) ★
DROP TABLE IF EXISTS table_name
[일반 삭제] ※ 테이블 존재 안 할 시, 에러 발생.
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="autoset",
database="hz"
)
mycursor = mydb.cursor()
sql = "DROP TABLE hz_member"
mycursor.execute(sql)
[테이블 존재하면 삭제] (권장) ★
sql = "DROP TABLE IF EXISTS hz_member"
PS.
Node.js DROP TABLE (테이블 삭제)
https://homzzang.com/b/njs-20
최신댓글