/* allows you to select the first number of rows from a table.
Good for seing what's in the table (columns, etc.) without having to pull the whole table.
If you use with an ORDER BY clause, it'll have to read the entire table, sort, and then selet the TOP number of rows.
Therefore, there isn't a cost savings if you use TOP with an ORDER BY that is not the index column.
*/
--the full standard uses () around the number in the top
SELECT TOP (20) * FROM customers1;
-- however, you can omit the (), but that is apparently only for backward compatibility - it's safer to use ()
SELECT TOP 50 * FROM customers1;
--you can also specify a percent
--SQL Server will round up (ceiling) if the percentage returns a decimal place.
--example: if 5% of your table is 9.2 rows, it'll return 10 rows
SELECT TOP (5) PERCENT * FROM t_appeal;