Back to problems

Second Highest Salary

SQL · Amazon · Easy

Table: employee employee_id is the primary key for this table. Write a query that returns the second highest distinct salary from the employee table. If more than one employee earns that salary, the value should still appear only once. If the table does not contain a second highest salary, the query must return null. The output format is shown below. Example Input: Output: Explanation: The highest salary is 3800. The largest salary strictly less than that is 2230, which is…

Checking your access…