如何在Sql中两个现有行之间的表中插入一行 [英] How to insert a row in a table between two existing rows in Sql
本文介绍了如何在Sql中两个现有行之间的表中插入一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表中有9条记录,但我想在第5条至第6条记录之间插入一行.
I have a table with 9 records in it but i want to insert a row in between of 5th and 6th record.
推荐答案
如果您坚持要
UPDATE mytable SET id = id + 1 where id > 5 ORDER BY id ASC
insert into mytable (id,..) values (6,...)
这篇关于如何在Sql中两个现有行之间的表中插入一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文