Skip to content

Commit 808b208

Browse files
committed
Print K largest/smallest element
1 parent 52ee5dc commit 808b208

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

4. Sorting.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ select name from student order by Left/Right(name,n),ID;
1919
-- where marks is the constraint.
2020
select Name from STUDENTS where Marks>75 order by right(Name,3),ID ;
2121

22-
-- (NEWW_COMMIT)
2322
-- fetching in alphabetical order (Use Asc keyword.)
2423
select name from student order by name ASC;
2524

25+
-- (NEWW_COMMIT)
26+
-- find kth largest element
27+
select salary from TABLE order by salary limit 1 offset k-1;
28+
29+
( limit 1 = only one row ).
30+
( offset k-1 = ignore first k-1 element ).
31+

0 commit comments

Comments
 (0)