日期:2014-05-17 浏览次数:20770 次
sys@ORCL> create table st (sno number,sname varchar2(10),sex number);
Table created.
sys@ORCL> insert into st values(001,'aa',1);
1 row created.
sys@ORCL> insert into st values(002,'bb',1);
1 row created.
sys@ORCL> insert into st values(003,'cc',2);
1 row created.
sys@ORCL> insert into st values(004,'dd',1);
1 row created.
sys@ORCL> commit;
Commit complete.
sys@ORCL> select * from st;
SNO SNAME SEX
---------- ---------- ----------
1 aa 1
2 bb 1
3 cc 2
4 dd 1
sys@ORCL> select sex,count(sex) from st group by rollup(sex);
SEX COUNT(SEX)
---------- ----------
1 3
2 1
4