mysql.connector-创建数据库表test(id, sname, age)其中id为主键自增,sname不能为空

时间:2020-08-18 13:16:42   收藏:0   阅读:92
import mysql.connector
conn= mysql.connector.Connect(
    host=localhost,
    user=root,
    passwd=admin,
    database=testcode
)
print(1.,conn)
cmd = conn.cursor()  # 光标行
cmd.execute(‘‘‘create table test(
            id int primary key auto_increment,
            sname char(10) not null,
            age int);‘‘‘)

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!