Sql limit

This article is tagged with: Sql limit and mysql

sql limit

LIMIT 5

sql limit to 5 results

SELECT expressions
FROM tables
[WHERE conditions]
[ORDER BY expression [ ASC | DESC ]]
LIMIT number_rows [ OFFSET offset_value ];

How to display top 50 rows?

In MySQL, top 50 rows are displayed by using this following query:
SELECT * FROM
LIMIT 0, 50;

rownum in sql

SELECT ROWNUM, a.*
FROM (SELECT customers.*
FROM customers
WHERE customer_id > 4500
ORDER BY last_name) a;

select top 1000 sql server

SELECT TOP 1000 *
FROM Customer;

This article is tagged with: Sql limit and mysql