Selecting top records only

You can select the top n records or the top n percent of the Employee table, instead of the whole table. For example:

SELECT TOP 3 * FROM Employee;

SELECT TOP 20 PERCENT * FROM Employee ORDER BY Age;

The first example returns the first 3 records only and the second example the youngest 20% of employees. To return the oldest 20%, order the table in reverse:

SELECT TOP 20 PERCENT * FROM Employee ORDER BY Age DESC;

See also:

Next topic - Applying a condition

Selecting records - the basics

Other types of SQL statements