首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

Oracle语法的一个小疑点

2013-06-19 
Oracle语法的一个小问题在表emp中 列出工资最小值小雨等于2000的职位select job,min(sal)from empwhere mi

Oracle语法的一个小问题
在表emp中 列出工资最小值小雨等于2000的职位

select job,min(sal)
from emp
where mina(sal)<=2000;为什么不对

为什么要写成
select job,min(sal)
from emp
group by job
having min(sal)<=2000;

group by 到底 有什么用
[解决办法]
select 非聚合函数列,需要用group by 
[解决办法]
查看Group by的语法
Select [filed1,fild2,]聚合函数(filed),
[Grouping(filed),]
[Grouping_id(filed1,filed2,…)]
From tablename
Where condition
[Group by {rollup
[解决办法]
cube}(filed,filed2)]
[having condition]
[order by filed1]

热点排行