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

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the id of the employee named Ebba.
SQL: SELECT employee_ID FROM Employees WHERE employee_name  =  "Ebba"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the names of all the employees with role "HR".
SQL: SELECT employee_name FROM Employees WHERE role_code  =  "HR"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 employees have the role with code "HR"? Find their names.
SQL: SELECT employee_name FROM Employees WHERE role_code  =  "HR"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show all role codes and the number of employees in each role.
SQL: SELECT role_code ,  count(*) FROM Employees GROUP BY role_code
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 code of each role and the number of employees in each role?
SQL: SELECT role_code ,  count(*) FROM Employees GROUP BY role_code
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 code with the largest number of employees?
SQL: SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 code of the role that have the most employees.
SQL: SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show all role codes with at least 3 employees.
SQL: SELECT role_code FROM Employees GROUP BY role_code HAVING count(*)  >=  3
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 roles with three or more employees? Give me the role codes.
SQL: SELECT role_code FROM Employees GROUP BY role_code HAVING count(*)  >=  3
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the role code with the least employees.
SQL: SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 with the smallest number of employees? Find the role codes.
SQL: SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the names of employees with role name Editor.
SQL: SELECT T1.employee_name FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code  =  T2.role_code WHERE T2.role_name  =  "Editor"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 names of all the employees whose the role name is "Editor".
SQL: SELECT T1.employee_name FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code  =  T2.role_code WHERE T2.role_name  =  "Editor"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the employee ids for all employees with role name "Human Resource" or "Manager".
SQL: SELECT T1.employee_id FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code  =  T2.role_code WHERE T2.role_name  =  "Human Resource" OR T2.role_name  =  "Manager"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 employee ids of the employees whose role name is "Human Resource" or "Manager"?
SQL: SELECT T1.employee_id FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code  =  T2.role_code WHERE T2.role_name  =  "Human Resource" OR T2.role_name  =  "Manager"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 different location codes for documents?
SQL: SELECT DISTINCT location_code FROM Document_locations
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 me all the distinct location codes for documents.
SQL: SELECT DISTINCT location_code FROM Document_locations
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the location name for document "Robin CV".
SQL: SELECT T3.location_name FROM All_documents AS T1 JOIN Document_locations AS T2 ON T1.document_id  =  T2.document_id JOIN Ref_locations AS T3 ON T2.location_code  =  T3.location_code WHERE T1.document_name  =  "Robin CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 location name of the document "Robin CV"?
SQL: SELECT T3.location_name FROM All_documents AS T1 JOIN Document_locations AS T2 ON T1.document_id  =  T2.document_id JOIN Ref_locations AS T3 ON T2.location_code  =  T3.location_code WHERE T1.document_name  =  "Robin CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the location code, the starting date and ending data in that location for all the documents.
SQL: SELECT location_code ,  date_in_location_from ,  date_in_locaton_to FROM Document_locations
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 each document's location code, and starting date and ending data in that location?
SQL: SELECT location_code ,  date_in_location_from ,  date_in_locaton_to FROM Document_locations
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 date in location from" and "the date in location to" for the document with name "Robin CV"?
SQL: SELECT T1.date_in_location_from ,  T1.date_in_locaton_to FROM Document_locations AS T1 JOIN All_documents AS T2 ON T1.document_id  =  T2.document_id WHERE T2.document_name  =  "Robin CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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 starting date and ending data in location for the document named "Robin CV".
SQL: SELECT T1.date_in_location_from ,  T1.date_in_locaton_to FROM Document_locations AS T1 JOIN All_documents AS T2 ON T1.document_id  =  T2.document_id WHERE T2.document_name  =  "Robin CV"
-- Language PostgreSQL
        -- Tables: 
             -- Table: reference document types 
columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']]

 -- Table: reference calendar 
columns : [['calendar date', 'time'], ['day number', 'number']]

 -- Table: reference locations 
columns : [['location code', 'text'], ['location name', 'text'], ['location description', 'text']]

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

 -- Table: all documents 
columns : [['document id', 'number'], ['date stored', 'time'], ['document type code', 'text'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']]

 -- Table: employees 
columns : [['employee id', 'number'], ['role code', 'text'], ['employee name', 'text'], ['gender mfu', 'text'], ['date of birth', 'time'], ['other details', 'text']]

 -- Table: document locations 
columns : [['document id', 'number'], ['location code', 'text'], ['date in location from', 'time'], ['date in locaton to', 'time']]

 -- Table: documents to be destroyed 
columns : [['document id', 'number'], ['destruction authorised by employee id', 'number'], ['destroyed by employee id', 'number'], ['planned destruction date', 'time'], ['actual destruction date', 'time'], ['other details', 'text']]

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: Show the location codes and the number of documents in each location.
SQL: SELECT location_code ,  count(*) FROM Document_locations GROUP BY location_code