编程题

学生表操作题

建立学生表,将学号设置为主键,实现对数据的添加和查找。(无需运行通过,写入代码即可)

import sqlite3

con = sqlite3. ① ('./student.db')

cur = ②

sql ='''

③ IF NOT EXISTS Stu (

id INTEGER ④ AUTOINCREMENT,

name TEXT,

age INTEGER,

clas TEXT)

'''

cur.execute(sql)

con.commit()

sql = '''

⑤ (name,age,clas) VALUES(?,?,?)

'''

cur.execute(sql,('张三',16,'二三班'))

con.commit()

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论