Limiting Results

SQL: SELECT: Reporting

SQLite, PostgreSQL and MySQL:

To limit the number of results returned, use the LIMIT keyword.

MS SQL:

To limit the number of results returned, use the TOP keyword.

Oracle:

To limit the number of results returned, use the ROWNUM keyword in a WHERE clause.

// SQLite, PostgreSQL and MySQL: 

SELECT <columns> FROM <table> LIMIT <# of rows>;

//MS SQL:

SELECT TOP <# of rows> <columns> FROM <table>;

//Oracle:

SELECT <columns> FROM <table> WHERE ROWNUM <= <# of rows>;