The document contains SQL queries divided into two sections. Section A includes basic queries for counting distinct jobs, ordering employee names, filtering names, and ordering by job and salary. Section B focuses on grouping employee counts by department, filtering based on employee name criteria, and finding maximum salaries and unique job counts within departments.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
4 views1 page
DBMS- Worksheet 4 - Answers
The document contains SQL queries divided into two sections. Section A includes basic queries for counting distinct jobs, ordering employee names, filtering names, and ordering by job and salary. Section B focuses on grouping employee counts by department, filtering based on employee name criteria, and finding maximum salaries and unique job counts within departments.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
Question 2
--------------------- SECTION A ---------------------
a) select count(distinct Job) from Employee; b) select Empno, Empname from Employee order by Empname asc; c) select * from Employee where (Empname>'C' and Empname <'M') order by Empname desc; d) select Job,Salary from Employee order by Job desc, Salary asc;
--------------------- SECTION B ---------------------
a) select Dno, count(*) as employeecount from Employee group by Dno; b) select Dno, count(*) as employeecount from Employee group by Dno order by employeecount asc; c) select Dno, count(*) as employeecount from Employee group by Dno having count(*)>2 order by employeecount desc; d) select Dno, max(Salary) as DepMaxSalary from Employee group by Dno order by DepMaxSalary desc; e) select Dno, count(distinct Job) as NoOFuniqueJobs from Employee group by Dno; f) select Job, count(*) as NumberOfEmployees from Employee group by Job order by NumberOfEmployees asc; g) select Dno, count(*) as NumberOfEmployees from Employee where (Empname>='C' and Empname <='S') group by Dno order by NumberOfEmployees asc; h) select Dno, count(*) as NumOfEmployee from Employee where Empname>='C' and Empname<='S' group by Dno having count(*)>2 order by NumOfEmployee asc;