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 trialsevdiye ozlutas
1,453 PointsI am struggling to write a query for this question. What is should be?
the question is not that clear either.
1 Answer
Jeffrey Howard
18,173 PointsHi Sevdiye,
Hopefully you were able to answer this question but with little info we have on what's holding you back, let me try to help point you in the right direction without just giving you the answer. Also refer back to the previous videos if you need a refresher on how to properly type out a SQL query.
Task 1 of 2 In a library database there's a books table. There's a title, author, genre and first_published column.
The library database is connected to a website displaying 10 books at a time, sorted by the title alphabetically.
Write a query to bring back the second page of results. Please retrieve all columns of information.
Your query statement should be selecting all of the columns from the books table. Remember we use the asterisk symbol to select ALL columns. We sort by title alphabetically by using the keyword ORDER BY. To bring back the second page, we then use the keywords LIMIT while also using OFFSET. Please review the previous videos as the instructor does a great job on how to properly type out a query statement with these keywords. Below is a piece of the query statement to help get you started, try finishing off the rest of the query statement.
SELECT * FROM books ORDER BY
With understanding how to properly type out a query statement using these keywords Task 2 of 2 should go a lot smoother. The "retrieving results in particular order" helps understand task 2 when it comes to ORDER BY last name AND first name.
Hopefully this helps. Happy coding!
Jessica Herrera
18,601 PointsJessica Herrera
18,601 PointsWhat is the question?