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 SQL Basics Getting Data from a Database Retrieving Specific Columns of Information

Why wouldn't the query here have the last_name before the first_name?

Can somebody tell me why the query wouldn't have the last name column before the first name, as below, since the user is typing in the last name first?

SELECT last_name, first_name FROM <tablename>;

I feel like if the user is typing in the last name, but the query has the information from the first_name column listed first in the query, the user will not get the autocomplete results the question asks for. Can somebody explain why the correct solution provides the autocompleted last names this question asks for if the query has the first_name column information first?

1 Answer

SELECT last_name, first_name FROM <tablename>; does display the last_name column first; I've tested it myself.

When I did that for the Code Challenge Question 5/5 answer, I got a Bummer! stating that the first_name comes first. So I guess this Code Challenge in reality has two answers?

Oh I didn't realize you were talking about the last part of the challenge; I just looked at the 1st part, saw that it worked, and stopped. My bad.

My best guess would be that that part of the challenge is just written that way for whatever reason.