Here, in the update part a new duplicate is getting created instead of updating the existing record. Please help!
def addBooks(title, quantity):
c.execute('SELECT * FROM books')
for i, j in c.fetchall():
if i == title:
c.execute('UPDATE books SET quantity = ? WHERE title = ?', (j+quantity, title))
conn.commit()
else:
c.execute('INSERT INTO books VALUES (?, ?)', (title, quantity))
conn.commit()