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

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,164 Points

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:

SELECT * FROM users
WHERE last_name = "Hinkley"
OR last_name = "Pettit";

or

SELECT * FROM users
WHERE last_name IN ("Hinkley", "Pettit");

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

Adam Dąbrowski
Adam Dąbrowski
1,988 Points

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