Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases SQL Basics Finding the Data You Want Filtering on More than One Condition

kimberly moyer
kimberly moyer
1,773 Points

unsure on error

hi i need help correcting the sql statement

Can you post your SQL statement?

1 Answer

For the first challenge we need to do the following:

Find all the matches in the results table where "Hessle" was playing away as the away team and their score was above 18 points.

I emphasized the keywords in the sentence that will help determine what is necessary:

SELECT * FROM results
WHERE away_team = "Hessle"
AND away_score > 18;

For the second challenge we need to:

Find all users with either the last name "Hinkley" or "Pettit".

We can get the users with a last_name of "Hinkley" or "Pettit" in a few ways:

WHERE last_name = "Hinkley"
OR last_name = "Pettit";


WHERE last_name IN ("Hinkley", "Pettit");

This one will return users whose last name is in the provided list of names.

I think U shuld not give full answer already.. Learning means trying....