I built this program and can't seem to figure out how to remove all of the elements from the database. My code is below:
def clear_books():
c = cursor()
with c.connection:
for book in c.execute("SELECT * FROM books"):
c.execute("DELETE FROM books WHERE title=?", (book[0],))
If anyone can figure this out I would be very grateful.
Skip the loop and do
c.execute("DELETE FROM books;")