CREATE TABLE Ref_Template_Types (
    Template_Type_Code TEXT PRIMARY KEY,
    Template_Type_Description TEXT
);
CREATE TABLE Templates (
    Template_ID NUMBER PRIMARY KEY,
    Version_Number NUMBER,
    Template_Type_Code TEXT,
    Date_Effective_From TIME,
    Date_Effective_To TIME,
    Template_Details TEXT,
    FOREIGN KEY ("Template_Type_Code") REFERENCES Ref_Template_Types("Template_Type_Code")
);
CREATE TABLE Documents (
    Document_ID NUMBER PRIMARY KEY,
    Template_ID NUMBER,
    Document_Name TEXT,
    Document_Description TEXT,
    Other_Details TEXT,
    FOREIGN KEY ("Template_ID") REFERENCES Templates("Template_ID")
);
CREATE TABLE Paragraphs (
    Paragraph_ID NUMBER PRIMARY KEY,
    Document_ID NUMBER,
    Paragraph_Text TEXT,
    Other_Details TEXT,
    FOREIGN KEY ("Document_ID") REFERENCES Documents("Document_ID")
);

Question: Show all document names using templates with template type code BK.
SQL: SELECT T2.document_name FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id WHERE T1.template_type_code  =  "BK"

Question: What are the names of documents that use templates with the code BK?
SQL: SELECT T2.document_name FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id WHERE T1.template_type_code  =  "BK"

Question: Show all template type codes and the number of documents using each type.
SQL: SELECT T1.template_type_code ,  count(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id GROUP BY T1.template_type_code

Question: What are the different template type codes, and how many documents use each type?
SQL: SELECT T1.template_type_code ,  count(*) FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id GROUP BY T1.template_type_code

Question: Which template type code is used by most number of documents?
SQL: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id GROUP BY T1.template_type_code ORDER BY count(*) DESC LIMIT 1

Question: Return the code of the template type that is most commonly used in documents.
SQL: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id GROUP BY T1.template_type_code ORDER BY count(*) DESC LIMIT 1

Question: Show all template type codes that are not used by any document.
SQL: SELECT template_type_code FROM Templates EXCEPT SELECT template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id

Question: What are the codes of template types that are not used for any document?
SQL: SELECT template_type_code FROM Templates EXCEPT SELECT template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id  =  T2.template_id

Question: Show all template type codes and descriptions.
SQL: SELECT template_type_code ,  template_type_description FROM Ref_template_types

Question: What are the type codes and descriptions for all template types?
SQL: SELECT template_type_code ,  template_type_description FROM Ref_template_types

Question: What is the template type descriptions for template type code "AD".
SQL: SELECT template_type_description FROM Ref_template_types WHERE template_type_code  =  "AD"

Question: Return the template type description of the template type with the code AD.
SQL: SELECT template_type_description FROM Ref_template_types WHERE template_type_code  =  "AD"

Question: What is the template type code for template type description "Book".
SQL: SELECT template_type_code FROM Ref_template_types WHERE template_type_description  =  "Book"

Question: Return the type code of the template type with the description "Book".
SQL: SELECT template_type_code FROM Ref_template_types WHERE template_type_description  =  "Book"

Question: What are the distinct template type descriptions for the templates ever used by any document?
SQL: SELECT DISTINCT T1.template_type_description FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code  = T2.template_type_code JOIN Documents AS T3 ON T2.Template_ID  =  T3.template_ID

Question: Return the different descriptions for templates that have been used in a document.
SQL: SELECT DISTINCT T1.template_type_description FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code  = T2.template_type_code JOIN Documents AS T3 ON T2.Template_ID  =  T3.template_ID

Question: What are the template ids with template type description "Presentation".
SQL: SELECT T2.template_id FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code  = T2.template_type_code WHERE T1.template_type_description  =  "Presentation"

Question: Return the ids corresponding to templates with the description 'Presentation'.
SQL: SELECT T2.template_id FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code  = T2.template_type_code WHERE T1.template_type_description  =  "Presentation"

Question: How many paragraphs in total?
SQL: SELECT count(*) FROM Paragraphs

Question: Count the number of paragraphs.
SQL: SELECT count(*) FROM Paragraphs

Question: How many paragraphs for the document with name 'Summer Show'?
SQL: SELECT count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_ID  =  T2.document_ID WHERE T2.document_name  =  'Summer Show'

Question: Count the number of paragraphs in the document named 'Summer Show'.
SQL: SELECT count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_ID  =  T2.document_ID WHERE T2.document_name  =  'Summer Show'

Question: Show paragraph details for paragraph with text 'Korea ' .
SQL: select other_details from paragraphs where paragraph_text like 'korea'

Question: What are the details for the paragraph that includes the text 'Korea ' ?
SQL: select other_details from paragraphs where paragraph_text like 'korea'

Question: Show all paragraph ids and texts for the document with name 'Welcome to NY'.
SQL: SELECT T1.paragraph_id ,   T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id WHERE T2.Document_Name  =  'Welcome to NY'

Question: What are the ids and texts of paragraphs in the document titled 'Welcome to NY'?
SQL: SELECT T1.paragraph_id ,   T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id WHERE T2.Document_Name  =  'Welcome to NY'

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: What are the paragraph texts for the document with the name '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: Return the different document ids along with the number of paragraphs corresponding to each, ordered by 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: What are the ids and names of each document, as well as the number of paragraphs in each?
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