I have a table on sql with the following data:
name location
sarah
dave
bob
rover
dave
bob
emma
john
prash
I have some data coming in that gives me location details of all these people. The locations could either be:
name_data location_data
sarah GB
dave US
bob FR
rover IN
dave US
bob FR
emma ES
john NI
How do I update the database so I can include the locations relative to the name? I tried the following, but it didn't seem to work:
cursor.execute("UPDATE "+table_name+"location) values (?)",location_data"WHERE name like" "'"name_data"'")
name=input("Enter name:")
loc = input("Enter Location:")
cursor = cnxn.cursor()
SQLCommand = ("UPDATE {table_name} SET location_data=? WHERE name_data ="+ name+" ")
Location = [loc]
cursor.execute(SQLCommand,Location)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With