select id, LENGTH(string)-LENGTH(REPLACE(string,',','')) as cnt
from strings;