Skip to content

Commit ebf15f1

Browse files
committed
today is commit Task
1 parent c7fb90f commit ebf15f1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

177. Nth Highest Salary.sql

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Order By Clause
3+
* ORDER BY order_by_expression
4+
[ COLLATE collation_name ]
5+
[ ASC | DESC ]
6+
[ ,...n ]
7+
[ <offset_fetch> ]
8+
9+
<offset_fetch> ::=
10+
{
11+
OFFSET { integer_constant | offset_row_count_expression } { ROW | ROWS }
12+
[
13+
FETCH { FIRST | NEXT } {integer_constant | fetch_row_count_expression } { ROW | ROWS } ONLY
14+
]
15+
}
16+
*/
17+
18+
Create FUNCTION getNthHighestSalary(@N INT) returns INT as
19+
BEGIN
20+
Return(
21+
Select Salary
22+
From Employee
23+
Gourp By Salary
24+
Order By Salary DESC
25+
Offset @N-1 rows
26+
Fetch First 1 Rows Only
27+
);
28+
End

0 commit comments

Comments
 (0)