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 trialMicah Dunson
34,368 Pointstrouble with REPLACE() function
https://teamtreehouse.com/library/reporting-with-sql/working-with-text/replacing-strings
I've tried multiple ways to solve and I just can't seem to nail it down.
The question: In the customers table there's an email column. Write a query that will retrieve all email addresses but will replace the @ symbol with <at> so they all look like andrew<at>teamtreehouse.com. Alias it as obfuscated_email .
My Answer: SELECT * FROM customers WHERE email REPLACE(email, "@", "<at>") AS obfuscated_email;
Any help is much appreciated
1 Answer
Steven Parker
231,261 PointsIt looks like part of your line got mangled because you didn't blockquote it. I'm guessing the last argument of the REPLACE is actually "<at>". If so, the function itself looks good.
But the WHERE clause is for filtering the rows selected, you won't use the REPLACE there. For this challenge, I don't think you need a WHERE clause anyway.
You will put the REPLACE function along with the aliased name in the SELECT clause, where it will serve as a column in the output. You won't be using the asterisk (*) this time. If you needed other columns (you won't here) you would just list them explicitly.
I'll bet you can get it now without an explicit spoiler.
Micah Dunson
34,368 PointsMicah Dunson
34,368 Pointsthanks that was helpful.