Sql Top Command

Sql Top Command

  • Sql Select Top Clause returns a specific number of rows from the SELECT statement.
  • It is very much like the SET ROWCOUNT function for that reason.
  • It is usually used with order by clause
  • The Select Top command is used MSSQL and Access database.
  • If we add PERCENT Clause after “top clause”,than The specified percentage of records is bring.

Sql Top Command Syntax

or

or

Note:WITH TIES can only be used with an ORDER BY. If you specify you want to return TOP 10 rows, and the 11th row has the same value as the 10th row on those columns that have been defined in the ORDER BY, then the 11th row will also be returned. Same for subsequent rows, until you get to the point that the values differ.

Select Top Command Examples on Library Database

Example 1: List 10 books, that has the highest page count.

Example 2: List the autor, whose name has the most letters

Example 3: List the author that has the most books.

YOU MAY WANT TO SEE OUR ALL EXAMPLES PAGE, THEN CLICK HERE

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: