devxlogo

Three Ways to Limit Your Results in SQL Server 2016

Three Ways to Limit Your Results in SQL Server 2016

The query below uses TOP to select the TOP 3 students:

TOPSELECT TOP 3 *FROM Students;

The code below uses LIMIT to only show three records:

SELECT StudentName, StudentPercentageFROM StudentsLIMIT 3;

The query below uses RowNum to only show records 1 to 3

SELECT *FROM StudentsWHERE StudentPercentage  85 AND ROWNUM 

devx-admin

Share the Post: