sum with column calculation
create table emp(
no integer primary key
,name varchar2(20) not null
,salary number(10)
,city varchar2(20)
);
insert into emp(no, name, salary, city)
values (1,'Nancy','2212','Paris');
insert into emp(no, name, salary, city)
values (2,'Tom','3212','Barton');
insert into emp(no, name, salary, city)
values (3,'Jason','4212','Island');
insert into emp(no, name, salary, city)
values (4,'Jack','5212','Paris');
select sum(salary) "TOTAL Salary",
sum(salary * 12) "GROSS $"
from emp
group by city;
TOTAL Salary GROSS $
------------ ----------
4212 50544
3212 38544
7424 89088
drop table emp;
Related examples in the same category