shallow last second salary in mysql code example
Example 1: sql select second max
Both options you find max as a subset and then exclude from main select
sql> SELECT MAX( col ) FROM table
WHERE col < ( SELECT MAX( col ) FROM table);
sql> SELECT MAX(col) FROM table
WHERE col NOT IN (SELECT MAX(col) FROM table);
Example 2: 2nd highest salary in mysql
#Corelated Subquery
SELECT Id, Salary
FROM Employee e
WHERE 2=(SELECT COUNT(DISTINCT Salary) FROM Employee p
WHERE e.Salary<=p.Salary)