sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', 'number']]

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



Question: Find the names of patients who are not using the medication of Procrastin-X.
SQL: SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient  =  T1.SSN JOIN Medication AS T3 ON T2.Medication  =  T3.Code WHERE T3.name  =  'Procrastin-X'
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', 'number']]

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



Question: What are the names of patients who are not taking the medication of Procrastin-X.
SQL: SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient  =  T1.SSN JOIN Medication AS T3 ON T2.Medication  =  T3.Code WHERE T3.name  =  'Procrastin-X'
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', 'number']]

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



Question: Find the number of patients who are not using the medication of Procrastin-X.
SQL: SELECT count(*) FROM patient WHERE SSN NOT IN ( SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication  =  T2.Code WHERE T2.name  =  'Procrastin-X' )
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', '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 patients are not using Procrastin-X as medication?
SQL: SELECT count(*) FROM patient WHERE SSN NOT IN ( SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication  =  T2.Code WHERE T2.name  =  'Procrastin-X' )
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', '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 appointments are there?
SQL: SELECT count(*) FROM appointment
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', '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: Count how many appointments have been made in total.
SQL: SELECT count(*) FROM appointment
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', 'number']]

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



Question: Find the names of nurses who are on call.
SQL: SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID  =  T2.nurse
-- Language PostgreSQL
        -- Tables: 
             -- Table: physician 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['ssn', 'number']]

 -- Table: department 
columns : [['departmentid', 'number'], ['name', 'text'], ['head', 'number']]

 -- Table: affiliated with 
columns : [['physician', 'number'], ['department', 'number'], ['primary affiliation', 'boolean']]

 -- Table: procedures 
columns : [['code', 'number'], ['name', 'text'], ['cost', 'number']]

 -- Table: trained in 
columns : [['physician', 'number'], ['treatment', 'number'], ['certification date', 'time'], ['certification expires', 'time']]

 -- Table: patient 
columns : [['ssn', 'number'], ['name', 'text'], ['address', 'text'], ['phone', 'text'], ['insurance id', 'number'], ['pcp', 'number']]

 -- Table: nurse 
columns : [['employee id', 'number'], ['name', 'text'], ['position', 'text'], ['registered', 'boolean'], ['ssn', 'number']]

 -- Table: appointment 
columns : [['appointment id', 'number'], ['patient', 'number'], ['prep nurse', 'number'], ['physician', 'number'], ['start', 'time'], ['end', 'time'], ['examination room', 'text']]

 -- Table: medication 
columns : [['code', 'number'], ['name', 'text'], ['brand', 'text'], ['description', 'text']]

 -- Table: prescribes 
columns : [['physician', 'number'], ['patient', 'number'], ['medication', 'number'], ['date', 'time'], ['appointment', 'number'], ['dose', 'text']]

 -- Table: block 
columns : [['block floor', 'number'], ['block code', 'number']]

 -- Table: room 
columns : [['roomnumber', 'number'], ['room type', 'text'], ['block floor', 'number'], ['block code', 'number'], ['unavailable', 'boolean']]

 -- Table: on call 
columns : [['nurse', 'number'], ['block floor', 'number'], ['block code', 'number'], ['oncall start', 'time'], ['oncall end', 'time']]

 -- Table: stay 
columns : [['stay id', 'number'], ['patient', 'number'], ['room', 'number'], ['stay start', 'time'], ['stay end', 'time']]

 -- Table: undergoes 
columns : [['patient', 'number'], ['procedures', 'number'], ['stay', 'number'], ['date undergoes', 'time'], ['physician', 'number'], ['assisting nurse', 'number']]

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



Question: What are the distinct names of nurses on call?
SQL: SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID  =  T2.nurse
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 ships are there?
SQL: SELECT count(*) FROM ship
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 number of ships?
SQL: SELECT count(*) FROM ship
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 name of ships in ascending order of tonnage.
SQL: SELECT Name FROM ship ORDER BY Tonnage ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: what are the names of the ships ordered by ascending tonnage?
SQL: SELECT Name FROM ship ORDER BY Tonnage ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the type and nationality of ships?
SQL: SELECT TYPE ,  Nationality FROM ship
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the types and nationalities of every ship?
SQL: SELECT TYPE ,  Nationality FROM ship
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 name of ships whose nationality is not "United States".
SQL: SELECT Name FROM ship WHERE Nationality != "United States"
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the names of the ships that are not from the United States?
SQL: SELECT Name FROM ship WHERE Nationality != "United States"
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Show the name of ships whose nationality is either United States or United Kingdom.
SQL: SELECT Name FROM ship WHERE Nationality  =  "United States" OR Nationality  =  "United Kingdom"
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the names of the ships  that are from either the US or the UK?
SQL: SELECT Name FROM ship WHERE Nationality  =  "United States" OR Nationality  =  "United Kingdom"
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What is the name of the ship with the largest tonnage?
SQL: SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 ship with the largest amount of tonnage called?
SQL: SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Show different types of ships and the number of ships of each type.
SQL: SELECT TYPE ,  COUNT(*) FROM ship GROUP BY TYPE
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: For each type, how many ships are there?
SQL: SELECT TYPE ,  COUNT(*) FROM ship GROUP BY TYPE
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Please show the most common type of ships.
SQL: SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 most common type of ships?
SQL: SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 nations that have more than two ships.
SQL: SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the nations that have more than two ships?
SQL: SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Show different types of ships and the average tonnage of ships of each type.
SQL: SELECT TYPE ,  avg(Tonnage) FROM ship GROUP BY TYPE
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: For each type, what is the average tonnage?
SQL: SELECT TYPE ,  avg(Tonnage) FROM ship GROUP BY TYPE
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Show codes and fates of missions, and names of ships involved.
SQL: SELECT T1.Code ,  T1.Fate ,  T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID  =  T2.Ship_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the mission codes, fates, and names of the ships involved?
SQL: SELECT T1.Code ,  T1.Fate ,  T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID  =  T2.Ship_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Show names of ships involved in a mission launched after 1928.
SQL: SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID  =  T2.Ship_ID WHERE T1.Launched_Year  >  1928
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the names of ships that were involved in a mission launched after 1928?
SQL: SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID  =  T2.Ship_ID WHERE T1.Launched_Year  >  1928
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Show the distinct fate of missions that involve ships with nationality "United States"
SQL: SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID  =  T2.Ship_ID WHERE T2.Nationality  =  "United States"
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the different fates of the mission that involved ships from the United States?
SQL: SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID  =  T2.Ship_ID WHERE T2.Nationality  =  "United States"
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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 name of ships that are not involved in any mission
SQL: SELECT Name FROM ship WHERE Ship_ID NOT IN (SELECT Ship_ID FROM mission)
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the names of the ships that are not involved in any missions?
SQL: SELECT Name FROM ship WHERE Ship_ID NOT IN (SELECT Ship_ID FROM mission)
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', '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: Show the types of ships that have both ships with tonnage larger than 6000 and ships with tonnage smaller than 4000.
SQL: SELECT TYPE FROM ship WHERE Tonnage  >  6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage  <  4000
-- Language PostgreSQL
        -- Tables: 
             -- Table: mission 
columns : [['mission id', 'number'], ['ship id', 'number'], ['code', 'text'], ['launched year', 'number'], ['location', 'text'], ['speed knots', 'number'], ['fate', 'text']]

 -- Table: ship 
columns : [['ship id', 'number'], ['name', 'text'], ['type', 'text'], ['nationality', 'text'], ['tonnage', 'number']]

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



Question: What are the types of the ships that have both shiips with tonnage more than 6000 and those with tonnage less than 4000?
SQL: SELECT TYPE FROM ship WHERE Tonnage  >  6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage  <  4000
-- Language PostgreSQL
        -- Tables: 
             -- Table: list 
columns : [['last name', 'text'], ['first name', 'text'], ['grade', 'number'], ['class room', 'number']]

 -- Table: teachers 
columns : [['last name', 'text'], ['first name', 'text'], ['class room', 'number']]

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



Question: Find the number of students in total.
SQL: SELECT count(*) FROM list
-- Language PostgreSQL
        -- Tables: 
             -- Table: list 
columns : [['last name', 'text'], ['first name', 'text'], ['grade', 'number'], ['class room', 'number']]

 -- Table: teachers 
columns : [['last name', 'text'], ['first name', 'text'], ['class room', '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 students are there?
SQL: SELECT count(*) FROM list