Answered Questions

  • How to retrieve a second highest salary from a table?

    How to retrieve a second highest salary from a table? Note:Suppose salaries are in duplicate values eg: Name Sal Malli 60000 Pandi 60000 Rudra 45000 Ravi 45000

    Pankaj Yadav

    • Feb 23rd, 2018

    Code
    1. SELECT max(salary) FROM employee WHERE salary <> (SELECT max(salary) FROM employee)

    Santhosh Kumar Gujja

    • Nov 27th, 2017

    SEL SAL FROM(
    SEL DISTINCT SAL FROM TABLE
    ) O QUALIFY ROW_NUMBER() OVER(ORDER BY SAL DESC)=2