I agree other methods will work but I’m just giving a different idea. This will do without any temp table creation requirements::
SET @i=0;
UPDATE table_name SET column_name=(@i:=@i+1);
More Related Contents:
- MySQL: Alternatives to ORDER BY RAND()
- MySQL LIKE IN()?
- Auto Increment after delete in MySQL
- Unioning two tables with different number of columns
- NULL in MySQL (Performance & Storage)
- In MySQL queries, why use join instead of where?
- MySQL function to find the number of working days between two dates
- MySQL Trigger to prevent INSERT under certain conditions
- Importance of varchar length in MySQL table
- Stored Procedure with optional “WHERE” parameters
- mySQL :: insert into table, data from another table?
- Return 0 if field is null in MySQL
- MySQL “between” clause not inclusive?
- SQLite – ORDER BY RAND()
- How to search multiple columns in MySQL?
- MySQL – Selecting data from multiple tables all with same structure but different data
- Can a stored procedure/function return a table?
- SQL SELECT to get the first N positive integers
- Sorting string column containing numbers in SQL?
- Multiple Ranks in one table
- Create date from day, month, year fields in MySQL
- The difference between ‘AND’ and ‘&&’ in SQL
- Can I use a MySQL database with an App Engine application
- How can I make an average of dates in MySQL?
- What is the best way to generate ranks in MYSQL?
- What does collation mean?
- What’s the correct name for an “association table” (a many-to-many relationship) [closed]
- sql pulling a row for next or previous row of a current row
- Row Rank in a MySQL View
- Select Rows with Maximum Column Value group by Another Column