How to update and delete records in a SQLite database?
How to update and delete records in a SQLite database?
How to update and delete records in a SQLite database?
solveurit24@gmail.com Changed status to publish February 13, 2025
Use UPDATE and DELETE statements.
import sqlite3
conn = sqlite3.connect('mydatabase.db')
cursor = conn.cursor()
cursor.execute("UPDATE users SET name = 'Bob' WHERE id = 1")
cursor.execute("DELETE FROM users WHERE id = 2")
conn.commit()
conn.close()
solveurit24@gmail.com Changed status to publish February 13, 2025