title: Given a list, how to get the count from mysql table?
body: <p>Given a string list, I want to get the count of each item from the table. However, I don't know how to get the count(0) of item which does not exist in the table.</p>
  <p>for example, I have a table as follow.</p>
  <pre><code>id   name      score
  ------------------------
  1    aaa       10
  2    ccc       20
  3    aaa       10
  4    ddd       15
  </code></pre>
  <p>Given a list [&quot;aaa&quot;, &quot;bbb&quot;, &quot;ccc&quot;] , I hope a query can return me a result like</p>
  <pre><code>aaa 2
  bbb 0
  ccc 1
  </code></pre>
  <p>I tried &quot;select name, count(*) from table where name in (&quot;aaa&quot;, &quot;bbb&quot;, &quot;ccc&quot;) group by name;&quot;, but the result is without the count of &quot;bbb&quot;. Can I do it in a single query?</p>