I have one table that contain lots of records and I want to update my primary key开发者_运维技巧 by row number. My database is MySQL.
You shouldn't do that.
There is not a thing called "row number" in the database.
Such a number can be applicable only to output of certainly ordered and filtered data, but not to stored one.
Leave your primary key alone, it identifies the whole record, not it's "position" (especially because there is no position at all).
Why do you need that? Your task has another solution for sure, a proper one
mysql isn't Oracle and doesn't support rownum.
精彩评论