What's the number of documents each shipping agent shipped?
select ref_shipping_agents.shipping_agent_name, count(documents.document_id) from ref_shipping_agents join documents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code group by ref_shipping_agents.shipping_agent_code;
Which agent shipped the least number of documents?
select ref_shipping_agents.shipping_agent_name, count(documents.document_id) from ref_shipping_agents join documents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code group by ref_shipping_agents.shipping_agent_code order by count(documents.document_id) asc limit 1;
How about the most number of documents?
select ref_shipping_agents.shipping_agent_name, count(documents.document_id) from ref_shipping_agents join documents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code group by ref_shipping_agents.shipping_agent_code order by count(documents.document_id) desc limit 1;