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 trialNomore Majuru
7,881 Pointsdatabase
We're still using the library database with the books table. There's a title, author, genre and first_published column.
Find the earliest Science Fiction book in our library. Only one result should be returned. All columns should be selected.
1 Answer
KRIS NIKOLAISEN
54,971 PointsJust break it down to what is being asked:
1.Find the earliest Science Fiction book in our library. For earliest you'll need to order by a date (first_published). For Science Fiction you'll need to filter your results by genre.
2.Only one result should be returned. This is what LIMIT is for. It allows you to specify the number of records to return.
3.All columns should be selected. Using SELECT * will select all columns.
SELECT * FROM books WHERE genre = "Science Fiction" ORDER BY first_published LIMIT 1;