Retrieving Information from a Table Earlier, you retrieved the names of the people who owned pets. You can use  COUNT()  if you want to find out how many pets each owner has: The preceding query uses  GROUP BY  to group all records for each  owner . The use of  COUNT()  in conjunction with  GROUP BY  is useful for characterizing your data under various groupings. The following examples show different ways to perform animal census operations. Number of animals per species: Number of animals per sex: (In this output,  NULL  indicates that the sex is unknown.) Number of animals per combination of species and sex: 322 mysql>  SELECT owner, COUNT(*) FROM pet GROUP BY owner; +----------+ | COUNT(*) | +----------+ | 9 | +----------+ mysql>  SELECT species, COUNT(*) FROM pet GROUP BY species; mysql>  SELECT sex, COUNT(*) FROM pet GROUP BY sex; mysql>  SELECT species, sex, COUNT(*) FROM pet GROUP BY species, sex; +--------+----------+ | owner | COUNT(*) | +--------+----------+ | Benny | 2 | | Diane | 2 | | Gwen | 3 | | Harold | 2 | +--------+----------+ +---------+----------+ | species | COUNT(*) | +---------+----------+ | bird | 2 | | cat | 2 | | dog | 3 | | hamster | 1 | | snake | 1 | +---------+----------+ +------+----------+ | sex | COUNT(*) | +------+----------+ | NULL | 1 | | f | 4 | | m | 4 | +------+----------+ +---------+------+----------+ | species | sex | COUNT(*) | +---------+------+----------+ | bird | NULL | 1 | | bird | f | 1 | | cat | f | 1 | | cat | m | 1 | | dog | f | 1 | | dog | m | 2 | | hamster | f | 1 | | snake | m | 1 | +---------+------+----------+