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

Databases

Ondřej Straňanek
Ondřej Straňanek
19,637 Points

Find the earliest Science Fiction book in our library..

SELECT * FROM books WHERE genre = "Fiction" ORDER BY genre DESC, first_published ASC LIMIT 1;

That's my code and I don't know - what's wrong there, I tried many options, but sad nothing works.

https://teamtreehouse.com/library/reporting-with-sql/ordering-limiting-and-paging-results/limiting-results

Challenge Task 2 of 2

Thanks for any help!

2 Answers

They wanted "Science Fiction", not Fiction, and to order by ascending.

SELECT * FROM books WHERE genre = "Science Fiction" ORDER BY genre ASC, first_published LIMIT 1;
Steven Parker
Steven Parker
229,920 Points

:point_right: The genre you are looking for is "Science Fiction" (not just "Fiction").

Also, you don't need to include genre in the ORDER BY clause, since you are limiting the output to a single genre (and a single book).