sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: How many employees do we have?
SQL: SELECT count(*) FROM Employees;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 role of the employee named Koby?
SQL: SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = "Koby";
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 document ids and receipt dates of documents.
SQL: SELECT document_id ,  receipt_date FROM Documents;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: How many employees does each role have? List role description, id and number of employees.
SQL: SELECT T1.role_description ,  T2.role_code ,  count(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 roles that have more than one employee. List the role description and number of employees.
SQL: SELECT Roles.role_description , count(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING count(Employees.employee_id)  >  1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 document status description of the document with id 1?
SQL: SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: How many documents have the status code done?
SQL: SELECT count(*) FROM Documents WHERE document_status_code = "done";
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 the document type code for the document with the id 2.
SQL: SELECT document_type_code FROM Documents WHERE document_id = 2;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 the document ids for any documents with the status code done and the type code paper.
SQL: SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper";
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 shipping agent of the document with id 2?
SQL: SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: How many documents were shipped by USPS?
SQL: SELECT count(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS";
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: Which shipping agent shipped the most documents? List the shipping agent name and the number of documents.
SQL: 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;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 receipt date of the document with id 3?
SQL: SELECT receipt_date FROM Documents WHERE document_id = 3;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 address was the document with id 4 mailed to?
SQL: SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 mail date of the document with id 7?
SQL: SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS.
SQL: SELECT document_id FROM Documents WHERE document_status_code  =  "done" AND document_type_code = "Paper" EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS";
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS.
SQL: SELECT document_id FROM Documents WHERE document_status_code  =  "done" AND document_type_code = "Paper" INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS";
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 draft detail of the document with id 7?
SQL: SELECT draft_details FROM Document_Drafts WHERE document_id = 7;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: How many draft copies does the document with id 2 have?
SQL: SELECT count(*) FROM Draft_Copies WHERE document_id = 2;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: Which document has the most draft copies? List its document id and number of draft copies.
SQL: SELECT document_id , count(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY count(copy_number) DESC LIMIT 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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: Which documents have more than 1 draft copies? List document id and number of draft copies.
SQL: SELECT document_id , count(*) FROM Draft_Copies GROUP BY document_id HAVING count(*)  >  1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 employees in the circulation history of the document with id 1. List the employee's name.
SQL: SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type description', 'text']]

 -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: reference document status 
columns : [['document status code', 'text'], ['document status description', 'text']]

 -- Table: reference shipping agents 
columns : [['shipping agent code', 'text'], ['shipping agent name', 'text'], ['shipping agent description', 'text']]

 -- Table: documents 
columns : [['document id', 'number'], ['document status code', 'text'], ['document type code', 'text'], ['shipping agent code', 'text'], ['receipt date', 'time'], ['receipt number', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['other details', 'text']]

 -- Table: document drafts 
columns : [['document id', 'number'], ['draft number', 'number'], ['draft details', 'text']]

 -- Table: draft copies 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number']]

 -- Table: circulation history 
columns : [['document id', 'number'], ['draft number', 'number'], ['copy number', 'number'], ['employee id', 'number']]

 -- Table: documents mailed 
columns : [['document id', 'number'], ['mailed to address id', 'number'], ['mailing date', 'time']]

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 the employees who have not showed up in any circulation history of documents. List the employee's name.
SQL: SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id