SQL включает ряды со значениями 0

# By default, INNER JOIN excludes person_id with no appointments (NULL value, COUNT(NULL)
# returns 0). Can learn/practice more at http://sqlzoo.net/wiki/Using_Null
SELECT person.person_id, COUNT(appointment.person_id) AS "number_of_appointments"
FROM person 
  LEFT JOIN appointment ON person.person_id = appointment.person_id
GROUP BY person.person_id;
Muddy Macaque