WHERE Clause in SQL

Level 235 keystrokes

WHERE clause filters rows based on a condition.

SQL code

-- Returns all columns (*) of the users table
-- WHERE keeps only rows whose age is greater than 18
1SELECT * FROM users WHERE age > 18;

Output

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

More SQL examples at level 2

← SQL typing practice