
Predict
What Does fetchall() Return?
A query hands back rows. fetchall() gives every row,
fetchone() gives just the next one. Think carefully about the
shape of what comes back.
import sqlite3
conn = sqlite3.connect(":memory:")
conn.execute("CREATE TABLE fuel (island TEXT, barrels INTEGER)")
conn.execute("INSERT INTO fuel VALUES ('Amber Isle', 4)")
sql = "SELECT barrels FROM fuel"
print(conn.execute(sql).fetchall())
print(conn.execute(sql).fetchone())
print(conn.execute(sql + " WHERE barrels > 9").fetchall())