Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Reporting with SQL

Hi I cant seem to figure out Challenge Task 1 0f 2 Limiting results out please help.

2 Answers

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey there,

first you have to select all rows from the books table. Then you have to specify the genre you're looking for in the where clause, which is "Fantasy" in this case. After that you want to order the books in an ascending order by when they were first published. Finally you use the limit keyword to limit the results to 5 books.

Like so:

SELECT * FROM books WHERE genre = "Fantasy" ORDER BY first_published ASC LIMIT 5;

I hope that helps, if you have further questions feel free to ask! :)

Thank U