求写SQL删除语句。。。删除表中的多行。。。
发布网友
发布时间:2024-10-21 22:23
我来回答
共4个回答
热心网友
时间:2024-11-10 06:30
DELETE
FROM SC x
WHERE x.cno in
(
select y.cno
from sc y
where y.cno = x.cno
group by y.cno
having y.grade < AVG(y.grade)
)
热心网友
时间:2024-11-10 06:30
DELETE FROM SC
WHERE
grade < ( SELECT AVG(grade) FROM SC y WHERE SC.cno=y.cno );
我印象中, 好像 DELETE FROM 表 这里不能加 别名的样子...
所以把
DELETE
FROM SC x
修改为
DELETE
FROM SC
不知道对不对了.......
热心网友
时间:2024-11-10 06:31
DELETE SC
FROM SC a,(SELECT cno,avg(grade) pj from SC GROUP BY cno) b
where a.cno=b.cno and a.grade<b.pj
热心网友
时间:2024-11-10 06:31
delete * from SC x where grade < (select avg(grade) from SC y) and SC x.cno = SC y.cno