sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the total access count of all documents in the most popular document type.
SQL: SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the total access count of documents that are of the most common document type?
SQL: SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the average access count of documents?
SQL: SELECT avg(access_count) FROM documents
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the average access count across all documents?
SQL: SELECT avg(access_count) FROM documents
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the structure of the document with the least number of accesses?
SQL: SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code  =  t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Return the structure description of the document that has been accessed the fewest number of times.
SQL: SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code  =  t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the type of the document named "David CV"?
SQL: SELECT document_type_code FROM documents WHERE document_name  =  "David CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Return the type code of the document named "David CV".
SQL: SELECT document_type_code FROM documents WHERE document_name  =  "David CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the list of documents that are both in the most three popular type and have the most three popular structure.
SQL: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY count(*) DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of documents that have both one of the three most common types and one of three most common structures?
SQL: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY count(*) DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What document types do have more than 10000 total access number.
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count)  >  10000
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Return the codes of the document types that do not have a total access count of over 10000.
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count)  >  10000
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are all the section titles of the document named "David CV"?
SQL: SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code WHERE t1.document_name  =  "David CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Give the section titles of the document with the name "David CV".
SQL: SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code WHERE t1.document_name  =  "David CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find all the name of documents without any sections.
SQL: SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections)
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of documents that do not have any sections?
SQL: SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections)
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List all the username and passwords of users with the most popular role.
SQL: SELECT user_name ,  password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the usernames and passwords of users that have the most common role?
SQL: SELECT user_name ,  password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the average access counts of documents with functional area "Acknowledgement".
SQL: SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code  =  t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code  =  t3.functional_area_code WHERE t3.functional_area_description  =  "Acknowledgement"
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the average access counts of documents that have the functional area description "Acknowledgement"?
SQL: SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code  =  t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code  =  t3.functional_area_code WHERE t3.functional_area_description  =  "Acknowledgement"
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find names of the document without any images.
SQL: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code JOIN document_sections_images AS t3 ON t2.section_id  =  t3.section_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of documents that do not have any images?
SQL: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code JOIN document_sections_images AS t3 ON t2.section_id  =  t3.section_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the name of the document with the most number of sections?
SQL: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Return the name of the document that has the most sections.
SQL: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code  =  t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List all the document names which contains "CV".
SQL: SELECT document_name FROM documents WHERE document_name LIKE "%CV%"
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of documents that contain the substring "CV"?
SQL: SELECT document_name FROM documents WHERE document_name LIKE "%CV%"