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 trialJokūbas Maknavičius
7,419 Pointswhat 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
Haytham Badran
216 Points$city = $_REQUEST['city']; // value you get from user from form
SELECT * FROM customer_addresses
WHERE city=$city
4 Answers
BRYANT GOLD
5,475 PointsYou're missing commas in between the columns. Try:
Select zip, city, state, street From customer_addresses
Jokūbas Maknavičius
7,419 Pointsthanks
Millicent Ogutu
12,240 PointsSelect 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
9,310 PointsThe 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
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherIt'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 selectinguser_id
.