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 the Case of Text Columns

Reporting with SQL LOWER(), and UPPER()

Hello!

What does this do? I ask because it returns 'Andrew@teamtreehouse.com' ; SELECT email FROM customers WHERE LOWER( email)='andrew@teamtreehouse.com' ;

Why doesn't this work? ' SELECT email FROM customers WHERE UPPER( email)='andrew@teamtreehouse.com' ;

Why doesn't his work? SELECT email FROM customers WHERE LOWER( email)='Andrew@teamtreehouse.com' ;

LOWER and UPPER function work before the table, but I dont get their importance after FROM <table>

thanks

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

You are applying those functions to the data being pulled from email, correct? The value that is stored in the database is run through the LOWER() and/or UPPER() functions.

So, if inside the database table the email address is stored as "AnDrEw@TeAmTrEeHoUsE.cOm" you could get a match to "andrew@teamtreehouse.com" by using LOWER() or a match to "ANDREW@TEAMTREEHOUSE.COM" by using UPPER(). Both of those functions convert the entire string to their respective format.

Does that answer your question?
Ken