0

I've been using mySQLdb in python to import data into a database, however I would also like to be able to address a specific row and update a cell in that row, I couldn't find the command to do this in the mySQLdb help file, would anyone be kind enough to point me in the right direction...

Thanks,

1 Answer 1

1

You can use a sql UPDATE statement

psuedo data schema:

# table people
id INT, name VARCHAR(40), age INT, address VARCHAR(100)

1, john, 33, North America
2, dm03514, 28, Maryland

using pythong MySQLdb

cursor.execute('UPDATE people SET address = %s WHERE id = %s', ('Columbia, MD', 2));
Sign up to request clarification or add additional context in comments.

Comments

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.