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 trialTaylor Han
2,406 PointsREPLACE function with SQL
Having trouble with new functions and then aliasing. Did I use the REPLACE function correctly? Thanks!
Taylor Han
2,406 PointsSELECT * customers WHERE REPLACE(email, "@", "<at>") AS obfuscated_email;
Here is what I have tried, wanting to pull all emails from a table and replace "@" with "<at>" and alias it. Thanks!
1 Answer
Steven Parker
231,236 PointsYou're using the function correctly, but there are some query syntax issues. The item being selected comes first (in this case, only the modified email), then the alias, and the table after the "FROM" keyword:
SELECT REPLACE(email, "@", "<at>") AS obfuscated_email FROM customers;
You don't need WHERE since you are returning data from every row.
Elijah Quesada
Front End Web Development Techdegree Graduate 32,965 PointsElijah Quesada
Front End Web Development Techdegree Graduate 32,965 PointsPost your code so we can take a look.