select
id,
length(string)-length(replace(string,",","")) as cnt
from strings