Show all document ids and the number of paragraphs in each document. Order by document id.
create table paragraphs (document_id varchar, PRIMARY KEY (document_id))
select document_id, count(*) from paragraphs group by document_id order by document_id