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

Not sure about the error message with "("

Not sure about why I kept receiving the same error message with REPLACE function. SELECT email REPLACE (email, <at>, @) AS obfuscated_email From customers WHERE REPLACE (email, <at>, @)=@; (I tried both with " " around <at> and @, but they came up with the same results).

Here is the link to the challenge. https://teamtreehouse.com/library/reporting-with-sql/working-with-text/replacing-strings

1 Answer

Steven Parker
Steven Parker
231,261 Points

You definitely do need the quotes. And it's hard to tell just how close you got because without blockquoting your code, some of the characters will be removed from the display. But here's what I notice:

  • the challenge wants all records, so you won't need a WHERE clause
  • you're returning only the replaced column, so you won't list email separately (you'd need a comma anyway)
  • the @ sign is being replaced, so it must be the second argument.
  • the text you are replacing it with will be the third argument.

Putting that all together, it would look something like...


:warning: SPOILER ALERT


...this:

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

Thank you!