sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: What are all the distinct last names of all the engineers?
SQL: SELECT DISTINCT last_name FROM Maintenance_Engineers
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: How many fault status codes are recorded in the fault log parts table?
SQL: SELECT DISTINCT fault_status FROM Fault_Log_Parts
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which engineers have never visited to maintain the assets? List the engineer first name and last name.
SQL: SELECT first_name ,  last_name FROM Maintenance_Engineers WHERE engineer_id NOT IN (SELECT engineer_id FROM Engineer_Visits)
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: List the asset id, details, make and model for every asset.
SQL: SELECT asset_id ,  asset_details ,  asset_make ,  asset_model FROM Assets
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: When was the first asset acquired?
SQL: SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which part fault requires the most number of skills to fix? List part id and name.
SQL: SELECT T1.part_id ,  T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id  =  T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id  =  T3.part_fault_id GROUP BY T1.part_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which kind of part has the least number of faults? List the part name.
SQL: SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id  =  T2.part_id GROUP BY T1.part_name ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name.
SQL: SELECT T1.engineer_id ,  T1.first_name ,  T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id  =  T2.engineer_id GROUP BY T1.engineer_id ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which staff have contacted which engineers? List the staff name and the engineer first name and last name.
SQL: SELECT T1.staff_name ,  T3.first_name ,  T3.last_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id  =  T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id  =  T3.engineer_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which fault log included the most number of faulty parts? List the fault log id, description and record time.
SQL: SELECT T1.fault_log_entry_id ,  T1.fault_description ,  T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id  =  T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which skill is used in fixing the most number of faults? List the skill id and description.
SQL: SELECT T1.skill_id ,  T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id  =  T2.skill_id GROUP BY T1.skill_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: What are all the distinct asset models?
SQL: SELECT DISTINCT asset_model FROM Assets
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: List the all the assets make, model, details by the disposed date ascendingly.
SQL: SELECT asset_make ,  asset_model ,  asset_details FROM Assets ORDER BY asset_disposed_date ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which part has the least chargeable amount? List the part id and amount.
SQL: SELECT part_id ,  chargeable_amount FROM Parts ORDER BY chargeable_amount ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: Which company started the earliest the maintenance contract? Show the company name.
SQL: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id  =  T2.maintenance_contract_company_id ORDER BY T2.contract_start_date ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: third party companies 
columns : [['company id', 'number'], ['company type', 'text'], ['company name', 'text'], ['company address', 'text'], ['other company details', 'text']]

 -- Table: maintenance contracts 
columns : [['maintenance contract id', 'number'], ['maintenance contract company id', 'number'], ['contract start date', 'time'], ['contract end date', 'time'], ['other contract details', 'text']]

 -- Table: parts 
columns : [['part id', 'number'], ['part name', 'text'], ['chargeable yn', 'text'], ['chargeable amount', 'text'], ['other part details', 'text']]

 -- Table: skills 
columns : [['skill id', 'number'], ['skill code', 'text'], ['skill description', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff name', 'text'], ['gender', 'text'], ['other staff details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['maintenance contract id', 'number'], ['supplier company id', 'number'], ['asset details', 'text'], ['asset make', 'text'], ['asset model', 'text'], ['asset acquired date', 'time'], ['asset disposed date', 'time'], ['other asset details', 'text']]

 -- Table: asset parts 
columns : [['asset id', 'number'], ['part id', 'number']]

 -- Table: maintenance engineers 
columns : [['engineer id', 'number'], ['company id', 'number'], ['first name', 'text'], ['last name', 'text'], ['other details', 'text']]

 -- Table: engineer skills 
columns : [['engineer id', 'number'], ['skill id', 'number']]

 -- Table: fault log 
columns : [['fault log entry id', 'number'], ['asset id', 'number'], ['recorded by staff id', 'number'], ['fault log entry datetime', 'time'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: engineer visits 
columns : [['engineer visit id', 'number'], ['contact staff id', 'number'], ['engineer id', 'number'], ['fault log entry id', 'number'], ['fault status', 'text'], ['visit start datetime', 'time'], ['visit end datetime', 'time'], ['other visit details', 'text']]

 -- Table: part faults 
columns : [['part fault id', 'number'], ['part id', 'number'], ['fault short name', 'text'], ['fault description', 'text'], ['other fault details', 'text']]

 -- Table: fault log parts 
columns : [['fault log entry id', 'number'], ['part fault id', 'number'], ['fault status', 'text']]

 -- Table: skills required to fix 
columns : [['part fault id', 'number'], ['skill id', 'number']]

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



Question: What is the description of the type of the company who concluded its contracts most recently?
SQL: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id  =  T2.maintenance_contract_company_id JOIN Ref_Company_Types AS T3 ON T1.company_type_code  =  T3.company_type_code ORDER BY T2.contract_end_date DESC LIMIT 1