python-by-example-150-chall.../challenges139-145/challenge-143_.py
2021-12-08 20:19:52 +09:00

15 lines
353 B
Python

import sqlite3
with sqlite3.connect("BookInfo.db") as db:
cursor=db.cursor()
selectionyear=int(input("Enter a year: "))
print()
cursor.execute("""SELECT Books.Title, Books.DatePublished, Books.Author
FROM Books WHERE DatePublished >? ORDER BY DatePublished""", [selectionyear])
for x in cursor.fetchall():
print(x)
db.close()