python & sql-CMPUT 291

SQLite Inside Python: Part 2
CMPUT 291
Introduction to File and Database Management Systems
University of Alberta
Department of Computing Science
Page 1
Single query with different values
executemany() runs a single query with different values for its parameters.
Inserting a list of values into the database:
insertions = [
(“Spiderman2” , 4, 2002, 200),
(“The Dark Knight2”, 5, 2010, 160),
(“Zootopia2” , 6, 2018, 208),
]
cur.executemany(
“INSERT INTO movie VALUES ( , , , );”,
insertions,
)