让我们首先创建一个表-
mysql> create table DemoTable1597 -> ( -> Marks int -> );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable1597 values(45); mysql> insert into DemoTable1597 values(59); mysql> insert into DemoTable1597 values(43); mysql> insert into DemoTable1597 values(85); mysql> insert into DemoTable1597 values(89);
使用select语句显示表中的所有记录-
mysql> select * from DemoTable1597;
这将产生以下输出-
+-------+ | Marks | +-------+ | 45 | | 59 | | 43 | | 85 | | 89 | +-------+ 5 rows in set (0.00 sec)
下面是删除错误1093 (HY000)的查询。我们要删除这里的最小值-
mysql> delete from DemoTable1597 -> where Marks=( -> select lowestMarks from ( select min(Marks) as lowestMarks from DemoTable1597 ) as deleteRecord -> ) limit 1;
让我们再次检查表记录-
mysql> select * from DemoTable1597;
这将产生以下输出-
+-------+ | Marks | +-------+ | 45 | | 59 | | 85 | | 89 | +-------+ 4 rows in set (0.00 sec)