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

Oskar Pihlak
Oskar Pihlak
2,094 Points

REPLACE problem

n 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 .

Bummer! Try again!

SELECT email FROM customers WHERE REPLACE(email,"@","<at>");

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

It looks like you have this almost right but you don't need the WHERE clause. you need to find somewhere to put your aliased column name.

Try aliasing the email column when you SELECT it in your SQL.

SELECT REPLACE(email, "@", "<at>") as obfuscated_email FROM customers;
Amir Eskandari
Amir Eskandari
9,153 Points

Hi Oscar,

You are very close, but the problem wants you to add the REPLACE statement within your SELECT. So, move your code around a bit like so:

SELECT REPLACE(email,"@","<at>") AS obfuscated_email FROM customers;

You don't need a "WHERE" statement for this problem. Also don't forget the add the alias of "obfuscated_email"!

I hope this helps.