求教mysql问题,查询学生表中的学生性别为男,且总成绩大于500. 本帖最后由 ACMAIN_CHM 于 2012-11-12 17:50:18 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 能用一个sql语句查询出所有性别为男总成绩大于500的学生么?成绩表中存储的单个科目的成绩。 select s.*from 学生表 s,成绩表 rwhere s.学生表的唯一标示=r.学生表的唯一标示and s.学生性别='男'group by s.学生表的唯一标示having sum(r.成绩)>500 select a.*from student a,score bwhere a.id=b.idand s.sex='男'group by a.idhaving sum(b.score)>500; select a.* from student a inner join (select id from scord group by id having sum(score)>500) bon a.id=b.idwhere sex='男' select * from 学生表 where 学生唯一标示 in(select 学生唯一标示 from 成绩表 where 性别='男' having sum(成绩)>=500) 上面的都把好的写了 我来写一个子查询,速度是慢了点,但是也可以赚分 不安装mysql也可以使用数据库? 查询一个表的资料不存在另一个表 主题:一道淘宝的考察sql语句的面试题 对用户登录做限制 急~~~~~~~~~~~~~~~~~~~老版本mysql数据库数据想转出到sql server,怎么办??? mysql安装问题 mysql 连接问题 忘记了root密码怎么办? 在W2K下如何导入SQL文件创建数据库和表? 菜鸟求助 show processlist\G 这是 什么情况啊 大虾们 频繁数据读取该如何设计?
from 学生表 s,成绩表 r
where s.学生表的唯一标示=r.学生表的唯一标示
and s.学生性别='男'
group by s.学生表的唯一标示
having sum(r.成绩)>500
from student a,score b
where a.id=b.id
and s.sex='男'
group by a.id
having sum(b.score)>500;
(select id from scord group by id having sum(score)>500) b
on a.id=b.id
where sex='男'