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

what is wrong with my code SQL

what is wrong with my code sql

In the e-commerce database there's a customer_addresses table with the following columns: id, nickname, street, city, state, zip, user_id.

Select all the columns that are to do with the address. For example, all columns except id, nickname and user_id.

select user_id zip city state street from customer_addresses SQL Error: near "city": syntax error

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

It'd be really helpful to have a link to the challenge. But I can tell you this so far. The instructions that you posted say not to select user_id, but you are selecting user_id. :sparkles:

$city = $_REQUEST['city']; // value you get from user from form

SELECT * FROM customer_addresses WHERE city=$city

4 Answers

You're missing commas in between the columns. Try:

Select zip, city, state, street From customer_addresses

thanks

Select street, city, state, zip From customer_addresses. Your answer has to be in specific order just the same way you would write your address.

Hunter Phillips
Hunter Phillips
9,310 Points

The problem with this challenge is that a specific order is required (street, city, state, zip) even though that's not made explicitly clear in the question