MySQL MySQL删除所有id大于给定数字的行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28288096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:18:43  来源:igfitidea点击:

MySQL delete all rows where id is greater than the given number

mysqlsql

提问by Ashley Brown

Is there an Sql query I can run that will enable me to delete all rows where the ID is greater than let's say 10?

是否有我可以运行的 Sql 查询,它可以让我删除 ID 大于 10 的所有行?

Something like this.

像这样的东西。

I have two columns, ID and Name

我有两列,ID 和 Name

DELETE FROM table_name WHERE ID=>10;

回答by frlan

Your query was nearly perfect ;)

您的查询几乎完美;)

Just try

你试一试

DELETE FROM table_name WHERE ID>9;

You could also use

你也可以使用

DELETE FROM table_name WHERE ID>=10;

As you already mention.

正如你已经提到的。