SELECT
MIN(SALARY)
FROM
EMP
WHERE
SALARY in (SELECT
DISTINCT TOP 2 SALARY
FROM
EMP
ORDER BY
SALARY DESC
)
;WITH T AS
(
SELECT *,
DENSE_RANK() OVER (ORDER BY Salary Desc) AS Rnk
FROM Employees
)
SELECT Name
FROM T
WHERE Rnk=2;
Subscribe to:
Post Comments (Atom)
SQL Interview Questions
Common SQL Interview Questions Common SQL Interview Questions 1. JOIN Types INNER JOIN: Only matching row...
-
What Are Bind Variables? Bind variables are placeholders used in SQL statements that are replaced with actual values at runtime . They ...
-
Correlated Sub Query In a Correlated Subquery the inner query is dependent on the Outer Query. You cannot run the inner query independently...
-
Common SQL Interview Questions Common SQL Interview Questions 1. JOIN Types INNER JOIN: Only matching row...
No comments:
Post a Comment