COUNT Function in SQL

Level 236 keystrokes

COUNT(*) returns the total number of rows in a table.

SQL code

-- COUNT(*) counts every row of users, even rows that contain NULL values
-- AS total names the result column total
1SELECT COUNT(*) AS total FROM users;

Output

+-------+
| total |
+-------+
|     5 |
+-------+
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.

  • ;× 1
  • (× 1
  • )× 1
  • *× 1

More SQL examples at level 2

← SQL typing practice