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 trial

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

tomd
tomd
16,701 Points

I've tried maybe 10 variations, and I still can't pass.

SELECT title, LENGTH(title) AS longest_length FROM books ORDER BY ASC LIMIT 1;
SELECT title, LENGTH(title) AS longest_length FROM books ORDER BY DESC LIMIT 1;
SELECT title, LENGTH(title) AS "longest_length" FROM books ORDER BY DESC LIMIT 1;
SELECT title, LENGTH(title) AS "longest_length" FROM books ORDER BY ASC LIMIT 1;

Im missing something somewhere..

1 Answer

tomd
tomd
16,701 Points

I found the answer, I had to go back a few videos, find the books database and try out my code there. Its pretty hard to debug in these challenges when you have no feedback and no database to look at.

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

It is a bit tricky to debug in the challenge. But you could run a very similar query in the SQL Playground that you can launch from the video to make sure you have the right syntax. For example SELECT name, LENGTH(name) as longest_length FROM products ORDER BY longest_length DESC LIMIT 1;