sql语句的相关问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 07:17:13
这是一个子查询的例子
use pubs

select t1.type
from titles t1
group by t1.type
having max(t1.advance)>=all
(
select 2 * avg(t2.advance)
from titles t2
where t1.type=t2.type
)
go

max(t1.advance)>=all中>=all表示什么?
还有
select 2 * avg(t2.advance)
from titles t2
where t1.type=t2.type
能否详细解释一下

ALL是所有,大于所有值就是比最大值大
select 2 * avg(t2.advance)
from titles t2
where t1.type=t2.type
先查询出2倍的t2.advance的平均值
然后在查询出T1中比2倍的t2.advance的平均值大的TYPE

不在范围之内的,就是指查询出来的,有包括平均数里面