I am struggling to write a query for this question. What is should be?
the question is not that clear either.
Jeffrey Howard17,078 Points
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!