select name, score from student where score in
(select distinct top 3 score from student)
order by score desc 查出男女同学相同的班级??? 不明白你想找甚應.我是用 An Introduction to Database System (C.J. Date)
每個 sql server都會詳細解釋的sql語法.
(select distinct top 3 score from student)
order by score desc 查出男女同学相同的班级??? 不明白你想找甚應.我是用 An Introduction to Database System (C.J. Date)
每個 sql server都會詳細解釋的sql語法.
是男女同学数目相同的班级你的AN INTORDUCTION TO DATEBASE SYSTEM 在哪有
书上的语法很简单,但与实际还是有差距
至少要复杂一点
2、我猜的,估计不行,:):
select a.class from student a,student b
where (a.class=b.class) and (count(a.name)=count(b.name))
and (a.sex="m" and b.sex="f")
select * from student t1,(select top 3 score from student group by score order by score desc)t2
where t1.score=t2.score
2.
select class
from student
group by class
having sum(case sex when 'f' then 1 else 0 end)=sum(case sex when 'm' then 1 else 0 end)
2 提select class
from student
group by class
having sum(case when sex ='f' then 1 else 0 end)=sum(case when sex='m' then 1 else 0 end)
select class
from student
group by class
having sum(case sex when 'f' then 1 else -1 end)=0