0% found this document useful (0 votes)
4 views

DBMS_Lab_Exercise_5

The document outlines a lab exercise involving SQL queries related to an Employee table, including tasks such as creating the table, adding a department number, updating employee records, and performing various salary calculations. It includes specific queries to find average, maximum, and minimum salaries, as well as sorting and filtering employee data based on certain criteria. The exercise aims to enhance understanding of SQL operations and employee data management.

Uploaded by

hnpatil2821969
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

DBMS_Lab_Exercise_5

The document outlines a lab exercise involving SQL queries related to an Employee table, including tasks such as creating the table, adding a department number, updating employee records, and performing various salary calculations. It includes specific queries to find average, maximum, and minimum salaries, as well as sorting and filtering employee data based on certain criteria. The exercise aims to enhance understanding of SQL operations and employee data management.

Uploaded by

hnpatil2821969
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

LAB EXERCISE 5

The Employee table containing employee data for a company is described as follows:

where employee_id is an employee's ID number, name is their name, months is the total number
of months they've been working for the company, and salary is the their monthly salary.

Q.1 Create the Employee table and insert the data given above.
Q.2 Add the new column department_no with integer data type.
Q.3 Update the department_no as 10 for Angela, Bonnie, Joe and Rose.
Q.4 Update the department_no as 20 for Michael, Todd and Lisa.
Q.5 Update the department_no as 30 for Kimberly and Patrick.
Q.6 Find out the average salary of all the employees
Q.6 Find the maximum salary and minimum salary from each department.
Q.7 Write a query that prints a list of employee names (i.e.: the name attribute) from the
Employee table in alphabetical order.
Q.8 Write a query that prints a list of employee names (i.e.: the name attribute) for employees in
Employee having a salary greater than 2000 per month who have been employees for less than
10 months. Sort your result by ascending employee_id.
Q.9 We define an employee's total earnings to be their monthly ‘salary x months’ worked, and
the maximum total earnings to be the maximum total earnings for any employee in the Employee
table. Write a query to find the maximum total earnings for all employees as well as the total
number of employees who have maximum total earnings.
Q. 10 Increase the salary of each employee by 1000 who have worked for more than 10 months.
Q.11 Find out the third largest salary of the employee.
Q.12 Find out third last smallest salary of the employee.

You might also like