Removing the top row of a table in sqlite

核能气质少年 提交于 2021-02-04 08:23:05

问题


I can't figure out how to remove the very top row of a table in SQLite. I have the table populated and I just want to remove off the top of the table to work my way down.

Here is what I assume would've worked, but did not.

DELETE FROM images WHERE rowid <= 1

DELETE FROM images LIMIT 1

Any help would be greatly appreciated.


回答1:


SQLite DELETE Query is used to delete the existing records from a table. You can use WHERE clause with DELETE query to delete the selected rows. otherwise, all the records would be deleted.

If you need to delete the top rows on SQLite this query is a simple way, But there were multiple records more than 1000 make sure the query getting actual records

DELETE FROM images WHERE rowid in (select rowid FROM images LIMIT 1)


来源:https://stackoverflow.com/questions/53645627/removing-the-top-row-of-a-table-in-sqlite

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!