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!
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 trial
Robbie Thomas31,093 Points
Getting the length of a string
Not exactly sure what they want here. This is my answer:
SELECT books, LENGTH(title) AS "longest_length" FROM title ORDER BY length DESC LIMIT 1;
Gabriel Plackey11,064 Points
Okay, a few things. first, you don't need the quotes around longest_length or around any alias. its just name AS nm. Ya know. Secondly were taking the title from the table books, not the column books from the table title. And sine we want the length of the title as well. Were selecting title twice, one is going to the length.
SELECT title, length(title) as longest_length FROM books order by longest_length desc limit 1;