OR Operator in SQL

Level 247 keystrokes

OR combines conditions where at least one must be true.

SQL code

-- Returns all columns of users
-- OR keeps a row if at least one condition is true: age below 20 or above 50
1SELECT * FROM users WHERE age < 20 OR age > 50;

Output

+----+-------+-----+
| id | name  | age |
+----+-------+-----+
|  4 | Dan   |  18 |
|  5 | Eve   |  55 |
+----+-------+-----+
2 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.

  • ;× 1
  • *× 1
  • <× 1
  • >× 1

More SQL examples at level 2

← SQL typing practice