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 1 of 4 We're back in our e-commerce database. There's a products table with the columns id, name, description and price. Can you retrieve both the name and description aliased as "Product Name" and "Product Description".

The columns you selected were named "Product Name", "Product Description" and not
'Product Name' and 'Product Description'.

6 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Challenge Task 1

We're back in our e-commerce database. There's a products table with the columns id, name, description and price.

Can you retrieve both the name and description aliased as "Product Name" and "Product Description".

SELECT name AS "Product Name", description AS "Product Description" FROM products;

Let me know if you are still stuck.

Ken

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Ary;

The basic syntax in SQL for using AS would be:

SELECT name AS "Some other name" FROM table;

If we want to do multiple AS statements we separate them with a comma, just like selecting multiple bits of data, right?

SELECT name_one AS "Name One", name_two AS "Name Two" FROM name_table;

Does that make any sense? You don't want to wrap your column names in the quotes.

Post back if you are still stuck.

Happy coding,
Ken

Mr Ken Cool... SELECT name AS "Product Name", description AS "Product Description" FROM products;

my answer SELECT "Product Name AS Product Description", "Product Description" FROM products;

SELECT Product Name AS "Product Description", "Product Description" FROM products;

SQL Error: near "AS": syntax error

No

SELECT product_name AS "Product Description" FROM products;

SQL Error: near "&": syntax error