新建表boss
create table
创建表
Code
import pymysql
con = pymysql.connect(host='localhost',\
user='root',\
password='',\
port=3306,\
db='business')
cursor=con.cursor()
cursor.execute('''create table if not exists boss(
id int auto_increment primary key,
name varchar(20)not null,
salary int not null)''')
添加数据
inser into
添加数据
con.commit()
#提交
Code
cursor.execute('''
insert into boss(name,salary)
values('Jack',91),('Harden',1300),('Pony',200)
''')
con.commit()#提交