You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
657 B
SQL

/*Write a query to display the employee id, name ( first name and last name ), salary, department name and city for all the
employees who gets the salary as the salary earn by the employee which is maximum within the joining person
January 1st, 2002 and December 31st, 2003.
*/
SELECT a.employee_id, a.first_name, a.last_name, a.salary, b.department_name, c.city
FROM employees a, departments b, locations c
WHERE a.salary =
(SELECT MAX(salary)
FROM employees
WHERE hire_date BETWEEN '01/01/2002' AND '12/31/2003')
AND a.department_id=b.department_id
AND b.location_id=c.location_id;