AND Operator in SQL

Level 248 keystrokes

AND combines multiple conditions that must all be true.

SQL code

-- Returns all columns of users
-- AND requires both conditions: age above 20 and below 40
1SELECT * FROM users WHERE age > 20 AND age < 40;

Output

+----+-------+-----+
| id | name  | age |
+----+-------+-----+
|  1 | Alice |  25 |
|  2 | Bob   |  30 |
|  3 | Carol |  35 |
+----+-------+-----+
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.

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

More SQL examples at level 2

← SQL typing practice