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

7 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi donald kaiser! I'm sorry the hints weren't enough, but I'll show you how I did it and try and walk you through it.

Here was my query:

SELECT first_name || " " || last_name || " <" || email || ">" AS to_field FROM patrons;

Order of events:

  • Select first_name
  • concatenate a space
  • concatenate last_name
  • concatenate a space and an angle bracket
  • concatenate email
  • concatenate closed angle bracket.
  • set the alias to to_field
  • specify the table to query

Hope this helps! :sparkles:

donald kaiser
donald kaiser
9,736 Points

Thanks but this isn't working. It's telling me that "Your query needs didn't retireve the emails in the correct format."

It's weird because the speaker didn't really go into depth about this type of thing. Or maybe I missed it. But I'm very confused based on what I saw in the video.

Dear Jennifer,

Thank you for the extra explanation! Your guess is indeed correct. That's exactly how it went haha. I try to learn by typing myself instead of just blindly copy/paste stuff. I will keep your tip in mind for the next time!

Greetings,

Dylan

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! I took a look at the challenge and you are expected to use concatenation. Any time you want to print something literally it should be enclosed in quotes. This means that you will need to concatenate "<" and ">" onto the ends of your email field results.

Hope this helps, but let me know if you're still stuck! :sparkles:

donald kaiser
donald kaiser
9,736 Points

Ok thanks I'll try that.

donald kaiser
donald kaiser
9,736 Points

I'm still lost. I'm at a stand still here. I don't understand where to do this.

donald kaiser
donald kaiser
9,736 Points

Ok ok thanks. The to_field was a bit confusing for me. I understood how he did it in the video but the question was a bit different. Thanks!!!

Dear Jennifer,

Even with your answer you will still get an error. It will say that you miss an extra space between the "last_name and "e-mail" Here is the correct code: SELECT first_name ||" "|| last_name ||" "||"<"|| email ||">" AS to_field FROM patrons; Notice how i added an extra ||" "||.

You pushed me into the right direction though, thank you!

Greetings,

Dylan

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Paul Leenheer Hi there!

I beg to differ. As of the posting of this comment, the code that I posted does, in fact, pass Step 1 of the challenge. But I have a theory as to why you think it doesn't.

My guess here is that you did the smart thing and typed the code in manually instead of copy/pasting. I would be willing to bet that you mistakenly typed: || "<" || instead of || " <" ||. Note the omission of the space in the first string literal. I mentioned in the steps that you need to concatenate a space and an angle bracket You did, however, fix it by using a separate concatenation specifically for the space which works, but is unnecessary.

I'm glad that my explanation helped you to figure out how to do this challenge and I look forward to seeing you around the Community! :sparkles: