brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Find the number of matches in different competitions.
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of matches in different competitions.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , Competition FROM MATCH GROUP BY Competition
For each competition, count the number of matches.
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `For each competition, count the number of matches.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , Competition FROM MATCH GROUP BY Competition
List venues of all matches in the order of their dates starting from the most recent one.
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List venues of all matches in the order of their dates starting from the most recent one.` to a syntactically-correct PostgreSQL query.
SELECT venue FROM MATCH ORDER BY date DESC
What are the venues of all the matches? Sort them in the descending order of match date.
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the venues of all the matches? Sort them in the descending order of match date.` to a syntactically-correct PostgreSQL query.
SELECT venue FROM MATCH ORDER BY date DESC
what is the GDP of the city with the largest population.
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `what is the GDP of the city with the largest population.` to a syntactically-correct PostgreSQL query.
SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1
Find the GDP of the city with the largest regional population.
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the GDP of the city with the largest regional population.` to a syntactically-correct PostgreSQL query.
SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1
What are the GDP and population of the city that already served as a host more than once?
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the GDP and population of the city that already served as a host more than once?` to a syntactically-correct PostgreSQL query.
SELECT t1.gdp , t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING count(*) > 1
Which cities have served as host cities more than once? Return me their GDP and population.
-- Language PostgreSQL -- Tables: -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['hanzi', 'text'], ['hanyu pinyin', 'text'], ['regional population', 'number'], ['gdp', 'number']] -- Table: match columns : [['match id', 'number'], ['date', 'text'], ['venue', 'text'], ['score', 'text'], ['result', 'text'], ['competition', 'text']] -- Table: temperature columns : [['city id', 'number'], ['jan', 'number'], ['feb', 'number'], ['mar', 'number'], ['apr', 'number'], ['jun', 'number'], ['jul', 'number'], ['aug', 'number'], ['sep', 'number'], ['oct', 'number'], ['nov', 'number'], ['dec', 'number']] -- Table: hosting city columns : [['year', 'number'], ['match id', 'number'], ['host city', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which cities have served as host cities more than once? Return me their GDP and population.` to a syntactically-correct PostgreSQL query.
SELECT t1.gdp , t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING count(*) > 1
List every individual's first name, middle name and last name in alphabetical order by last name.
-- 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. Translate `List every individual's first name, middle name and last name in alphabetical order by last name.` to a syntactically-correct PostgreSQL query.
SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name
What are the first, middle, and last names of all individuals, ordered by last name?
-- 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. Translate `What are the first, middle, and last names of all individuals, ordered by last name?` to a syntactically-correct PostgreSQL query.
SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name
List all the types of forms.
-- 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. Translate `List all the types of forms.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT form_type_code FROM forms
What are the different types of forms?
-- 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. Translate `What are the different types of forms?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT form_type_code FROM forms
Find the name of the most popular party form.
-- 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. Translate `Find the name of the most popular party form.` to a syntactically-correct PostgreSQL query.
SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY count(*) DESC LIMIT 1
What is the name of the party form that is most common?
-- 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. Translate `What is the name of the party form that is most common?` to a syntactically-correct PostgreSQL query.
SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY count(*) DESC LIMIT 1
Find the payment method and phone of the party with email "enrico09@example.com".
-- 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. Translate `Find the payment method and phone of the party with email "enrico09@example.com".` to a syntactically-correct PostgreSQL query.
SELECT payment_method_code , party_phone FROM parties WHERE party_email = "enrico09@example.com"
What is the payment method code and party phone of the party with the email 'enrico09@example.com'?
-- 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. Translate `What is the payment method code and party phone of the party with the email 'enrico09@example.com'?` to a syntactically-correct PostgreSQL query.
SELECT payment_method_code , party_phone FROM parties WHERE party_email = "enrico09@example.com"
Find the emails of parties with the most popular party form.
-- 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. Translate `Find the emails of parties with the most popular party form.` to a syntactically-correct PostgreSQL query.
SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY count(*) DESC LIMIT 1)
What are the party emails associated with parties that used the party form that is the most common?
-- 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. Translate `What are the party emails associated with parties that used the party form that is the most common?` to a syntactically-correct PostgreSQL query.
SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY count(*) DESC LIMIT 1)
List all the name of organizations in order of the date formed.
-- 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. Translate `List all the name of organizations in order of the date formed.` to a syntactically-correct PostgreSQL query.
SELECT organization_name FROM organizations ORDER BY date_formed ASC
What are the names of organizations, ordered by the date they were formed, ascending?
-- 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. Translate `What are the names of organizations, ordered by the date they were formed, ascending?` to a syntactically-correct PostgreSQL query.
SELECT organization_name FROM organizations ORDER BY date_formed ASC
Find the name of the youngest organization.
-- 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. Translate `Find the name of the youngest organization.` to a syntactically-correct PostgreSQL query.
SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1
What is the name of the organization that was formed most recently?
-- 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. Translate `What is the name of the organization that was formed most recently?` to a syntactically-correct PostgreSQL query.
SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1
Find the last name of the latest contact individual of the organization "Labour 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. Translate `Find the last name of the latest contact individual of the organization "Labour Party".` to a syntactically-correct PostgreSQL query.
SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.organization_name = "Labour Party" ORDER BY t2.date_contact_to DESC LIMIT 1
What is the last name of the contact individual from the Labour party organization who was contacted most recently?
-- 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. Translate `What is the last name of the contact individual from the Labour party organization who was contacted most recently?` to a syntactically-correct PostgreSQL query.
SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.organization_name = "Labour Party" ORDER BY t2.date_contact_to DESC LIMIT 1
Find the last name of the first ever contact person of the organization with the highest UK Vat number.
-- 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. Translate `Find the last name of the first ever contact person of the organization with the highest UK Vat number.` to a syntactically-correct PostgreSQL query.
SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.uk_vat_number = (SELECT max(uk_vat_number) FROM organizations) ORDER BY t2.date_contact_to ASC LIMIT 1
What is the last name of the first individual contacted from the organization with the maximum UK Vat number across all organizations?
-- 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. Translate `What is the last name of the first individual contacted from the organization with the maximum UK Vat number across all organizations?` to a syntactically-correct PostgreSQL query.
SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.uk_vat_number = (SELECT max(uk_vat_number) FROM organizations) ORDER BY t2.date_contact_to ASC LIMIT 1
How many services are there?
-- 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. Translate `How many services are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM services
Count the number of services.
-- 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. Translate `Count the number of services.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM services
Find name of the services that has never been used.
-- 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. Translate `Find name of the services that has never been used.` to a syntactically-correct PostgreSQL query.
SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id
What are the names of the services that have never been used?
-- 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. Translate `What are the names of the services that have never been used?` to a syntactically-correct PostgreSQL query.
SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id
Find the name of all the cities and states.
-- 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. Translate `Find the name of all the cities and states.` to a syntactically-correct PostgreSQL query.
SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses
What are the names of all cities and states?
-- 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. Translate `What are the names of all cities and states?` to a syntactically-correct PostgreSQL query.
SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses
How many cities are there in state "Colorado"?
-- 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. Translate `How many cities are there in state "Colorado"?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM addresses WHERE state_province_county = "Colorado"
Count the number of cities in the state of Colorado.
-- 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. Translate `Count the number of cities in the state of Colorado.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM addresses WHERE state_province_county = "Colorado"
Find the payment method code used by more than 3 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. Translate `Find the payment method code used by more than 3 parties.` to a syntactically-correct PostgreSQL query.
SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3
What are the payment method codes that have been used by more than 3 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. Translate `What are the payment method codes that have been used by more than 3 parties?` to a syntactically-correct PostgreSQL query.
SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3
Find the name of organizations whose names contain "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. Translate `Find the name of organizations whose names contain "Party".` to a syntactically-correct PostgreSQL query.
SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"
What are the names of organizations that contain the word "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. Translate `What are the names of organizations that contain the word "Party"?` to a syntactically-correct PostgreSQL query.
SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"
How many distinct payment methods are used by 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. Translate `How many distinct payment methods are used by parties?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT payment_method_code) FROM parties
Count the number of different payment method codes used by 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. Translate `Count the number of different payment method codes used by parties.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT payment_method_code) FROM parties
Which is the email of the party that has used the services the most number of times?
-- 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. Translate `Which is the email of the party that has used the services the most number of times?` to a syntactically-correct PostgreSQL query.
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
Return the party email that has used party services the greatest number of times.
-- 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. Translate `Return the party email that has used party services the greatest number of times.` to a syntactically-correct PostgreSQL query.
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
Which state can address "6862 Kaitlyn Knolls" possibly be in?
-- 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. Translate `Which state can address "6862 Kaitlyn Knolls" possibly be in?` to a syntactically-correct PostgreSQL query.
SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"
Give the state corresponding to the line number building "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. Translate `Give the state corresponding to the line number building "6862 Kaitlyn Knolls".` to a syntactically-correct PostgreSQL query.
SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"
What is the name of organization that has the greatest number of contact individuals?
-- 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. Translate `What is the name of organization that has the greatest number of contact individuals?` to a syntactically-correct PostgreSQL query.
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
Return the name of the organization which has the most contact individuals.
-- 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. Translate `Return the name of the organization which has the most contact individuals.` to a syntactically-correct PostgreSQL query.
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
Find the last name of the individuals that have been contact individuals of an organization.
-- 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. Translate `Find the last name of the individuals that have been contact individuals of an organization.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id
What are the last names of individuals who have been contact individuals for an organization?
-- 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. Translate `What are the last names of individuals who have been contact individuals for an organization?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id
How many drivers are there?
-- 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. Translate `How many drivers are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM driver
Show the name, home city, and age for all drivers.
-- 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. Translate `Show the name, home city, and age for all drivers.` to a syntactically-correct PostgreSQL query.
SELECT name , home_city , age FROM driver
Show the party and the number of drivers in each 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. Translate `Show the party and the number of drivers in each party.` to a syntactically-correct PostgreSQL query.
SELECT party , count(*) FROM driver GROUP BY party
Show the name of drivers in descending order of age.
-- 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. Translate `Show the name of drivers in descending order of age.` to a syntactically-correct PostgreSQL query.
SELECT name FROM driver ORDER BY age DESC
Show all different home cities.
-- 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. Translate `Show all different home cities.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT home_city FROM driver
Show the home city with the most number of drivers.
-- 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. Translate `Show the home city with the most number of drivers.` to a syntactically-correct PostgreSQL query.
SELECT home_city FROM driver GROUP BY home_city ORDER BY count(*) DESC LIMIT 1
Show the party with drivers from Hartford and drivers older than 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. Translate `Show the party with drivers from Hartford and drivers older than 40.` to a syntactically-correct PostgreSQL query.
SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40
Show home city where at least two drivers older than 40 are from.
-- 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. Translate `Show home city where at least two drivers older than 40 are from.` to a syntactically-correct PostgreSQL query.
SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING count(*) >= 2
Show all home cities except for those having a driver older than 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. Translate `Show all home cities except for those having a driver older than 40.` to a syntactically-correct PostgreSQL query.
SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40
Show the names of the drivers without a 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. Translate `Show the names of the drivers without a school bus.` to a syntactically-correct PostgreSQL query.
SELECT name FROM driver WHERE driver_id NOT IN (SELECT driver_id FROM school_bus)
Show the types of schools that have two schools.
-- 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. Translate `Show the types of schools that have two schools.` to a syntactically-correct PostgreSQL query.
SELECT TYPE FROM school GROUP BY TYPE HAVING count(*) = 2
Show the school name and driver name for all school buses.
-- 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. Translate `Show the school name and driver name for all school buses.` to a syntactically-correct PostgreSQL query.
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
What is the maximum, minimum and average years spent working on a 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. Translate `What is the maximum, minimum and average years spent working on a school bus?` to a syntactically-correct PostgreSQL query.
SELECT max(years_working) , min(years_working) , avg(years_working) FROM school_bus
Show the school name and type for schools without a 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. Translate `Show the school name and type for schools without a school bus.` to a syntactically-correct PostgreSQL query.
SELECT school , TYPE FROM school WHERE school_id NOT IN (SELECT school_id FROM school_bus)
Show the type of school and the number of buses for each 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. Translate `Show the type of school and the number of buses for each type.` to a syntactically-correct PostgreSQL query.
SELECT T2.type , count(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type
How many drivers are from Hartford city or younger than 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. Translate `How many drivers are from Hartford city or younger than 40?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM driver WHERE home_city = 'Hartford' OR age < 40
List names for drivers from Hartford city and younger than 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. Translate `List names for drivers from Hartford city and younger than 40.` to a syntactically-correct PostgreSQL query.
SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40
find the name of driver who is driving the school bus with the longest working history.
-- 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. Translate `find the name of driver who is driving the school bus with the longest working history.` to a syntactically-correct PostgreSQL query.
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
How many flights have a velocity larger than 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. Translate `How many flights have a velocity larger than 200?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM flight WHERE velocity > 200
List the vehicle flight number, date and pilot of all the flights, ordered by altitude.
-- 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. Translate `List the vehicle flight number, date and pilot of all the flights, ordered by altitude.` to a syntactically-correct PostgreSQL query.
SELECT vehicle_flight_number , date , pilot FROM flight ORDER BY altitude ASC
List the id, country, city and name of the airports ordered alphabetically by the 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. Translate `List the id, country, city and name of the airports ordered alphabetically by the name.` to a syntactically-correct PostgreSQL query.
SELECT id , country , city , name FROM airport ORDER BY name
What is maximum group equity shareholding of the companies?
-- 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. Translate `What is maximum group equity shareholding of the companies?` to a syntactically-correct PostgreSQL query.
SELECT max(group_equity_shareholding) FROM operate_company
What is the velocity of the pilot named 'Thompson'?
-- 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. Translate `What is the velocity of the pilot named 'Thompson'?` to a syntactically-correct PostgreSQL query.
SELECT avg(velocity) FROM flight WHERE pilot = 'Thompson'
What are the names and types of the companies that have ever operated a flight?
-- 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. Translate `What are the names and types of the companies that have ever operated a flight?` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
What are the names of the airports which are not in the country 'Iceland'?
-- 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. Translate `What are the names of the airports which are not in the country 'Iceland'?` to a syntactically-correct PostgreSQL query.
SELECT name FROM airport WHERE country != 'Iceland'
What are the distinct types of the companies that have operated any flights with velocity less than 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. Translate `What are the distinct types of the companies that have operated any flights with velocity less than 200?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200
What are the ids and names of the companies that operated more than one flight?
-- 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. Translate `What are the ids and names of the companies that operated more than one flight?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY T1.id HAVING count(*) > 1
What is the id, name and IATA code of the airport that had most number of flights?
-- 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. Translate `What is the id, name and IATA code of the airport that had most number of flights?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name , T1.IATA FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
-- 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. Translate `What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport'
What is the most common company type, and how many are there?
-- 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. Translate `What is the most common company type, and how many are there?` to a syntactically-correct PostgreSQL query.
SELECT TYPE , count(*) FROM operate_company GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
How many airports haven't the pilot 'Thompson' driven an aircraft?
-- 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. Translate `How many airports haven't the pilot 'Thompson' driven an aircraft?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM airport WHERE id NOT IN ( SELECT airport_id FROM flight WHERE pilot = 'Thompson' );
List the name of the pilots who have flied for both a company that mainly provide 'Cargo' services and a company that runs 'Catering services' activities.
-- 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. Translate `List the name of the pilots who have flied for both a company that mainly provide 'Cargo' services and a company that runs 'Catering services' activities.` to a syntactically-correct PostgreSQL query.
SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Cargo' INTERSECT SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Catering services'
Which of the airport names contains the word 'international'?
-- 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. Translate `Which of the airport names contains the word 'international'?` to a syntactically-correct PostgreSQL query.
SELECT name FROM airport WHERE name LIKE '%international%'
How many companies operates airlines in each airport?
-- 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. Translate `How many companies operates airlines in each airport?` to a syntactically-correct PostgreSQL query.
SELECT T3.id , count(*) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id JOIN airport AS T3 ON T2.airport_id = T3.id GROUP BY T3.id
how many airports are there in each country?
-- 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. Translate `how many airports are there in each country?` to a syntactically-correct PostgreSQL query.
SELECT count(*) , country FROM airport GROUP BY country
which countries have more than 2 airports?
-- 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. Translate `which countries have more than 2 airports?` to a syntactically-correct PostgreSQL query.
SELECT country FROM airport GROUP BY country HAVING count(*) > 2
which pilot is in charge of the most number of flights?
-- 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. Translate `which pilot is in charge of the most number of flights?` to a syntactically-correct PostgreSQL query.
SELECT pilot FROM flight GROUP BY pilot ORDER BY count(*) DESC LIMIT 1
How many accounts do we have?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many accounts do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Accounts
Count the number of accounts.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of accounts.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Accounts
Show all account ids and account details.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all account ids and account details.` to a syntactically-correct PostgreSQL query.
SELECT account_id , account_details FROM Accounts
What are the ids and details of all accounts?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and details of all accounts?` to a syntactically-correct PostgreSQL query.
SELECT account_id , account_details FROM Accounts
How many statements do we have?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many statements do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Statements
Count the number of statements.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of statements.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Statements
List all statement ids and statement details.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all statement ids and statement details.` to a syntactically-correct PostgreSQL query.
SELECT STATEMENT_ID , statement_details FROM Statements
What are the ids and details of all statements?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and details of all statements?` to a syntactically-correct PostgreSQL query.
SELECT STATEMENT_ID , statement_details FROM Statements
Show statement id, statement detail, account detail for accounts.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show statement id, statement detail, account detail for accounts.` to a syntactically-correct PostgreSQL query.
SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id
What are the statement ids, statement details, and account details, for all accounts?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the statement ids, statement details, and account details, for all accounts?` to a syntactically-correct PostgreSQL query.
SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id
Show all statement id and the number of accounts for each statement.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show all statement id and the number of accounts for each statement.` to a syntactically-correct PostgreSQL query.
SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID
What are the different statement ids on accounts, and the number of accounts for each?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different statement ids on accounts, and the number of accounts for each?` to a syntactically-correct PostgreSQL query.
SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID
Show the statement id and the statement detail for the statement with most number of accounts.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the statement id and the statement detail for the statement with most number of accounts.` to a syntactically-correct PostgreSQL query.
SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
What are the statement id and statement detail for the statement that has the most corresponding accounts?
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the statement id and statement detail for the statement that has the most corresponding accounts?` to a syntactically-correct PostgreSQL query.
SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1
Show the number of documents.
-- Language PostgreSQL -- Tables: -- Table: reference document types columns : [['document type code', 'text'], ['document type name', 'text'], ['document type description', 'text']] -- Table: reference budget codes columns : [['budget type code', 'text'], ['budget type description', 'text']] -- Table: projects columns : [['project id', 'number'], ['project details', 'text']] -- Table: documents columns : [['document id', 'number'], ['document type code', 'text'], ['project id', 'number'], ['document date', 'time'], ['document name', 'text'], ['document description', 'text'], ['other details', 'text']] -- Table: statements columns : [['statement id', 'number'], ['statement details', 'text']] -- Table: documents with expenses columns : [['document id', 'number'], ['budget type code', 'text'], ['document details', 'text']] -- Table: accounts columns : [['account id', 'number'], ['statement id', 'number'], ['account details', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the number of documents.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Documents