0% found this document useful (0 votes)
103 views8 pages

Data Base and Management System Lab

This document is a lab journal assignment for a database management systems course. It contains 15 tasks for students to complete involving SQL queries using aggregate functions, group by, having, decode, case, nullif, and coalesce. The tasks include finding minimum and maximum salaries, total salaries by department, averages by department and job, and counts of employees by department and job with average salary. Students are instructed to submit the completed lab journal in the next class.

Uploaded by

Arsalan Ishtiaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views8 pages

Data Base and Management System Lab

This document is a lab journal assignment for a database management systems course. It contains 15 tasks for students to complete involving SQL queries using aggregate functions, group by, having, decode, case, nullif, and coalesce. The tasks include finding minimum and maximum salaries, total salaries by department, averages by department and job, and counts of employees by department and job with average salary. Students are instructed to submit the completed lab journal in the next class.

Uploaded by

Arsalan Ishtiaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Data Base and Management System Lab

CSL-220
 

Lab journal 5
 

Student’s Name: Arsalan Ishtiaq


Enrolment number(s): 01-134182-013
Class: BS (CS) – 4B
 
 
 

 
 
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.

5. Show the lowest and highest salary of employees.

6. Display the variation using standard deviation and variance in salaries of employees.
7. Show the total number of employees in an organization.

8. Write a query to display the total number of employees in deptno 20.

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.

12. Display the dept-wise number of employees working in 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

You might also like