## 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.

# We're using library database again. There's a books table. There's a title, author, genre and first_published column.

We're using library database again. There's a books table. There's a title, author, genre and first_published column. Write a query to obtain the first 5 books in the Fantasy genre ordered by the year released. Oldest first. Select all rows.

Hey there,

first you have to get all the books with the genre of "Fantasy" using a `WHERE` clause. After that you have to order them using the `ORDER BY` keywords by the year they were published, beginning with the oldest ones, which means that you have to use the `ASC` keyword in the end. In the end you should specify that you only want to have the first 5 books of the results which you can achieve by using the `LIMIT` keyword with the value 5.

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

I hope that helps! :)

Hi Tobias (or another person), Why is this version of the query incorrect? In other words, why must LIMIT 5 go at the end? I'm telling the query the exact same information, just in a different order.

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

Thank you. This was helpful since it helps to understand the step by step logical process thought.

I put AND between all the conditions. Why did that not work?

SELECT * FROM books WHERE genre = "Fantasy" ORDER BY first_published LIMIT 5; You need to get rid of the ASC keyword. you can try this.I think its the right one.

Try:

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

Why is this quiz asking us to answer things not covered? When was it that we were told we can specify a string for the genre or the 'column'?

SELECT * FROM books WHERE genre = "Fantasy" ORDER BY genre asc, title asc LIMIT 5;