Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

MySQL Joins Exercises: Display the job history that were done by any employee who is currently drawing more than 10000 of salary

MySQL Joins: Exercise-12 with Solution

Write a query to display the job history that were done by any employee who is currently drawing more than 10000 of salary.

Sample table: employees


Sample table: Job_history


Code:

SELECT jh.* FROM job_history jh 
JOIN employees e 
ON (jh.employee_id = e.employee_id) 
WHERE salary > 10000;

Sample Output:

EMPLOYEE_ID		START_DATE				END_DATE		JOB_ID			DEPARTMENT_ID
102			1993-01-13T05:00:00.000Z	1998-07-24T04:00:00.000Z	IT_PROG			60
101			1989-09-21T04:00:00.000Z	1993-10-27T04:00:00.000Z	AC_ACCOUNT		110
101			1993-10-28T04:00:00.000Z	1997-03-15T05:00:00.000Z	AC_MGR			110
201			1996-02-17T05:00:00.000Z	1999-12-19T05:00:00.000Z	MK_REP			20
114			1998-03-24T05:00:00.000Z	1999-12-31T05:00:00.000Z	ST_CLERK		50

 

MySQL Code Editor:

Structure of 'hr' database :

hr database

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous:Write a query to display job title, employee name, and the difference between salary of the employee and minimum salary for the job.
Next:Write a query to display the first name, last name, hire date, salary of the manager for all managers whose experience is more than 15 years.

What is the difficulty level of this exercise?