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

Devin Goodson
Devin Goodson
593 Points

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

Is this the right query?

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,163 Points

There are two solutions:

(1) Include last_name in both your conditions

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

(2) Use the IN operator

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