1.创建基础表
create table bb(no number,
name varchar2(100),
dept varchar2(255),
tel number,
sal number)
2.插入数据
insert into bb values(01,'陈长生','财务部','18895623456',2000);
insert into bb values(02,'王永民','IT部','15895623456',1500);
insert into bb values(03,'张之帝','财务部','19895623456',3000);
insert into bb values(04,'张 生','财务部','18895623456',4000);
insert into bb values(05,'张 三','IT部','18895623456',6000);
3.对数据进行操作
--分组统计
select dept,sum(sal) from bb
group by dept
union all
select '合计' dept , sum(sal) from bb
----未完.