-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek2_2.sql
More file actions
22 lines (22 loc) · 1.12 KB
/
Copy pathweek2_2.sql
File metadata and controls
22 lines (22 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Find the average salary of company
Select AVG(amount) from company;
-- Find the Sum of salaries of company
Select SUM(amount) from company;
-- Find the Maximum amount of company
Select Max(amount) from company;
-- Find the Minimum amount of company
Select Min(amount) from company;
-- Find the number of rows in a company
Select Count(*) from company;
-- Find the sum of amount of each company.
select companyn,sum(amount) from company group by companyn;
-- Find the minimum amount of each company.
select companyn,min(amount) from company group by companyn;
-- Find the maximum amount of each company.
select companyn,max(amount) from company group by companyn;
-- Find the count of all the rows grouped by each company name.
select companyn,count(*) from company group by companyn;
-- Find the count of all the rows grouped by each company name & having count greater than 1.
select companyn,count(*) from company group by companyn having count(*)>1;
-- Find the sum of amount of each company and having sum of amount greater than 10000.
select companyn,sum(amount) from company group by companyn having sum(amount)>10000;