It would be useful to indicate which database you want to configure. Different databases have different syntax and methods for achieving this:
For example, in Oracle, you can do this by setting the condition to RowNum ( select ... from ... where ... rownum < 11 โ will output the first 10 entries)
In MySQL you can use you can use the limit clause.
Microsoft SQL Server => SELECT TOP 10 column FROM table
PostgreSQL and MySQL => SELECT column FROM table LIMIT 10
Oracle => select * from (SELECT column FROM table ) WHERE ROWNUM <= 10 (thanks to styles)
Sybase => SET rowcount 10 SELECT column FROM table
Firebird => SELECT FIRST 10 column FROM table
NOTE. Modern ORM tools such as Hibernate provide high-level APIs (Query, Restriction, Condition) that abstract the logic of the top n lines based on the dialect you select.
Rutesh Makhijani May 17 '09 at 7:34 a.m. 2009-05-17 07:34
source share