Data Base and Management System Lab
Data Base and Management System Lab
Data Base and Management System Lab
CSL-220
Lab journal 5
Department of Computer Sciences
BAHRIA UNIVERSITY, ISLAMABAD
Lab # 5
NVL , NULLIF, coalesce ,Decode, aggregate functions and CASE Expression. Aggregate Functions
and Group by clause and having statement
Lab Tasks
1. Create a query that displays the employees’ names and commission amounts. If an
employee does not earn commission, show “No Commission.” Label the column COMM.
Perform this uding NVL, Decode and COLESCE.
2. Using the DECODE function, write a query that displays the grade of all employees based
on the value of the column JOB_ID, using the following data:
a. Job Grade
b. AD_PRES A
c. ST_MAN B
d. IT_PROG C
e. SA_REP D
f. ST_CLERK E
g. None of the above 0
3. Rewrite the statement in the preceding exercise using the CASE syntax.
4. Display the total salary amount being dispersed every month of an organization assuming
the records are placed in Emp table.
6. Display the variation using standard deviation and variance in salaries of employees.
7. Show the total number of employees in an organization.
9. Display the highest, lowest & average salaries of employees who were hired in July and
August month.
10. Create a query that displays deptno, loc, number of employees and avg of salary of all
employees. Round the average salary upto two decimal places.
11. Display the department-wise total salary given to the employees of an organization.
13. Display the number of employees department-wise and job-wise. The output look like as:
DEPTNO JOB COUNT (*)
------- --------- ---------
10 CLERK 1
10 MANAGER 1
10 PRESIDENT 1
20 CLERK 2
20 ANALYST 2
20 MANAGER 1
30 CLERK 1
30 MANAGER 1
30 SALESMAN 4
14. Extend the previous query output and incorporate the average salary of employees
department-wise and job-wise.
15. Display the highest and lowest salaries department wise. The output look like as:
DEPTNO LOWEST HIGHEST
1 1200 52000
2 800 6950
3 4560 19856
Submit the lab journal in next class