Reputation: 447
I want to update an entire column in a sql database. With the following command I can update a both the age and height of the person bob:
cursur.execute("UPDATE students SET age=10, height= 1.6 WHERE name='bob'")
But is there a way to fill in vectors for age, height and name, so that multiple values are updated simultaneously?
Upvotes: 0
Views: 151
Reputation: 757
you can use a function:
def updateData(age, height, name):
myQuery = "UPDATE students SET age=" + age + " height=" + height +" WHERE name=" + name
cursur.execute(myQuery)
you can use a for loop if you want to loop through array or any data.
Upvotes: 1