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

Challenge Task 3 of 4 We're now back with the smartphone database. In the phone_book we have the columns id, first_name, last_name and phone. Alias the first and last names and phone as "First Name", "Last Name" and "Phone Number".

MY CODE

SELECT 'first_Name' AS "First Name", 'last_Name' AS "Last Name",phone "Phone Number" FROM phone_book;

Bummer! Did you select from the users table?

3 Answers

Steven Parker
Steven Parker
230,248 Points

You don't want to quote the actual column names, that was the problem. The AS keyword is optional, so omitting one would not cause an error. It's probably good to get into the habit of being consistent, though. Try:

SELECT first_Name AS "First Name", last_Name AS "Last Name", phone AS "Phone Number" FROM phone_book;

This would also work:

SELECT first_Name "First Name", last_Name "Last Name", phone "Phone Number" FROM phone_book;

Funny that it thought you were looking at the wrong table!

Jason Berteotti
Jason Berteotti
12,352 Points

While the error hint is incorrect, the problem would appear as you are putting ' ' around your column names.

Missing an AS between phone and Phone Number. Also, be consistent with your quotes, just use one type.

SELECT 'first_name' AS 'First Name', 'last_name' AS 'Last Name', phone AS 'Phone Number' FROM phone_book;

Bummer! Did you select from the users table?

SELECT 'first_name' AS 'First Name', 'last_name' AS 'Last Name', 'phone' AS 'Phone Number' FROM phone_book;