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 trialRyan Jones
1,170 PointsLooking for help with reporting with SQL 2nd question don't understand where you get the OFFSET from.
Hello,
I am currently completing the Reporting with SQL exercise and I'm stuck on this question. Write the SQL query to retrieve the 3rd page of results from the phone_book table. Contacts are ordered by last name and then first name question.
I finding it a bit difficult understanding where you get the OFFSET from.
Here is what I have put so far.
SELECT * FROM phone_book WHERE last_name, first_name ORDER BY last_name AND first_name ASC LIMIT 20 OFFSET 3; SQL Error: near ",": syntax error
Thank you
1 Answer
Steven Parker
231,261 PointsYou have some syntax issues.
You didn't provide a link to the course page, so I'm not sure what you're trying to accomplish, but I see some syntax issues:
- the
WHERE
clause needs complete expressions (such as "last_name = 'Smith'
") - expressions in a
WHERE
clause are joined with logic (AND
/OR
) instead of commas - terms in an
ORDER BY
clause are separated by commas (and not logic)
Steven Parker
231,261 PointsSteven Parker
231,261 PointsIf you click on the box with the 3 dots and select "edit question", you can change the topic to "Databases".