Question: Download the Employee database available at the following link: https://github.com/datacharmer/test_db > Importing Data To import the data into your MySQL server, unzip and go inside

Download the Employee database available at the following link:

https://github.com/datacharmer/test_db

> Importing Data

To import the data into your MySQL server, unzip and go inside the database (test_db) directory and load the data using the following command from your terminal/shell:

mysql -u root -p < employees.sql

Note: provide full path to the employees.sql file located inside test_db The Employees sample database provides a combination of a large base of data (approximately 160MB) spread over six separate tables and consisting of 4 million records in total. For more details check the following link:

https://dev.mysql.com/doc/employee/en/

Write appropriate SQL statements to answer each of the following questions:

1. Show all available job position titles.

2. How many employees work on each position.

3. What is the average salary for each position? Order the results from the highest average to the lowest.

4. Show all departments name together with the first and last names of departments manager. Sort the list by the last name of the manager.

5. Modify the previous query to show only the current manager of each department. A manager is a current manager if the to date column is equal to "9999-01-01".

6. What is the average current salary for each position?

7. How many Assistant Engineers currently earn more than the average salary of all current employees?

8. Show all identifiers of departments that have more than 40000 employees.

9. Create a stored procedure to show the difference in the average salaries for males and females?

10. Create a stored procedure to show first name, last name, salary and title of all employees with the salary between 38000 and 39000. Sort them by the salary. You want to present only the current job title.

(Download the Employee database available at the following link:

https://github.com/datacharmer/test_db) and also could you explain how to do this question .thanks

( relational database MySQL)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!