将逗号替换为空,计算str长度差

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