String Equality in SQL

Level 241 keystrokes

Use single quotes for string values in WHERE conditions.

SQL code

-- Returns all columns of users
-- WHERE name = 'Alice' keeps rows whose name is exactly 'Alice' (strings in single quotes)
1SELECT * FROM users WHERE name = 'Alice';

Output

+----+-------+-----+
| id | name  | age |
+----+-------+-----+
|  1 | Alice |  25 |
+----+-------+-----+
1 row 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.

  • '× 2
  • ;× 1
  • *× 1
  • =× 1

More SQL examples at level 2

← SQL typing practice