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 Finding the Data You Want Searching Tables with 'WHERE'

I do not understand the concept of WHERE (column, operator and value is put)

During challenge 1 of 3 I did not understand where I was going wrong, can you explain what the end result would have been

2 Answers

Steven Parker
Steven Parker
229,732 Points

A "WHERE" clause generally contains a comparison expression that limits which rows will be included in the output.

In this case, the instructions say where the username is equal to "wig_lady", so the clause added on to the end of the SELECT would look like: "WHERE username = 'wig_lady'".

For more specific answers, always show your complete query with your question.

Rahul Saini
Rahul Saini
4,611 Points

select first_name,last_name from users where username = 'wig_lady'. Let me break it down for you. SQL Queries are based on a simple idea like.

Select { What you are looking for in a table ,(I believe you already know that) }
From { From which table you expect to receive the data }
Where { All the conditions that will distinguish the desired result }
          -- In this case you want first and last name of a person who has username as 'wig_lady'