brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Show the distinct venues of debates
-- Language PostgreSQL -- Tables: -- Table: people columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']] -- Table: debate columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']] -- Table: debate people columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', '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 distinct venues of debates` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT Venue FROM debate
Show the names of people, and dates and venues of debates they are on the affirmative side.
-- Language PostgreSQL -- Tables: -- Table: people columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']] -- Table: debate columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']] -- Table: debate people columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', '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 people, and dates and venues of debates they are on the affirmative side.` to a syntactically-correct PostgreSQL query.
SELECT T3.Name , T2.Date , T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID
Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name.
-- Language PostgreSQL -- Tables: -- Table: people columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']] -- Table: debate columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']] -- Table: debate people columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', '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 people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name.` to a syntactically-correct PostgreSQL query.
SELECT T3.Name , T2.Date , T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID ORDER BY T3.Name ASC
Show the names of people that are on affirmative side of debates with number of audience bigger than 200.
-- Language PostgreSQL -- Tables: -- Table: people columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']] -- Table: debate columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']] -- Table: debate people columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', '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 people that are on affirmative side of debates with number of audience bigger than 200.` to a syntactically-correct PostgreSQL query.
SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID WHERE T2.Num_of_Audience > 200
Show the names of people and the number of times they have been on the affirmative side of debates.
-- Language PostgreSQL -- Tables: -- Table: people columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']] -- Table: debate columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']] -- Table: debate people columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', '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 people and the number of times they have been on the affirmative side of debates.` to a syntactically-correct PostgreSQL query.
SELECT T2.Name , COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name
Show the names of people who have been on the negative side of debates at least twice.
-- Language PostgreSQL -- Tables: -- Table: people columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']] -- Table: debate columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']] -- Table: debate people columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', '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 people who have been on the negative side of debates at least twice.` to a syntactically-correct PostgreSQL query.
SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative = T2.People_ID GROUP BY T2.Name HAVING COUNT(*) >= 2
List the names of people that have not been on the affirmative side of debates.
-- Language PostgreSQL -- Tables: -- Table: people columns : [['people id', 'number'], ['district', 'text'], ['name', 'text'], ['party', 'text'], ['age', 'number']] -- Table: debate columns : [['debate id', 'number'], ['date', 'text'], ['venue', 'text'], ['num of audience', 'number']] -- Table: debate people columns : [['debate id', 'number'], ['affirmative', 'number'], ['negative', 'number'], ['if affirmative win', '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 the names of people that have not been on the affirmative side of debates.` to a syntactically-correct PostgreSQL query.
SELECT Name FROM people WHERE People_id NOT IN (SELECT Affirmative FROM debate_people)
List the names of all the customers in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 names of all the customers in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers ORDER BY customer_details
Sort the customer names in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Sort the customer names in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers ORDER BY customer_details
Find all the policy type codes associated with the customer "Dayana Robel"
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find all the policy type codes associated with the customer "Dayana Robel"` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = "Dayana Robel"
What are the type codes of the policies used by the customer "Dayana Robel"?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 type codes of the policies used by the customer "Dayana Robel"?` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = "Dayana Robel"
Which type of policy is most frequently used? Give me the policy type code.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 type of policy is most frequently used? Give me the policy type code.` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
Find the type code of the most frequently used policy.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the type code of the most frequently used policy.` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
Find all the policy types that are used by more than 2 customers.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find all the policy types that are used by more than 2 customers.` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2
Which types of policy are chosen by more than 2 customers? Give me the policy type codes.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 types of policy are chosen by more than 2 customers? Give me the policy type codes.` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2
Find the total and average amount paid in claim headers.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the total and average amount paid in claim headers.` to a syntactically-correct PostgreSQL query.
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
What are the total amount and average amount paid in claim headers?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 total amount and average amount paid in claim headers?` to a syntactically-correct PostgreSQL query.
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
Find the total amount claimed in the most recently created document.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the total amount claimed in the most recently created document.` to a syntactically-correct PostgreSQL query.
SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)
How much amount in total were claimed in the most recently created document?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 much amount in total were claimed in the most recently created document?` to a syntactically-correct PostgreSQL query.
SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)
What is the name of the customer who has made the largest amount of claim in a single claim?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 name of the customer who has made the largest amount of claim in a single claim?` to a syntactically-correct PostgreSQL query.
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)
Which customer made the largest amount of claim in a single claim? Return the customer details.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customer made the largest amount of claim in a single claim? Return the customer details.` to a syntactically-correct PostgreSQL query.
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)
What is the name of the customer who has made the minimum amount of payment in one claim?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 name of the customer who has made the minimum amount of payment in one claim?` to a syntactically-correct PostgreSQL query.
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT min(amount_piad) FROM claim_headers)
Which customer made the smallest amount of claim in one claim? Return the customer details.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customer made the smallest amount of claim in one claim? Return the customer details.` to a syntactically-correct PostgreSQL query.
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT min(amount_piad) FROM claim_headers)
Find the names of customers who have no policies associated.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the names of customers who have no policies associated.` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id
What are the names of customers who do not have any policies?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customers who do not have any policies?` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id
How many claim processing stages are there in total?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 claim processing stages are there in total?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM claims_processing_stages
Find the number of distinct stages in claim processing.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the number of distinct stages in claim processing.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM claims_processing_stages
What is the name of the claim processing stage that most of the claims are on?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 name of the claim processing stage that most of the claims are on?` to a syntactically-correct PostgreSQL query.
SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1
Which claim processing stage has the most claims? Show the claim status name.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 claim processing stage has the most claims? Show the claim status name.` to a syntactically-correct PostgreSQL query.
SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1
Find the names of customers whose name contains "Diana".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the names of customers whose name contains "Diana".` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
Which customers have the substring "Diana" in their names? Return the customer details.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customers have the substring "Diana" in their names? Return the customer details.` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
Find the names of the customers who have an deputy policy.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the names of the customers who have an deputy policy.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy"
Which customers have an insurance policy with the type code "Deputy"? Give me the customer details.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customers have an insurance policy with the type code "Deputy"? Give me the customer details.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy"
Find the names of customers who either have an deputy policy or uniformed policy.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the names of customers who either have an deputy policy or uniformed policy.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy" OR t1.policy_type_code = "Uniform"
Which customers have an insurance policy with the type code "Deputy" or "Uniform"? Return the customer details.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customers have an insurance policy with the type code "Deputy" or "Uniform"? Return the customer details.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy" OR t1.policy_type_code = "Uniform"
Find the names of all the customers and staff members.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the names of all the customers and staff members.` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
What are the names of the customers and staff members?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customers and staff members?` to a syntactically-correct PostgreSQL query.
SELECT customer_details FROM customers UNION SELECT staff_details FROM staff
Find the number of records of each policy type and its type code.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the number of records of each policy type and its type code.` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code
For each policy type, return its type code and its count in the record.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `For each policy type, return its type code and its count in the record.` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code
Find the name of the customer that has been involved in the most policies.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the name of the customer that has been involved in the most policies.` to a syntactically-correct PostgreSQL query.
SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details ORDER BY count(*) DESC LIMIT 1
Which customer have the most policies? Give me the customer details.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customer have the most policies? Give me the customer details.` to a syntactically-correct PostgreSQL query.
SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details ORDER BY count(*) DESC LIMIT 1
What is the description of the claim status "Open"?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 description of the claim status "Open"?` to a syntactically-correct PostgreSQL query.
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
Find the description of the claim status "Open".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the description of the claim status "Open".` to a syntactically-correct PostgreSQL query.
SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open"
How many distinct claim outcome codes are there?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 distinct claim outcome codes are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
Count the number of distinct claim outcome codes.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Count the number of distinct claim outcome codes.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT claim_outcome_code) FROM claims_processing
Which customer is associated with the latest policy?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 customer is associated with the latest policy?` to a syntactically-correct PostgreSQL query.
SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT max(start_date) FROM policies)
Find the customer who started a policy most recently.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff details', 'text']] -- Table: policies columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']] -- Table: claim headers columns : [['claim header id', 'number'], ['claim status code', 'text'], ['claim type code', 'text'], ['policy id', 'number'], ['date of claim', 'time'], ['date of settlement', 'time'], ['amount claimed', 'number'], ['amount piad', 'number']] -- Table: claims documents columns : [['claim id', 'number'], ['document type code', 'text'], ['created by staff id', 'number'], ['created date', 'number']] -- Table: claims processing stages columns : [['claim stage id', 'number'], ['next claim stage id', 'number'], ['claim status name', 'text'], ['claim status description', 'text']] -- Table: claims processing columns : [['claim processing id', 'number'], ['claim id', 'number'], ['claim outcome code', 'text'], ['claim stage id', 'number'], ['staff 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 `Find the customer who started a policy most recently.` to a syntactically-correct PostgreSQL query.
SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT max(start_date) FROM policies)
Show the number of accounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the number of accounts.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Accounts
How many accounts are there?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 accounts are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Accounts
How many customers have opened an account?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 customers have opened an account?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT customer_id) FROM Accounts
Count the number of customers who have an account.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Count the number of customers who have an account.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT customer_id) FROM Accounts
Show the id, the date of account opened, the account name, and other account detail for all accounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the id, the date of account opened, the account name, and other account detail for all accounts.` to a syntactically-correct PostgreSQL query.
SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts
What are the ids, date opened, name, and other details for all accounts?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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, date opened, name, and other details for all accounts?` to a syntactically-correct PostgreSQL query.
SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.` to a syntactically-correct PostgreSQL query.
SELECT T1.account_id , T1.date_account_opened , T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'
What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"?` to a syntactically-correct PostgreSQL query.
SELECT T1.account_id , T1.date_account_opened , T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.` to a syntactically-correct PostgreSQL query.
SELECT T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Meaghan" AND T2.customer_last_name = "Keeling"
What are the names and other details for accounts corresponding to the customer named Meaghan Keeling?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 other details for accounts corresponding to the customer named Meaghan Keeling?` to a syntactically-correct PostgreSQL query.
SELECT T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Meaghan" AND T2.customer_last_name = "Keeling"
Show the first name and last name for the customer with account name 900.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the first name and last name for the customer with account name 900.` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "900"
What are the full names of customers with the account name 900?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 full names of customers with the account name 900?` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "900"
How many customers don't have an account?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 customers don't have an account?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
Count the number of customers who do not have an account.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Count the number of customers who do not have an account.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts)
Show the unique first names, last names, and phone numbers for all customers with any account.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the unique first names, last names, and phone numbers for all customers with any account.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
What are the distinct first names, last names, and phone numbers for customers with accounts?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 first names, last names, and phone numbers for customers with accounts?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
Show customer ids who don't have an account.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show customer ids who don't have an account.` to a syntactically-correct PostgreSQL query.
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
What are the customer ids for customers who do not have an account?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 customer ids for customers who do not have an account?` to a syntactically-correct PostgreSQL query.
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
How many accounts does each customer have? List the number and customer id.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 accounts does each customer have? List the number and customer id.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
Count the number of accounts corresponding to each customer id.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Count the number of accounts corresponding to each customer id.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
What is the customer id, first and last name with most number of accounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 customer id, first and last name with most number of accounts.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Return the id and full name of the customer with the most accounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Return the id and full name of the customer with the most accounts.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Show id, first name and last name for all customers and the number of accounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show id, first name and last name for all customers and the number of accounts.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
What are the the full names and ids for all customers, and how many accounts does each have?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 the full names and ids for all customers, and how many accounts does each have?` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
Show first name and id for all customers with at least 2 accounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show first name and id for all customers with at least 2 accounts.` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2
What are the first names and ids for customers who have two or more accounts?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 first names and ids for customers who have two or more accounts?` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2
Show the number of customers.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the number of customers.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Customers
Count the number of customers.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Count the number of customers.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Customers
Show the number of customers for each gender.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the number of customers for each gender.` to a syntactically-correct PostgreSQL query.
SELECT gender , count(*) FROM Customers GROUP BY gender
How many customers are there of each gender?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 customers are there of each gender?` to a syntactically-correct PostgreSQL query.
SELECT gender , count(*) FROM Customers GROUP BY gender
How many transactions do we have?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 transactions do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Financial_transactions
Count the number of transactions.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Count the number of transactions.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Financial_transactions
How many transaction does each account have? Show the number and account id.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 transaction does each account have? Show the number and account id.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , account_id FROM Financial_transactions
Count the number of financial transactions that correspond to each account id.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Count the number of financial transactions that correspond to each account id.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , account_id FROM Financial_transactions
How many transaction does account with name 337 have?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 transaction does account with name 337 have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
Count the number of financial transactions that the account with the name 337 has.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Count the number of financial transactions that the account with the name 337 has.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
What is the average, minimum, maximum, and total transaction amount?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 average, minimum, maximum, and total transaction amount?` to a syntactically-correct PostgreSQL query.
SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
Return the average, minimum, maximum, and total transaction amounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Return the average, minimum, maximum, and total transaction amounts.` to a syntactically-correct PostgreSQL query.
SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
Show ids for all transactions whose amounts are greater than the average.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show ids for all transactions whose amounts are greater than the average.` to a syntactically-correct PostgreSQL query.
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
What are the ids for transactions that have an amount greater than the average amount of a transaction?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 for transactions that have an amount greater than the average amount of a transaction?` to a syntactically-correct PostgreSQL query.
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
Show the transaction types and the total amount of transactions.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the transaction types and the total amount of transactions.` to a syntactically-correct PostgreSQL query.
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
What are total transaction amounts for each transaction type?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 total transaction amounts for each transaction type?` to a syntactically-correct PostgreSQL query.
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
Show the account name, id and the number of transactions for each account.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the account name, id and the number of transactions for each account.` to a syntactically-correct PostgreSQL query.
SELECT T2.account_name , T1.account_id , count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id
Return the names and ids of each account, as well as the number of transactions.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Return the names and ids of each account, as well as the number of transactions.` to a syntactically-correct PostgreSQL query.
SELECT T2.account_name , T1.account_id , count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id
Show the account id with most number of transactions.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the account id with most number of transactions.` to a syntactically-correct PostgreSQL query.
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1
What is the id of the account with the most transactions?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 of the account with the most transactions?` to a syntactically-correct PostgreSQL query.
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1
Show the account id and name with at least 4 transactions.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the account id and name with at least 4 transactions.` to a syntactically-correct PostgreSQL query.
SELECT T1.account_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING count(*) >= 4
What are the ids and names of accounts with 4 or more transactions?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 accounts with 4 or more transactions?` to a syntactically-correct PostgreSQL query.
SELECT T1.account_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING count(*) >= 4
Show all product sizes.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show all product sizes.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_size FROM Products
What are the different product sizes?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 product sizes?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_size FROM Products
Show all product colors.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show all product colors.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_color FROM Products
What are the different product colors?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 product colors?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_color FROM Products
Show the invoice number and the number of transactions for each invoice.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']] -- Table: accounts columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']] -- Table: product categories columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']] -- Table: financial transactions columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']] -- Table: invoice line items columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 `Show the invoice number and the number of transactions for each invoice.` to a syntactically-correct PostgreSQL query.
SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number