Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
2 views3 pages

5 Week - SQL DML - Assignment

Uploaded by

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

5 Week - SQL DML - Assignment

Uploaded by

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

This is the sample database that we installed during our week 5.

❖​https://www.sqltutorial.org/sql-sample-database/

❖​Every employee is optionally assigned to a department


❖​A department can exist without any employees
❖​An employee may or may not have any dependants
❖​Every location must be in a country and is mapped to a region
❖​For every job title, there is a maximum and minimum salary defined
❖​Every employee must have a job title
1.​ List the details of the employee with the following employee_id
101, 102, 177, 201, 206

2.​ Jack Livingston is working as a Sales Representative and due to his good
performance has now been promoted to a Sales Manager. Increase his salary
but limit to a number within the minimum and maximum allowed for a Sales
Manager.

3.​ List the details of all Accountants with a salary greater than 7000 and less than
9000

4.​ The company has decided to add a new job called “Head IT" with a minimum
salary of 10000 and maximum salary of 15000. Ensure that a record for this is
created in the relevant table. Note that job_id is an auto_increment column.

5.​ The company has hired a new employee as “Head IT”. Ensure that a record is
added into the relevant table.Note that employee_id is an auto_increment
column. The details are given below:
a.​ Scott King is the name of the employee
b.​ The hiring date is today
c.​ Email should be [email protected]
d.​ His phone number is 590.234.6234
e.​ His salary is 14,000
f.​ He will belong to the IT department
g.​ He will report to Steven King.

6.​ The company now wants all the Employees with jobs as Programmers to report
to this new IT Manager. Reflect this in the database.

7.​ The company has created a new “Operations” Department. The operations
department is located in Texas. Reflect this in the database. Note that
department_id is an auto_increment column.

8.​ Employee “Charles Johnson” has a new born child. Add his child “Alicia” as a
dependent for this employee. Note that dependent_id is an auto_increment
column.

9.​ Michael Harstein has resigned from the company. Pat Fay will take over his job.
Reflect that in the database. Identify all the commands that need to be executed
in the database and execute them. Note that when an employee leaves the
company, his details need to be removed from the database.

10.​List the employees first name, last name, hire date, and number of days they are
employed with the company. Identify the top 5 longest serving employees in the
organization.

11.​Identify the top 5 departments with the highest number of employees.

12.​List all employees whose phone number starts with ‘515’

13.​List all employees who have not provided a phone number.

14.​List the average salary per department. Which department has the highest
average salary?

15.​List the average salary per job code. Which job has the highest average salary?

16.​For each department, identify the minimum and maximum salary. Include in the
output the department_id, minimum salary and maximum salary

17.​List all employees hired in the years 1997, 1998 (Hint: how to extract the year
from the hire date and which logical operator to use)

18.​Identify the number of employees hired in the years 1997, 1998, and 1999. (Hint:
group by year)

19.​Shanta Vollman has performed exceptionally well. The company has decided to
increase her salary. Identify the maximum salary for her job code and increase it
to the maximum.

20.​Identify all the managers in the organization and increase their salary by 10%

You might also like