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.
14 lines
399 B
MySQL
14 lines
399 B
MySQL
5 years ago
|
/*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)));
|