__main__:1: Warning: Unknown table 'employ' 0L
from warnings import filterwarningsimport MySQLdb filterwarnings('ignore', category = MySQLdb.Warning)
#!/usr/bin/env python# -*- coding: UTF-8 -*-import MySQLdbfrom warnings import filterwarningsfilterwarnings('ignore',category = MySQLdb.Warning)#打开数据库连接db = MySQLdb.connect("localhost","root","","ruiy")#使用cursor()方法获取操作游标cursor = db.cursor();#如果数据表已经存在使用execute()方法删除表cursor.execute("drop table if exists employee")#创建数据表SQL语句sql = """create table employee ( first_name char(20) not null, last_name char(20), age int, sex char(1), income float )"""cursor.execute(sql)db.close()
posted on 2016-11-19 16:04 阅读( ...) 评论( ...)