简体   繁体   English

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

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

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;

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. 正如您已经提到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM