Database: cre_Doc_Template_Mgt

Question: Show all paragraph texts for the document "Customer reviews".
SQL: SELECT T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id WHERE T2.document_name  =  "Customer reviews"

Question: Show all document ids and the number of paragraphs in each document. Order by document id.
SQL: SELECT document_id ,  count(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id

Question: Show all document ids, names and the number of paragraphs in each document.
SQL: SELECT T1.document_id ,  T2.document_name ,  count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id

Question: List all document ids with at least two paragraphs.
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*)  >=  2

Question: What is the document id and name with greatest number of paragraphs?
SQL: SELECT T1.document_id ,  T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1

Question: What is the document id with least number of paragraphs?
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1

Question: What is the document id with 1 to 2 paragraphs?
SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*) BETWEEN 1 AND 2