Total attachments in "tika_1_6" by detected content type

DETECTED_CONTENT_TYPE_A NUM_ATTACHMENTS_TOTAL TOTAL_FILES Average number of attachments per file
application/vnd.ms-powerpoint
210662
12063
17.46 
application/msword
71363
16265
4.39 
application/vnd.ms-excel
3403
7875
0.43 
application/gzip
1597
1596
1.00 
message/rfc822
1334
463
2.88 
application/vnd.openxmlformats-officedocument.presentationml.presentation
1238
35
35.37 
application/pdf
975
52024
0.02 
application/rtf
418
246
1.70 
application/zip
70
49
1.43 
application/vnd.openxmlformats-officedocument.wordprocessingml.document
64
18
3.56 
application/vnd.openxmlformats-officedocument.presentationml.slideshow
7
1
7.00 




SELECT comparisons.DETECTED_CONTENT_TYPE_A, sum(ifnull(NUM_ATTACHMENTS_A, 0)) as NUM_ATTACHMENTS_TOTAL, detected_types_A.NUM_FILES as TOTAL_FILES, printf("%.2f ", (1.0*sum(ifnull(NUM_ATTACHMENTS_A, 0))/detected_types_A.NUM_FILES)) as 'Average number of attachments per file' from comparisons left outer join detected_types_A on comparisons.DETECTED_CONTENT_TYPE_A=detected_types_A.DETECTED_CONTENT_TYPE_A group by comparisons.DETECTED_CONTENT_TYPE_A having NUM_ATTACHMENTS_TOTAL > 0 order by NUM_ATTACHMENTS_TOTAL desc;