programming-examples/sql/SubqueriesHRDatabase/Write a query to display all the information for those employees whose id is any id who earn the second highest salary.sql

14 lines
399 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a query to display all the information for those employees whose id is any id who earn the second highest salary.
*/
SELECT *
FROM employees
WHERE employee_id IN
(SELECT employee_id
FROM employees
WHERE salary =
(SELECT MAX(salary)
FROM employees
WHERE salary <
(SELECT MAX(salary)
FROM employees)));