title: Using SQL COUNT(*) and Only Return Results with Valid Count
body: <p>I have a student table with columns:</p>
  
  <p>student_name | Email | teacher_id | teacher_name</p>
  
  <p>The goal is to count the number of students each teacher has.</p>
  
  <pre><code>SELECT teacher_id, COUNT(*) AS active_students
  FROM students
  GROUP BY teacher_id;
  </code></pre>
  
  <p>Using the above SQL, I am able to get the number of counts for each teacher ID.
  However, when I include the teacher_name, I will get an error. Each student may have the same teacher_id if they share the same teacher and some students have NULL teacher_id if they did not register for a class.</p>
  
  <p>How do I change my query so that I can count the number of students each teacher_id has and also include other columns on the same table?</p>