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 trialchris Gougherty
1,683 PointsIssues understanding what is wrong with my code
Hello, I am having issues understanding what is wrong with this code. From my understanding i would assume this would be correct as i have renamed the column and have replaced the values as they need to be replaced based on the previous lessons. could i please get some help in understanding what is wrong with this code.
select email as obfuscated_email from customers where replace(email, "@", "<at>") = "<at>";
I have also tried the code
select replace(email, "@", "<at>") as obfuscated_email from customers where replace(email, "@", "<at>") = "<at>";
this code hasnt worked any better so i am unsure as to what is the problem
1 Answer
Steven Parker
231,236 PointsSince the instructions say to replace all email addresses, you are not filtering the results and won't need a WHERE clause here. And to modify the column content, call the function as part of the SELECT clause:
SELECT replace(email, "@", "<at>") AS obfuscated_email FROM customers;