0

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?

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I actually wondered If it could with out a for loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.