第13758题 单选题
执行给定的Python操作SQLite代码后,Student数据表中共有多少条数据?
import sqlite3
conn = sqlite3.connect('student_info.db')
cursor = conn.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS Student(id INTEGER PRIMARY KEY, name TEXT, age INTEGER)''')
cursor.execute("INSERT INTO Student (id, name, age) VALUES (1, 'Alice', 20)")
cursor.execute("INSERT INTO Student (id, name, age) VALUES (2, 'Bob', 22)")
cursor.execute("INSERT INTO Student (id, name, age) VALUES (3, 'Charlie', 21)")
cursor.execute("SELECT * FROM Student")
students = cursor.fetchall()
for student in students:
print(f"ID: {student[0]}, Name: {student[1]}, Age: {student[2]}")
cursor.execute("UPDATE Student SET age = 23 WHERE id = 2")
cursor.execute("DELETE FROM Student WHERE id = 3")
conn.commit()
conn.close()
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析