ITeye博客

having

xiajava2011 · 2011-09-13 21:58 · oracle数据库 · 数据库 · Markdown

聚集函数如max,min,sum,count,avg不能出现在where子句中,要想加条件,必须用having

select pub,sum(price*qty) from books group by pub having sum(price)>60;

 

nvl函数的使用:

select nvl(name,'未输入') from table; 

查询字段是否为空

 

 

 

decode的使用:

select sum(decode(sex,'男',1,0)) 男人数,sum(decode(sex,'女',1,0)) 女人数 from student;

统计男生人数和女生人数

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。