如何删除具有特定行号的数据(sqlite)
我有一个表人员(姓名、地址、电话),我的表有 2000 多行。我想删除 1000 行。查询情况如何?
I have a table people (name, address, phone), my table have 2000+ rows. I want to delete 1000 rows. How's about the query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设您想要删除“前 1000 行”,因为“select”查询结果的未排序顺序没有排序参数,也没有条件,在这种情况下您做错了。
但是,作为一项学术练习,您可以这样做。 SQLite 中的所有行都有
rowid
字段,您可以使用该字段来查找这 1000 行的结束位置。I assume you want to delete "first 1000 rows" given the unsorted order of the result of "select" query with no sorting arguments and no criteria, in which case you are doing something wrong.
But, as an academic exercise, here is how you'd do it. All rows in an SQLite have
rowid
field, which you can use to find where those 1000 rows end.http://www.sqlite.org/lang_delete.html
如果您有 SQLite 更新删除限制已启用
http://www.sqlite.org/lang_delete.html
If you had the SQLite update delete limit enabled