in php c'è substr_count. in mysql non mi sembra esista una funzione equivalente.