Q:

Spliting MySql value with default function in mysql?

I Have a sitatation like the following:
In MySql Table Entries:
img_id name 

1      aa.jpg             
2      aab.mpeg             
3      aabc.jpg             
4      aabd.jpg             
5      aabn.jpg             
6      aabf.jpg             
7      aadf.jpg             
8      aacf.jpg    

I want the count after splitting thew above values........
like 
".jpg"=>7
".mpeg"=>1

A:

SELECT RIGHT(Name, LOCATE('.', REVERSE(Name)) - 1) Format, 
       COUNT(*) TotalCOunt
FROM   TableName
GROUP  BY RIGHT(Name, LOCATE('.', REVERSE(Name)) - 1)

SQLFiddle Demo

Consider normalizing the table. In the long run, this will perform slow.

