Does SQL Server support the bottom command?
No, SQL Server doesn’t support BOTTOM.
First,
We always need order by clause when using TOP or BOTTOM(if it is supported).
If without ORDER BY ,results of SELECT BOTTOM N would be exactly the same as results of SELECT TOP N - undefined.
Second,
The result of SELECT BOTTOM N ... ORDER BY ... ASC
is exactly the same as result of SELECT TOP N ... ORDER BY ... DESC
.
So, there is no need to have two key words that do the same thing.
Actually, TOP is used to limit results to specific number of rows.
As for another similar function keyword 'OFFSET', it is ANSI standard and it adds pagination.
Please refer to this document for more details of OFFSET and ORDER BY.
What I'm curious about is what situation makes you think Select TOP Order By [ASC/DESC] does not make sense
If you want to retrieve TOP and BOTTOM Rows Together,please refer to this link .
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.