How to show N entries in result of a select SQL query to MySQL?
Posted on In TutorialHow to show only N entries in the result of a select SQL query to MySQL?
The select SQL query is:
select * from qa_users;
To limit the N entries (say N = 10), we can use the limit
clause as follows.
SELECT * FROM qa_users LIMIT 10;
Note that it is for MySQL. For some other databases, the corresponding clause/keyword are different. For SQL Server, you may use TOP
and for Oracle Database you can use ROWNUM <= 20
in a WHERE
clause.