Professional Documents
Culture Documents
Muhammad Fahad CMS: 356324: Submitted To: Waqas Ahmed
Muhammad Fahad CMS: 356324: Submitted To: Waqas Ahmed
CMS: 356324
Submitted to: Waqas Ahmed
11-12-2020
DATABASE SYSTEMS
LAB-6
TASKS
Task-1: Select all employees from ‘EE’, ‘IS’ and ‘CSE’ department using
UNION
operator.
STEPS
First we CREATE the table “EMPLOYEE”
then select the names of the employees in department CSE, IS and EE using
UNION Command
Task-2: Display all employees name and salary, whose salary is lesser
than
maximum salary of the company and job title starts with ‘S’.
STEPS
In this task we use the same table EMPLOYEE
Then we see the details of the employees whose salary is lesser than
maximum salary of the company and job title starts with ‘S’ using
SUBQUERIES
Task-3 Write a query to find all the employees who work in the same
job as ‘ALI’.
STEPS
First, we take the same table “EMPLOYEE” from the earlier task
Now we use SELECT and Subquery to display the departments as asked
Task-5: Display the employees who have the same job as ‘ALI’ and
whose salary <=‘NASIR’.
STEPS
First, we take the same table “EMPLOYEE” from the last task
We use AND and SUBQUERY to display the required result
Task-7: Write a query to list all the employees who salary is <
the average salary of their own dept.
STEPS
First, we take the same table “EMPLOYEE” from the Task
We use GROUP BY and SUBQUERY in this task
STEPS
First, we take the same table “EMPLOYEE” from the last Task
Now we use the combination of AND and SUBQUERY to display the output
The results are shown