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 Changing Cases of Strings

Challenge 1 of 2 - Upper/ Lower

I'm not getting this challenge right, can you please help.

The question asks: In a library database there's a books table. There's an id, title, author, genre and first_published column. Write a query that will return only the title and author. Bring back the title in lowercase and the author in uppercase. Alias them as lowercase_title and uppercase_author respectively.

Below is one example of what I have tried. What am I getting wrong? Thanks.

SELECT title LOWER(title), author UPPER(author) AS 'lowercase_title', 'uppercase_author' FROM books;

1 Answer

Steven Parker
Steven Parker
231,248 Points

You're pretty close, but in both cases, you should put the field name as the argument to the function, but not also by itself. And each column alias must be applied individually instead of both at the same time:

SELECT LOWER(title) AS 'lowercase_title', UPPER(author) AS 'uppercase_author' FROM books;

Ah! Steven, thanks for clearing that up! Much appreciated!