Can we use top in SQL Server?
Select top in MS SQL ServerPrerequisite Select in MS SQL Server Syntax Attention reader! Dont stop learning now. Learn SQL for interviews usingSQL Course by GeeksforGeeks. Analyzing the Syntax
The order by clause is used for arranging the data in a chronological order. It is mandatory to use this clause in syntax otherwise, it results in an error. Example Output
This way the desired data can be extracted. The last row student has a gpa of 7.7 and if there are a few more students that share the same numbers, the query must be written as select top 8 with ties name rollnumber gpa from student order by name ASCOutput
ASC arranges the data from ascending to descending order. DESC can be used if the data has to be arranged from descending to ascending order.
Article Tags :
DBMS SQL
DBMS-SQL mysql Practice Tags :
DBMS SQL
Read Full Article
|