company2

an anonymous user · December 06, 2021 · SQL
create table company2(name integer(10),dept varchar(09),salary integer(10));
insert into company2 values("sathya","finance",8000);
insert into company2 values("goamthi","purchase",6000);
insert into company2 values("kaviya","sales",9000);
insert into company2 values("karthicka","marketing",10000);
insert into company2 values("arun","purchase",2500);
insert into company2 values("sindhu","marketing",6700);
insert into company2 values("anu","purchase",7800);
select*from company2;
select dept,sum(salary)as "total"from company2 group by dept;
select dept,sum(salary)as "total"from company2 group by dept having sum(salary)>1000;
select dept,max(salary)from company2 group by dept;
select dept,min(salary)from company2 group by dept;
select dept,count(*)from company2 group by dept;
select dept,avg(salary)from company2 group by dept;

Comments

Please sign up or log in to contribute to the discussion.