python之mysql(三)

1.创建数据表
   cur.execute("create table student(id int ,name varchar(20),class varchar(30),age varchar(10))")

   语句中用变量;  @变量

   select中用 @a := @a+1,一定带上冒号

2.插入一条数据
 cur.execute("insert into student values('2','Tom','3 year 2 class','9')")

3.查询条件的数据
cur.execute("select from student where age='9'")



原文地址:https://www.cnblogs.com/awenxianliao/p/7883031.html