Python SQLite Update Query

Python SQLite Update Query:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) Update query is used to update existing records in the SQLite database we created in the previous blog “SQLite in Python“.

(2) We use DB Browser to see which data we updated in the SQLite database table. Follow this blog “Install DB Browser for SQLite on Windows“.

use update query on data python

(3) Above image shows which data is available in the database table. We use the update query on this table to update some existing records as shown below.

Python SQLite Update Query Code

Note: We always need to call the connection’s commit method to write our changes out to the database. Otherwise, when the connection is closed, our changes may be lost. In fact, until we call the commit method, none of our updates may be visible from other database connections.

(4) Now we open the DB Browser to see whether the second record is updated in the employee_table as shown below. The above query works successfully.

UPDATE QUERY on sqlite data

Tutorial MySQL
List Comprehension in Python
List Iteration in Python
String Iteration in Python
String Indexing and String Slicing in Python
Python Identity Operators
Python (programming language)– Wikipedia

Comments (No)

Leave a Reply