Databases Reporting with SQL Ordering, Limiting and Paging Results Limiting Results

Dinesh Dewnarain
Dinesh Dewnarain
1,089 Points

Limit rows

select * from books where genre = "Fantasy" order by first_published asc limit 5 of rows;

please help

1 Answer

Eric Butler
Eric Butler
32,468 Points

Your statement should work if you just remove "of rows":

select * from books where genre = "Fantasy" order by first_published asc limit 5;
Dinesh Dewnarain
Dinesh Dewnarain
1,089 Points

Worked as a charm!

I was following this example: SELECT <columns> FROM <table> WHERE ROWNUM <= <# of rows>;