Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Reporting with SQL Working with Text Getting the Length of a String

Hi, why is this wrong? select title, length(title) AS longest_length from books order by length limit 1;

Hi I'm struggling to see where I'm wrong for this question. I would be grateful if anyone could provide an explanation or some feedback. Thanks in advance!

1 Answer

Mel Rumsey
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Mel Rumsey
Treehouse Staff

Hey @Cherub you are very close here. :-) so we are wanting to order the books by length, which you aliased as longest_length. What we want to do is ORDER BY longest_length. By default ORDER BY orders the items in ascending order. If we do not specify whether we want it in ASC or DESC order, what you currently have will select the smallest length. So if you add DESC to the end of ORDER BY longest_length and limit that to one that should pass. Great job!