问题描述:

I have a table with 9 records in it but i want to insert a row in between of 5th and 6th record.

网友答案:

if you insist on

UPDATE mytable SET id = id + 1 where id > 5 ORDER BY id ASC

insert into mytable (id,..) values (6,...) 
网友答案:

In general, you don't insert a row at a specific location in a table.

If the row "order" is significant and has some special semantic, have the data reflect that with a proper column in the table structure.

Then use a SELECT ... ORDER BY ... to get rows sorted.

相关阅读:
Top