Can you tell me the location code with the most documents?
select location_code from document_locations group by location_code order by count ( * ) desc limit 1
Yes, please.
select count ( * ) from document_locations where location_code = 'x'
How about the location code with the least documents?
select location_code from document_locations group by location_code order by count ( * ) limit 1