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 trialLeslie Perez
993 PointsI keep getting an error with this query
I don't understand what I am doing wrong
Leslie Perez
993 PointsSELECT title, LENGTH(title) AS longest_length FROM books ORDER by longest_length LIMIT 1;
4 Answers
KRIS NIKOLAISEN
54,972 PointsIf you order by longest_length the longest will be at the bottom of the list. If on the other hand you select the books by length in descending order you'll retrieve the correct book.
SELECT title, LENGTH(title) AS longest_length FROM books ORDER by longest_length DESC LIMIT 1;
Leslie Perez
993 PointsThank you!! Can you tell me what I'm doing wrong on this one? SELECT first_name || " " || last_name || " " || <email> AS to_field FROM patrons;
KRIS NIKOLAISEN
54,972 PointsThe angle brackets are not part of the field name for email. They should be concatenated as text.
SELECT first_name || " " || last_name || " <" || email || ">" AS to_field FROM patrons
Leslie Perez
993 PointsAwesome! Thank you!!
Kris C
3,442 PointsJust a quick follow up on this. I also used this :
SELECT title LENGTH(title) AS longest_length FROM books ORDER by longest_length DESC LIMIT 1;
As my answer. However, I did not have the "," after SELECT title and it was counted as wrong. Is there a reason for this?
KRIS NIKOLAISEN
54,972 PointsKRIS NIKOLAISEN
54,972 PointsCan you post your SQL?