SQL Knowledge Center · About ·
Easy Interactive Online SQL Training for Beginners

SQL IN Tutorial - Interactive Database Lesson

Lesson 8 of 31

IN

Interactive SQL Tutorial

Using the WHERE clause, we can find rows where a value is in a list of several possible values.

SELECT * FROM friends_of_pickles WHERE species IN ('cat', 'human'); would return the friends_of_pickles that are either a cat or a human.

To find rows that are not in a list, you use NOT IN instead of IN.

Can you run a query that would return the rows that are not cats or dogs?

SQL:

Query Result:

Available Tables: