Professional Documents
Culture Documents
Assignment FFG
Assignment FFG
To create the database and add data programmatically by using the Insert query, we can use SQL
statements within a Python script. Here's an example code snippet:
import sqlite3
conn = sqlite3.connect('books.db')
c = conn.cursor()
c.execute("INSERT INTO books VALUES ('The Great Gatsby', 'F. Scott Fitzgerald', 10.99)")
c.execute("INSERT INTO books VALUES ('To Kill a Mockingbird', 'Harper Lee', 7.99)")
c.execute("INSERT INTO books VALUES ('Pride and Prejudice', 'Jane Austen', 9.99)")
conn.commit()
conn.close()