brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
How many customers are there in the customer type with the most customers?
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 customers are there in the customer type with the most customers?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1
Count the number of customers that have the customer type that is most common.
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 customers that have the customer type that is most common.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1
What is the last name of the staff who has handled the first ever complaint?
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 last name of the staff who has handled the first ever complaint?` to a syntactically-correct PostgreSQL query.
SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1
Return the last name of the staff member who handled the complaint with the earliest date raised.
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 `Return the last name of the staff member who handled the complaint with the earliest date raised.` to a syntactically-correct PostgreSQL query.
SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1
How many distinct complaint type codes are there in the database?
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 complaint type codes are there in the database?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT complaint_type_code) FROM complaints
Count the number of different complaint type codes.
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 different complaint type codes.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT complaint_type_code) FROM complaints
Find the address line 1 and 2 of the customer with email "vbogisich@example.org".
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 address line 1 and 2 of the customer with email "vbogisich@example.org".` to a syntactically-correct PostgreSQL query.
SELECT address_line_1 , address_line_2 FROM customers WHERE email_address = "vbogisich@example.org"
What are lines 1 and 2 of the addressed of the customer with the email "vbogisich@example.org"?
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 lines 1 and 2 of the addressed of the customer with the email "vbogisich@example.org"?` to a syntactically-correct PostgreSQL query.
SELECT address_line_1 , address_line_2 FROM customers WHERE email_address = "vbogisich@example.org"
Find the number of complaints with Product Failure type for each complaint status.
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 complaints with Product Failure type for each complaint status.` to a syntactically-correct PostgreSQL query.
SELECT complaint_status_code , count(*) FROM complaints WHERE complaint_type_code = "Product Failure" GROUP BY complaint_status_code
Of complaints with the type code "Product Failure", how many had each different status code?
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 `Of complaints with the type code "Product Failure", how many had each different status code?` to a syntactically-correct PostgreSQL query.
SELECT complaint_status_code , count(*) FROM complaints WHERE complaint_type_code = "Product Failure" GROUP BY complaint_status_code
What is first names of the top 5 staff who have handled the greatest number of complaints?
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 first names of the top 5 staff who have handled the greatest number of complaints?` to a syntactically-correct PostgreSQL query.
SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5
Return the first names of the 5 staff members who have handled the most complaints.
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 `Return the first names of the 5 staff members who have handled the most complaints.` to a syntactically-correct PostgreSQL query.
SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5
Which state has the most customers?
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 state has the most customers?` to a syntactically-correct PostgreSQL query.
SELECT state FROM customers GROUP BY state ORDER BY count(*) LIMIT 1
Give the state that has the most customers.
-- Language PostgreSQL -- Tables: -- Table: staff columns : [['staff id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer type code', 'text'], ['address line 1', 'text'], ['address line 2', 'text'], ['town city', 'text'], ['state', 'text'], ['email address', 'text'], ['phone number', 'text']] -- Table: products columns : [['product id', 'number'], ['parent product id', 'number'], ['product category code', 'text'], ['date product first available', 'time'], ['date product discontinued', 'time'], ['product name', 'text'], ['product description', 'text'], ['product price', 'number']] -- Table: complaints columns : [['complaint id', 'number'], ['product id', 'number'], ['customer id', 'number'], ['complaint outcome code', 'text'], ['complaint status code', 'text'], ['complaint type code', 'text'], ['date complaint raised', 'time'], ['date complaint closed', 'time'], ['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 `Give the state that has the most customers.` to a syntactically-correct PostgreSQL query.
SELECT state FROM customers GROUP BY state ORDER BY count(*) LIMIT 1
How many submissions are there?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many submissions are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM submission
Count the number of submissions.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of submissions.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM submission
List the authors of submissions in ascending order of scores.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the authors of submissions in ascending order of scores.` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission ORDER BY Scores ASC
Find the author for each submission and list them in ascending order of submission score.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the author for each submission and list them in ascending order of submission score.` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission ORDER BY Scores ASC
What are the authors of submissions and their colleges?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the authors of submissions and their colleges?` to a syntactically-correct PostgreSQL query.
SELECT Author , College FROM submission
For each submission, show the author and their affiliated college.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `For each submission, show the author and their affiliated college.` to a syntactically-correct PostgreSQL query.
SELECT Author , College FROM submission
Show the names of authors from college "Florida" or "Temple"
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the names of authors from college "Florida" or "Temple"` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission WHERE College = "Florida" OR College = "Temple"
Which authors with submissions are from college "Florida" or "Temple"?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which authors with submissions are from college "Florida" or "Temple"?` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission WHERE College = "Florida" OR College = "Temple"
What is the average score of submissions?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average score of submissions?` to a syntactically-correct PostgreSQL query.
SELECT avg(Scores) FROM submission
Compute the average score of submissions.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Compute the average score of submissions.` to a syntactically-correct PostgreSQL query.
SELECT avg(Scores) FROM submission
What is the author of the submission with the highest score?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the author of the submission with the highest score?` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1
Find the author who achieved the highest score in a submission.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the author who achieved the highest score in a submission.` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1
Show different colleges along with the number of authors of submission from each college.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show different colleges along with the number of authors of submission from each college.` to a syntactically-correct PostgreSQL query.
SELECT College , COUNT(*) FROM submission GROUP BY College
For each college, return the college name and the count of authors with submissions from that college.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `For each college, return the college name and the count of authors with submissions from that college.` to a syntactically-correct PostgreSQL query.
SELECT College , COUNT(*) FROM submission GROUP BY College
Show the most common college of authors of submissions.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the most common college of authors of submissions.` to a syntactically-correct PostgreSQL query.
SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1
Which college has the most authors with submissions?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which college has the most authors with submissions?` to a syntactically-correct PostgreSQL query.
SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1
Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80.` to a syntactically-correct PostgreSQL query.
SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80
Which colleges have both authors with submission score above 90 and authors with submission score below 80?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which colleges have both authors with submission score above 90 and authors with submission score below 80?` to a syntactically-correct PostgreSQL query.
SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80
Show the authors of submissions and the acceptance results of their submissions.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the authors of submissions and the acceptance results of their submissions.` to a syntactically-correct PostgreSQL query.
SELECT T2.Author , T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID
For each submission, find its author and acceptance result.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `For each submission, find its author and acceptance result.` to a syntactically-correct PostgreSQL query.
SELECT T2.Author , T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID
Show the result of the submission with the highest score.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the result of the submission with the highest score.` to a syntactically-correct PostgreSQL query.
SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1
Which submission received the highest score in acceptance result. Show me the result.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which submission received the highest score in acceptance result. Show me the result.` to a syntactically-correct PostgreSQL query.
SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1
Show each author and the number of workshops they submitted to.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show each author and the number of workshops they submitted to.` to a syntactically-correct PostgreSQL query.
SELECT T2.Author , COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author
How many workshops did each author submit to? Return the author name and the number of workshops.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many workshops did each author submit to? Return the author name and the number of workshops.` to a syntactically-correct PostgreSQL query.
SELECT T2.Author , COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author
Show the authors who have submissions to more than one workshop.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the authors who have submissions to more than one workshop.` to a syntactically-correct PostgreSQL query.
SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id) > 1
Which authors have submitted to more than one workshop?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which authors have submitted to more than one workshop?` to a syntactically-correct PostgreSQL query.
SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id) > 1
Show the date and venue of each workshop in ascending alphabetical order of the venue.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the date and venue of each workshop in ascending alphabetical order of the venue.` to a syntactically-correct PostgreSQL query.
SELECT Date , Venue FROM workshop ORDER BY Venue
Sort the each workshop in alphabetical order of the venue. Return the date and venue of each workshop.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Sort the each workshop in alphabetical order of the venue. Return the date and venue of each workshop.` to a syntactically-correct PostgreSQL query.
SELECT Date , Venue FROM workshop ORDER BY Venue
List the authors who do not have submission to any workshop.
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the authors who do not have submission to any workshop.` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission WHERE Submission_ID NOT IN (SELECT Submission_ID FROM acceptance)
Which authors did not submit to any workshop?
-- Language PostgreSQL -- Tables: -- Table: workshop columns : [['workshop id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text']] -- Table: submission columns : [['submission id', 'number'], ['scores', 'number'], ['author', 'text'], ['college', 'text']] -- Table: acceptance columns : [['submission id', 'number'], ['workshop id', 'number'], ['result', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which authors did not submit to any workshop?` to a syntactically-correct PostgreSQL query.
SELECT Author FROM submission WHERE Submission_ID NOT IN (SELECT Submission_ID FROM acceptance)
Find the number of investors in total.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 investors in total.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM INVESTORS
Show all investor details.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show all investor details.` to a syntactically-correct PostgreSQL query.
SELECT Investor_details FROM INVESTORS
Show all distinct lot details.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show all distinct lot details.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT lot_details FROM LOTS
Show the maximum amount of transaction.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the maximum amount of transaction.` to a syntactically-correct PostgreSQL query.
SELECT max(amount_of_transaction) FROM TRANSACTIONS
Show all date and share count of transactions.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show all date and share count of transactions.` to a syntactically-correct PostgreSQL query.
SELECT date_of_transaction , share_count FROM TRANSACTIONS
What is the total share of transactions?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 total share of transactions?` to a syntactically-correct PostgreSQL query.
SELECT sum(share_count) FROM TRANSACTIONS
Show all transaction ids with transaction code 'PUR'.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show all transaction ids with transaction code 'PUR'.` to a syntactically-correct PostgreSQL query.
SELECT transaction_id FROM TRANSACTIONS WHERE transaction_type_code = 'PUR'
Show all dates of transactions whose type code is "SALE".
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show all dates of transactions whose type code is "SALE".` to a syntactically-correct PostgreSQL query.
SELECT date_of_transaction FROM TRANSACTIONS WHERE transaction_type_code = "SALE"
Show the average amount of transactions with type code "SALE".
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the average amount of transactions with type code "SALE".` to a syntactically-correct PostgreSQL query.
SELECT avg(amount_of_transaction) FROM TRANSACTIONS WHERE transaction_type_code = "SALE"
Show the description of transaction type with code "PUR".
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the description of transaction type with code "PUR".` to a syntactically-correct PostgreSQL query.
SELECT transaction_type_description FROM Ref_Transaction_Types WHERE transaction_type_code = "PUR"
Show the minimum amount of transactions whose type code is "PUR" and whose share count is bigger than 50.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the minimum amount of transactions whose type code is "PUR" and whose share count is bigger than 50.` to a syntactically-correct PostgreSQL query.
SELECT min(amount_of_transaction) FROM TRANSACTIONS WHERE transaction_type_code = "PUR" AND share_count > 50
Show the maximum share count of transactions where the amount is smaller than 10000
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the maximum share count of transactions where the amount is smaller than 10000` to a syntactically-correct PostgreSQL query.
SELECT max(share_count) FROM TRANSACTIONS WHERE amount_of_transaction < 10000
Show the dates of transactions if the share count is bigger than 100 or the amount is bigger than 1000.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the dates of transactions if the share count is bigger than 100 or the amount is bigger than 1000.` to a syntactically-correct PostgreSQL query.
SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count > 100 OR amount_of_transaction > 1000
Show the transaction type descriptions and dates if the share count is smaller than 10.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the transaction type descriptions and dates if the share count is smaller than 10.` to a syntactically-correct PostgreSQL query.
SELECT T1.transaction_type_description , T2.date_of_transaction FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE T2.share_count < 10
Show details of all investors if they make any transaction with share count greater than 100.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show details of all investors if they make any transaction with share count greater than 100.` to a syntactically-correct PostgreSQL query.
SELECT T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.share_count > 100
How many distinct transaction types are used in the transactions?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 transaction types are used in the transactions?` to a syntactically-correct PostgreSQL query.
SELECT COUNT(DISTINCT transaction_type_code) FROM TRANSACTIONS
Return the lot details and investor ids.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Return the lot details and investor ids.` to a syntactically-correct PostgreSQL query.
SELECT lot_details , investor_id FROM LOTS
Return the lot details of lots that belong to investors with details "l"?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Return the lot details of lots that belong to investors with details "l"?` to a syntactically-correct PostgreSQL query.
SELECT T2.lot_details FROM INVESTORS AS T1 JOIN LOTS AS T2 ON T1.investor_id = T2.investor_id WHERE T1.Investor_details = "l"
What are the purchase details of transactions with amount bigger than 10000?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 purchase details of transactions with amount bigger than 10000?` to a syntactically-correct PostgreSQL query.
SELECT T1.purchase_details FROM PURCHASES AS T1 JOIN TRANSACTIONS AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000
What are the sale details and dates of transactions with amount smaller than 3000?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 sale details and dates of transactions with amount smaller than 3000?` to a syntactically-correct PostgreSQL query.
SELECT T1.sales_details , T2.date_of_transaction FROM SALES AS T1 JOIN TRANSACTIONS AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000
What are the lot details of lots associated with transactions with share count smaller than 50?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 lot details of lots associated with transactions with share count smaller than 50?` to a syntactically-correct PostgreSQL query.
SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id = T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id = T3.transaction_id WHERE T3.share_count < 50
What are the lot details of lots associated with transactions whose share count is bigger than 100 and whose type code is "PUR"?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 lot details of lots associated with transactions whose share count is bigger than 100 and whose type code is "PUR"?` to a syntactically-correct PostgreSQL query.
SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id = T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id = T3.transaction_id WHERE T3.share_count > 100 AND T3.transaction_type_code = "PUR"
Show the average transaction amount for different transaction types.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the average transaction amount for different transaction types.` to a syntactically-correct PostgreSQL query.
SELECT transaction_type_code , avg(amount_of_transaction) FROM TRANSACTIONS GROUP BY transaction_type_code
Show the maximum and minimum share count of different transaction types.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the maximum and minimum share count of different transaction types.` to a syntactically-correct PostgreSQL query.
SELECT transaction_type_code , max(share_count) , min(share_count) FROM TRANSACTIONS GROUP BY transaction_type_code
Show the average share count of transactions for different investors.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the average share count of transactions for different investors.` to a syntactically-correct PostgreSQL query.
SELECT investor_id , avg(share_count) FROM TRANSACTIONS GROUP BY investor_id
Show the average share count of transactions each each investor, ordered by average share count.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the average share count of transactions each each investor, ordered by average share count.` to a syntactically-correct PostgreSQL query.
SELECT investor_id , avg(share_count) FROM TRANSACTIONS GROUP BY investor_id ORDER BY avg(share_count)
Show the average amount of transactions for different investors.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the average amount of transactions for different investors.` to a syntactically-correct PostgreSQL query.
SELECT investor_id , avg(amount_of_transaction) FROM TRANSACTIONS GROUP BY investor_id
Show the average amount of transactions for different lots.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the average amount of transactions for different lots.` to a syntactically-correct PostgreSQL query.
SELECT T2.lot_id , avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id
Show the average amount of transactions for different lots, ordered by average amount of transactions.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the average amount of transactions for different lots, ordered by average amount of transactions.` to a syntactically-correct PostgreSQL query.
SELECT T2.lot_id , avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id ORDER BY avg(amount_of_transaction)
Show the number of transactions with transaction type code "SALE" for different investors if it is larger than 0.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the number of transactions with transaction type code "SALE" for different investors if it is larger than 0.` to a syntactically-correct PostgreSQL query.
SELECT investor_id , COUNT(*) FROM TRANSACTIONS WHERE transaction_type_code = "SALE" GROUP BY investor_id
Show the number of transactions for different investors.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the number of transactions for different investors.` to a syntactically-correct PostgreSQL query.
SELECT investor_id , COUNT(*) FROM TRANSACTIONS GROUP BY investor_id
Show the transaction type code that occurs the fewest times.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the transaction type code that occurs the fewest times.` to a syntactically-correct PostgreSQL query.
SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) ASC LIMIT 1
Show the transaction type code that occurs the most frequently.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the transaction type code that occurs the most frequently.` to a syntactically-correct PostgreSQL query.
SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1
Show the description of the transaction type that occurs most frequently.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the description of the transaction type that occurs most frequently.` to a syntactically-correct PostgreSQL query.
SELECT T1.transaction_type_description FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code GROUP BY T1.transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1
Show the id and details of the investor that has the largest number of transactions.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the id and details of the investor that has the largest number of transactions.` to a syntactically-correct PostgreSQL query.
SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 1
Show the id and details for the investors who have the top 3 number of transactions.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the id and details for the investors who have the top 3 number of transactions.` to a syntactically-correct PostgreSQL query.
SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3
Show the ids of the investors who have at least two transactions.
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the ids of the investors who have at least two transactions.` to a syntactically-correct PostgreSQL query.
SELECT T2.investor_id FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id HAVING COUNT(*) >= 2
Show the ids and details of the investors who have at least two transactions with type code "SALE".
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 `Show the ids and details of the investors who have at least two transactions with type code "SALE".` to a syntactically-correct PostgreSQL query.
SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.transaction_type_code = "SALE" GROUP BY T2.investor_id HAVING COUNT(*) >= 2
What are the dates of transactions with at least 100 share count or amount bigger than 100?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 dates of transactions with at least 100 share count or amount bigger than 100?` to a syntactically-correct PostgreSQL query.
SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count >= 100 OR amount_of_transaction >= 100
What are the details of all sales and purchases?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 details of all sales and purchases?` to a syntactically-correct PostgreSQL query.
SELECT sales_details FROM sales UNION SELECT purchase_details FROM purchases
What are the details of the lots which are not used in any transactions?
-- Language PostgreSQL -- Tables: -- Table: investors columns : [['investor id', 'number'], ['investor details', 'text']] -- Table: lots columns : [['lot id', 'number'], ['investor id', 'number'], ['lot details', 'text']] -- Table: reference transaction types columns : [['transaction type code', 'text'], ['transaction type description', 'text']] -- Table: transactions columns : [['transaction id', 'number'], ['investor id', 'number'], ['transaction type code', 'text'], ['date of transaction', 'time'], ['amount of transaction', 'number'], ['share count', 'text'], ['other details', 'text']] -- Table: sales columns : [['sales transaction id', 'number'], ['sales details', 'text']] -- Table: purchases columns : [['purchase transaction id', 'number'], ['purchase details', 'text']] -- Table: transactions lots columns : [['transaction id', 'number'], ['lot 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 details of the lots which are not used in any transactions?` to a syntactically-correct PostgreSQL query.
SELECT lot_details FROM Lots EXCEPT SELECT T1.lot_details FROM Lots AS T1 JOIN transactions_lots AS T2 ON T1.lot_id = T2.lot_id
How many available hotels are there in total?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 available hotels are there in total?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM HOTELS
Find the total number of available hotels.
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 number of available hotels.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM HOTELS
What are the price ranges of hotels?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 price ranges of hotels?` to a syntactically-correct PostgreSQL query.
SELECT price_range FROM HOTELS
Tell me the price ranges for all the hotels.
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 `Tell me the price ranges for all the hotels.` to a syntactically-correct PostgreSQL query.
SELECT price_range FROM HOTELS
Show all distinct location names.
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 `Show all distinct location names.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT Location_Name FROM LOCATIONS
What are the distinct location names?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature id', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the distinct location names?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT Location_Name FROM LOCATIONS
Show the names and details of all the staff members.
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 `Show the names and details of all the staff members.` to a syntactically-correct PostgreSQL query.
SELECT Name , Other_Details FROM Staff
What is the name and detail of each staff member?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 and detail of each staff member?` to a syntactically-correct PostgreSQL query.
SELECT Name , Other_Details FROM Staff
Show details of all visitors.
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 `Show details of all visitors.` to a syntactically-correct PostgreSQL query.
SELECT Tourist_Details FROM VISITORS
What is the detail of each visitor?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 detail of each visitor?` to a syntactically-correct PostgreSQL query.
SELECT Tourist_Details FROM VISITORS
Show the price ranges of hotels with 5 star ratings.
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 `Show the price ranges of hotels with 5 star ratings.` to a syntactically-correct PostgreSQL query.
SELECT price_range FROM HOTELS WHERE star_rating_code = "5"
What are the price ranges of five star hotels?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 price ranges of five star hotels?` to a syntactically-correct PostgreSQL query.
SELECT price_range FROM HOTELS WHERE star_rating_code = "5"
Show the average price range of hotels that have 5 star ratings and allow pets.
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 `Show the average price range of hotels that have 5 star ratings and allow pets.` to a syntactically-correct PostgreSQL query.
SELECT avg(price_range) FROM HOTELS WHERE star_rating_code = "5" AND pets_allowed_yn = 1
What is the average price range of five star hotels that allow pets?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 average price range of five star hotels that allow pets?` to a syntactically-correct PostgreSQL query.
SELECT avg(price_range) FROM HOTELS WHERE star_rating_code = "5" AND pets_allowed_yn = 1
What is the address of the location "UK Gallery"?
-- Language PostgreSQL -- Tables: -- Table: ref hotel star ratings columns : [['star rating code', 'text'], ['star rating description', 'text']] -- Table: locations columns : [['location id', 'number'], ['location name', 'text'], ['address', 'text'], ['other details', 'text']] -- Table: ref attraction types columns : [['attraction type code', 'text'], ['attraction type description', 'text']] -- Table: visitors columns : [['tourist id', 'number'], ['tourist details', 'text']] -- Table: features columns : [['feature id', 'number'], ['feature details', 'text']] -- Table: hotels columns : [['hotel id', 'number'], ['star rating code', 'text'], ['pets allowed yn', 'text'], ['price range', 'number'], ['other hotel details', 'text']] -- Table: tourist attractions columns : [['tourist attraction id', 'number'], ['attraction type code', 'text'], ['location id', 'number'], ['how to get there', 'text'], ['name', 'text'], ['description', 'text'], ['opening hours', 'text'], ['other details', 'text']] -- Table: street markets columns : [['market id', 'number'], ['market details', 'text']] -- Table: shops columns : [['shop id', 'number'], ['shop details', 'text']] -- Table: museums columns : [['museum id', 'number'], ['museum details', 'text']] -- Table: royal family columns : [['royal family id', 'number'], ['royal family details', 'text']] -- Table: theme parks columns : [['theme park id', 'number'], ['theme park details', 'text']] -- Table: visits columns : [['visit id', 'number'], ['tourist attraction id', 'number'], ['tourist id', 'number'], ['visit date', 'time'], ['visit details', 'text']] -- Table: photos columns : [['photo id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['description', 'text'], ['filename', 'text'], ['other details', 'text']] -- Table: staff columns : [['staff id', 'number'], ['tourist attraction id', 'number'], ['name', 'text'], ['other details', 'text']] -- Table: tourist attraction features columns : [['tourist attraction id', 'number'], ['feature 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 address of the location "UK Gallery"?` to a syntactically-correct PostgreSQL query.
SELECT Address FROM LOCATIONS WHERE Location_Name = "UK Gallery"