sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: What are the names of organizations that contain the word "Party"?
SQL: SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: How many distinct payment methods are used by parties?
SQL: SELECT count(DISTINCT payment_method_code) FROM parties
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: Count the number of different payment method codes used by parties.
SQL: SELECT count(DISTINCT payment_method_code) FROM parties
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: Which is the email of the party that has used the services the most number of times?
SQL: SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id  =  t2.customer_id GROUP BY t1.party_email ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: Return the party email that has used party services the greatest number of times.
SQL: SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id  =  t2.customer_id GROUP BY t1.party_email ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: Which state can address "6862 Kaitlyn Knolls" possibly be in?
SQL: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: Give the state corresponding to the line number building "6862 Kaitlyn Knolls".
SQL: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: What is the name of organization that has the greatest number of contact individuals?
SQL: SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id  =  t2.organization_id GROUP BY t1.organization_name ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: Return the name of the organization which has the most contact individuals.
SQL: SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id  =  t2.organization_id GROUP BY t1.organization_name ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: Find the last name of the individuals that have been contact individuals of an organization.
SQL: SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id  =  t2.individual_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['town city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service type code', 'text'], ['service name', 'text'], ['service descriptio', 'text']]

 -- Table: forms 
columns : [['form id', 'number'], ['form type code', 'text'], ['service id', 'number'], ['form number', 'text'], ['form name', 'text'], ['form description', 'text']]

 -- Table: individuals 
columns : [['individual id', 'number'], ['individual first name', 'text'], ['individual middle name', 'text'], ['inidividual phone', 'text'], ['individual email', 'text'], ['individual address', 'text'], ['individual last name', 'text']]

 -- Table: organizations 
columns : [['organization id', 'number'], ['date formed', 'time'], ['organization name', 'text'], ['uk vat number', 'text']]

 -- Table: parties 
columns : [['party id', 'number'], ['payment method code', 'text'], ['party phone', 'text'], ['party email', 'text']]

 -- Table: organization contact individuals 
columns : [['individual id', 'number'], ['organization id', 'number'], ['date contact from', 'time'], ['date contact to', 'time']]

 -- Table: party addresses 
columns : [['party id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: party forms 
columns : [['party id', 'number'], ['form id', 'number'], ['date completion started', 'time'], ['form status code', 'text'], ['date fully completed', 'time']]

 -- Table: party services 
columns : [['booking id', 'number'], ['customer id', 'number'], ['service id', 'number'], ['service datetime', 'time'], ['booking made date', 'time']]

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



Question: What are the last names of individuals who have been contact individuals for an organization?
SQL: SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id  =  t2.individual_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 drivers are there?
SQL: SELECT count(*) FROM driver
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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, home city, and age for all drivers.
SQL: SELECT name ,  home_city ,  age FROM driver
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 party and the number of drivers in each party.
SQL: SELECT party ,  count(*) FROM driver GROUP BY party
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 drivers in descending order of age.
SQL: SELECT name FROM driver ORDER BY age DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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



Question: Show all different home cities.
SQL: SELECT DISTINCT home_city FROM driver
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 home city with the most number of drivers.
SQL: SELECT home_city FROM driver GROUP BY home_city ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 party with drivers from Hartford and drivers older than 40.
SQL: SELECT party FROM driver WHERE home_city  =  'Hartford' AND age  >  40
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 home city where at least two drivers older than 40 are from.
SQL: SELECT home_city FROM driver WHERE age  >  40 GROUP BY home_city HAVING count(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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



Question: Show all home cities except for those having a driver older than 40.
SQL: SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age  >  40
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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



Question: Show the names of the drivers without a school bus.
SQL: SELECT name FROM driver WHERE driver_id NOT IN (SELECT driver_id FROM school_bus)
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 schools that have two schools.
SQL: SELECT TYPE FROM school GROUP BY TYPE HAVING count(*)  =  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 school name and driver name for all school buses.
SQL: SELECT T2.school ,  T3.name FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id  =  T2.school_id JOIN driver AS T3 ON T1.driver_id  =  T3.driver_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 maximum, minimum and average years spent working on a school bus?
SQL: SELECT max(years_working) ,  min(years_working) ,  avg(years_working) FROM school_bus
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 school name and type for schools without a school bus.
SQL: SELECT school ,  TYPE FROM school WHERE school_id NOT IN (SELECT school_id FROM school_bus)
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 type of school and the number of buses for each type.
SQL: SELECT T2.type ,  count(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id  =  T2.school_id GROUP BY T2.type
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 drivers are from Hartford city or younger than 40?
SQL: SELECT count(*) FROM driver WHERE home_city  =  'Hartford' OR age  <  40
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 names for drivers from Hartford city and younger than 40.
SQL: SELECT name FROM driver WHERE home_city  =  'Hartford' AND age  <  40
-- Language PostgreSQL
        -- Tables: 
             -- Table: driver 
columns : [['driver id', 'number'], ['name', 'text'], ['party', 'text'], ['home city', 'text'], ['age', 'number']]

 -- Table: school 
columns : [['school id', 'number'], ['grade', 'text'], ['school', 'text'], ['location', 'text'], ['type', 'text']]

 -- Table: school bus 
columns : [['school id', 'number'], ['driver id', 'number'], ['years working', 'number'], ['if full time', 'others']]

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 name of driver who is driving the school bus with the longest working history.
SQL: SELECT t1.name FROM driver AS t1 JOIN school_bus AS t2 ON t1.driver_id  =  t2.driver_id ORDER BY years_working DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: airport 
columns : [['id', 'number'], ['city', 'text'], ['country', 'text'], ['iata', 'text'], ['icao', 'text'], ['name', 'text']]

 -- Table: operate company 
columns : [['id', 'number'], ['name', 'text'], ['type', 'text'], ['principal activities', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number']]

 -- Table: flight 
columns : [['id', 'number'], ['vehicle flight number', 'text'], ['date', 'text'], ['pilot', 'text'], ['velocity', 'number'], ['altitude', 'number'], ['airport id', 'number'], ['company 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 flights have a velocity larger than 200?
SQL: SELECT count(*) FROM flight WHERE velocity  >  200
-- Language PostgreSQL
        -- Tables: 
             -- Table: airport 
columns : [['id', 'number'], ['city', 'text'], ['country', 'text'], ['iata', 'text'], ['icao', 'text'], ['name', 'text']]

 -- Table: operate company 
columns : [['id', 'number'], ['name', 'text'], ['type', 'text'], ['principal activities', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number']]

 -- Table: flight 
columns : [['id', 'number'], ['vehicle flight number', 'text'], ['date', 'text'], ['pilot', 'text'], ['velocity', 'number'], ['altitude', 'number'], ['airport id', 'number'], ['company 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 vehicle flight number, date and pilot of all the flights, ordered by altitude.
SQL: SELECT vehicle_flight_number ,  date ,  pilot FROM flight ORDER BY altitude ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: airport 
columns : [['id', 'number'], ['city', 'text'], ['country', 'text'], ['iata', 'text'], ['icao', 'text'], ['name', 'text']]

 -- Table: operate company 
columns : [['id', 'number'], ['name', 'text'], ['type', 'text'], ['principal activities', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number']]

 -- Table: flight 
columns : [['id', 'number'], ['vehicle flight number', 'text'], ['date', 'text'], ['pilot', 'text'], ['velocity', 'number'], ['altitude', 'number'], ['airport id', 'number'], ['company 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 id, country, city and name of the airports ordered alphabetically by the name.
SQL: SELECT id ,  country ,  city ,  name FROM airport ORDER BY name
-- Language PostgreSQL
        -- Tables: 
             -- Table: airport 
columns : [['id', 'number'], ['city', 'text'], ['country', 'text'], ['iata', 'text'], ['icao', 'text'], ['name', 'text']]

 -- Table: operate company 
columns : [['id', 'number'], ['name', 'text'], ['type', 'text'], ['principal activities', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number']]

 -- Table: flight 
columns : [['id', 'number'], ['vehicle flight number', 'text'], ['date', 'text'], ['pilot', 'text'], ['velocity', 'number'], ['altitude', 'number'], ['airport id', 'number'], ['company 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 maximum group equity shareholding of the companies?
SQL: SELECT max(group_equity_shareholding) FROM operate_company
-- Language PostgreSQL
        -- Tables: 
             -- Table: airport 
columns : [['id', 'number'], ['city', 'text'], ['country', 'text'], ['iata', 'text'], ['icao', 'text'], ['name', 'text']]

 -- Table: operate company 
columns : [['id', 'number'], ['name', 'text'], ['type', 'text'], ['principal activities', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number']]

 -- Table: flight 
columns : [['id', 'number'], ['vehicle flight number', 'text'], ['date', 'text'], ['pilot', 'text'], ['velocity', 'number'], ['altitude', 'number'], ['airport id', 'number'], ['company 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 velocity of the pilot named 'Thompson'?
SQL: SELECT avg(velocity) FROM flight WHERE pilot  =  'Thompson'