The COUNT function

The following query counts and displays the total number of rows in the stock table.
Figure 1: Query
SELECT COUNT(*) FROM stock;
Figure 2: Query result
(count(*))

   73
The following query includes a WHERE clause to count specific rows in the stock table, in this case, only those rows that have a manu_code of SHM.
Figure 3: Query
SELECT COUNT (*) FROM stock WHERE manu_code = 'SHM';
Figure 4: Query result
(count(*))

   17
By including the keyword DISTINCT (or its synonym UNIQUE) and a column name in the following query, you can tally the number of different manufacturer codes in the stock table.
Figure 5: Query
SELECT COUNT (DISTINCT manu_code) FROM stock;
Figure 6: Query result
(count)

   9