Python SQLite – Update Specific Column
In this article, we will discuss how to update a specific column of a table in SQLite using Python.
In order to update a particular column in a table in SQL, we use the UPDATE query. The UPDATE statement in SQL is used to update the data of an existing table in the database. We can update single columns as well as multiple columns using UPDATE statement as per our requirement.
SET column1 = value1, column2 = value2…., column n = value n
Below are some examples which depict how to use UPDATE query in SQLite using Python.
Example 1: We are going to create a STUDENT table and then perform update operations in it by updating the SNAME of a student whose SID is 1 in the table.
Here is another program where we update the ADDRESS of all the rows whose SAGE column value is 22 in the same table.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course