Suppose that you are given the following simple database table called Employee that has 2 columns named Employee ID and Salary:
Employee
Employee ID S
`select max(salary) as first, (select salary from employee order by salary desc limit 1, 1) as second from employee limit 1`
For max salary simply we can use max function, but second max salary we should use sub query. in sub query we can use where condition to check second max salary or simply we can use limit.