Answers for "sql include rows with 0 values"

SQL
0

sql include rows with 0 values

# 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;
Posted by: Guest on December-21-2021

Code answers related to "sql include rows with 0 values"

Code answers related to "SQL"

Browse Popular Code Answers by Language