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
Krystel Hagan
4,731 PointsCreating the Products Table
Q: Write the SQL query to select 'name' and the 'price' from the 'products' table.
A: SELECT * FROM products WHERE (name, price)
This seems like such a simple question, how come I cannot figure it out.
2 Answers
Kevin Kenger
32,834 PointsHey Krystel,
I think you might be overthinking it!
Try this:
SELECT name, price FROM products;
PS. It's awesome that you're from Arizona.
Mike Costa
Courses Plus Student 26,362 PointsSELECT is where you choose what to select from the table. WHERE is when you want to specify something associated with what you're selecting.
SELECT name FROM Users WHERE email = 'Krystel@someemail.com'
This query would return the name in the row of the database where the WHERE condition is met.
Krystel Hagan
4,731 PointsKrystel Hagan
4,731 PointsThank you so much! And its awesome 3/4 of the time.
Kevin Kenger
32,834 PointsKevin Kenger
32,834 PointsHa! If that. It's only awesome if your air conditioner works. But you're the first local I've run into on Treehouse so I got all giddy.
Krystel Hagan
4,731 PointsKrystel Hagan
4,731 PointsYou are also the first local I have met through here! Its nice to know that at least someone else around here is learning the same way I am lol :)
Kevin Kenger
32,834 PointsKevin Kenger
32,834 PointsHaha I know what you mean. But at the same time, I feel like I'm exclusive and better than everyone else for learning this way haha :)
Bjorn Beishline
14,753 PointsBjorn Beishline
14,753 PointsI am from AZ