0
sql primary key
i create a table and want to update some values if can i give refrance value of 2nd or 3rd coloum insted of 1st colum or primary key. ?
5 Réponses
+ 1
for updating primary key is not a must have. First find a SELECT Query of all items you want to update and put this WHERE params in your UPDATE query: e.g. UPDATE mytable SET state=Ohio WHERE name LIKE 'G%'
0
i did this in my data base but the query show error. not santex error.
but whedn i enter the primary key in where clouse the query successfully exicute.
why ?
0
did you try to update the primary key? what did you get if you query SELECT * FROM yourtable WHERE (fill your update WHERE here). Did you get the same error?
0
same error very time if i enter 2nd or 3rd colum value in WHERE clouse instead of primary key.
0
What error did get exactly? Can you post it here?
Some database programs only allow updates which are safe (using the primary key in the where clause). Cfr. http://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench/11448324
Could it be you are trying to do an update which is not safe?