SQL Subquery Exercises: Display all the infromation about those employees who earn second lowest salary of all the employees
SQL SUBQUERY: Exercise-52 with Solution
Write a query in SQL to display all the infromation about those employees who earn second lowest salary of all the employees.
Sample table: employees
SELECT * FROM employees m WHERE 2 = (SELECT COUNT(DISTINCT salary ) FROM employees WHERE salary <= m.salary);
employee_id first_name last_name email phone_number hire_date job_id salary commission_pct manager_id department_id 128 Steven Markle SMARKLE 650.124.1434 2008-03-08ST_CLERK 2200.00 0.00 120 50 136 Hazel Philtanker HPHILTAN 650.127.1634 2008-02-06ST_CLERK 2200.00 0.00 122 50
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a query in SQL to display the details of the current job for those employees who worked as a Sales Representative in the past.
Next: Write a query in SQL to display the details of departments managed by Susan.
What is the difficulty level of this exercise?