如果记录数小于5,我想从表中删除一个具有最小值的行;
您可以使用聚合min和count函数的子选择来执行此操作:
min
count
DELETE FROM the_table WHERE the_field = (SELECT min(the_field) FROM the_table) AND (SELECT count(*) FROM the_table) < 5;