TOP SQL Tutorial

TOP Syntax:

SELECT TOP number column_name(s) FROM table_name
SELECT TOP percent column_name(s) FROM table_name

Employee table:

EMPLOYEE_IDNAMEDEP_ID
1EMPLOYEE_121
2EMPLOYEE_222
3EMPLOYEE_323
4EMPLOYEE_424

TOP number Example:

SELECT TOP 3 * FROM employee;

TOP Result:

EMPLOYEE_IDNAMEDEP_ID
1EMPLOYEE_121
2EMPLOYEE_222
3EMPLOYEE_323

TOP percent Example:

SELECT TOP 50 PERCENT * FROM employee;

TOP Result:

EMPLOYEE_IDNAMEDEP_ID
1EMPLOYEE_121
2EMPLOYEE_222