IN Operator in SQL

Level 261 keystrokes

IN operator checks if a value matches any value in a list.

SQL code

1SELECT
-- Returns the name of each matching user
2 name
3FROM
4 users
5WHERE
-- IN keeps rows whose status is 'active' or 'pending'
-- Shorter than status = 'active' OR status = 'pending'
6 status IN ('active', 'pending');

Output

+-------+
| name  |
+-------+
| Alice |
| Bob   |
| Carol |
+-------+
3 rows in set
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this SQL code and how often they appear.

  • '× 4
  • ,× 1
  • ;× 1
  • (× 1
  • )× 1

More SQL examples at level 2

← SQL typing practice