TOP

TOP is a keyword in SQL that is used to specify the number of records to return from a query or view. It can be particularly useful for limiting the number of rows in the result set of a query.

Example

SELECT TOP 3 * FROM Orders;

Output

OrderID | CustomerID | EmployeeID | OrderDate
---------------------------------------------------
10248 | 90 | 5 | 1996-07-04
10249 | 81 | 6 | 1996-07-05
10250 | 34 | 4 | 1996-07-08

Explanation

The TOP keyword is used to specify the number of records to return from top of the dataset. In the given example, the first 3 records from the Orders table are returned.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.