brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Find the policy types more than 4 customers use. Show their type code.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 policy types more than 4 customers use. Show their type code.` to a syntactically-correct PostgreSQL query.
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*) > 4
Find the total and average amount of settlements.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the total and average amount of settlements.` to a syntactically-correct PostgreSQL query.
SELECT sum(settlement_amount) , avg(settlement_amount) FROM settlements
Return the sum and average of all settlement amounts.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 sum and average of all settlement amounts.` to a syntactically-correct PostgreSQL query.
SELECT sum(settlement_amount) , avg(settlement_amount) FROM settlements
Find the name of services that have been used for more than 2 times in first notification of loss.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the name of services that have been used for more than 2 times in first notification of loss.` to a syntactically-correct PostgreSQL query.
SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING count(*) > 2
Which services have been used more than twice in first notification of loss? Return the service name.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 services have been used more than twice in first notification of loss? Return the service name.` to a syntactically-correct PostgreSQL query.
SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING count(*) > 2
What is the effective date of the claim that has the largest amount of total settlement?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 effective date of the claim that has the largest amount of total settlement?` to a syntactically-correct PostgreSQL query.
SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY sum(t2.settlement_amount) DESC LIMIT 1
Find the claim that has the largest total settlement amount. Return the effective date of the claim.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 claim that has the largest total settlement amount. Return the effective date of the claim.` to a syntactically-correct PostgreSQL query.
SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY sum(t2.settlement_amount) DESC LIMIT 1
How many policies are listed for the customer named "Dayana Robel"?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 policies are listed for the customer named "Dayana Robel"?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Dayana Robel"
Count the total number of policies used by the customer named "Dayana Robel".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 total number of policies used by the customer named "Dayana Robel".` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Dayana Robel"
What is the name of the customer who has the most policies listed?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the name of the customer who has the most policies listed?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1
Which customer uses the most policies? Give me the customer name.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which customer uses the most policies? Give me the customer name.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1
What are all the policy types of the customer named "Dayana Robel"?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 all the policy types of the customer named "Dayana Robel"?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = "Dayana Robel"
Tell me the types of the policy used by the customer named "Dayana Robel".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 types of the policy used by the customer named "Dayana Robel".` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = "Dayana Robel"
What are all the policy types of the customer that has the most policies listed?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 all the policy types of the customer that has the most policies listed?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1)
List all the policy types used by the customer enrolled in the most policies.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all the policy types used by the customer enrolled in the most policies.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1)
List all the services in the alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all the services in the alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT service_name FROM services ORDER BY service_name
Give me a list of all the service names sorted alphabetically.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 me a list of all the service names sorted alphabetically.` to a syntactically-correct PostgreSQL query.
SELECT service_name FROM services ORDER BY service_name
How many services are there?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 services are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM services
Count the total number of available services.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 total number of available services.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM services
Find the names of users who do not have a first notification of loss record.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the names of users who do not have a first notification of loss record.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id
Which customers do not have a first notification of loss record? Give me the customer names.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which customers do not have a first notification of loss record? Give me the customer names.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id
Find the names of customers who have used either the service "Close a policy" or the service "Upgrade a policy".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the names of customers who have used either the service "Close a policy" or the service "Upgrade a policy".` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" OR t3.service_name = "Upgrade a policy"
Which customers have used the service named "Close a policy" or "Upgrade a policy"? Give me the customer names.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which customers have used the service named "Close a policy" or "Upgrade a policy"? Give me the customer names.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" OR t3.service_name = "Upgrade a policy"
Find the names of customers who have used both the service "Close a policy" and the service "New policy application".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the names of customers who have used both the service "Close a policy" and the service "New policy application".` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "New policy application"
Which customers have used both the service named "Close a policy" and the service named "Upgrade a policy"? Give me the customer names.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which customers have used both the service named "Close a policy" and the service named "Upgrade a policy"? Give me the customer names.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "New policy application"
Find the IDs of customers whose name contains "Diana".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 IDs of customers whose name contains "Diana".` to a syntactically-correct PostgreSQL query.
SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%"
What are the IDs of customers who have "Diana" in part of their names?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the IDs of customers who have "Diana" in part of their names?` to a syntactically-correct PostgreSQL query.
SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%"
What are the maximum and minimum settlement amount on record?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 maximum and minimum settlement amount on record?` to a syntactically-correct PostgreSQL query.
SELECT max(settlement_amount) , min(settlement_amount) FROM settlements
Find the maximum and minimum settlement amount.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 maximum and minimum settlement amount.` to a syntactically-correct PostgreSQL query.
SELECT max(settlement_amount) , min(settlement_amount) FROM settlements
List all the customers in increasing order of IDs.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all the customers in increasing order of IDs.` to a syntactically-correct PostgreSQL query.
SELECT customer_id , customer_name FROM customers ORDER BY customer_id ASC
What is the ordered list of customer ids?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 ordered list of customer ids?` to a syntactically-correct PostgreSQL query.
SELECT customer_id , customer_name FROM customers ORDER BY customer_id ASC
Retrieve the open and close dates of all the policies associated with the customer whose name contains "Diana"
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 `Retrieve the open and close dates of all the policies associated with the customer whose name contains "Diana"` to a syntactically-correct PostgreSQL query.
SELECT t2.date_opened , t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE "%Diana%"
What are the open and close dates of all the policies used by the customer who have "Diana" in part of their names?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text']] -- Table: services columns : [['service id', 'number'], ['service name', 'text']] -- Table: available policies columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']] -- Table: customers policies columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']] -- Table: first notification of loss columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']] -- Table: claims columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']] -- Table: settlements columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', '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 open and close dates of all the policies used by the customer who have "Diana" in part of their names?` to a syntactically-correct PostgreSQL query.
SELECT t2.date_opened , t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE "%Diana%"
How many kinds of enzymes are there?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 kinds of enzymes are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM enzyme
What is the total count of enzymes?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 total count of enzymes?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM enzyme
List the name of enzymes in descending lexicographical order.
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 name of enzymes in descending lexicographical order.` to a syntactically-correct PostgreSQL query.
SELECT name FROM enzyme ORDER BY name DESC
What are the names of enzymes in descending order?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names of enzymes in descending order?` to a syntactically-correct PostgreSQL query.
SELECT name FROM enzyme ORDER BY name DESC
List the names and the locations that the enzymes can make an effect.
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names and the locations that the enzymes can make an effect.` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION FROM enzyme
What are the names and locations of all enzymes listed?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names and locations of all enzymes listed?` to a syntactically-correct PostgreSQL query.
SELECT name , LOCATION FROM enzyme
What is the maximum Online Mendelian Inheritance in Man (OMIM) value of the enzymes?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 maximum Online Mendelian Inheritance in Man (OMIM) value of the enzymes?` to a syntactically-correct PostgreSQL query.
SELECT max(OMIM) FROM enzyme
What is the maximum OMIM value in the database?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 maximum OMIM value in the database?` to a syntactically-correct PostgreSQL query.
SELECT max(OMIM) FROM enzyme
What is the product, chromosome and porphyria related to the enzymes which take effect at the location 'Cytosol'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 product, chromosome and porphyria related to the enzymes which take effect at the location 'Cytosol'?` to a syntactically-correct PostgreSQL query.
SELECT product , chromosome , porphyria FROM enzyme WHERE LOCATION = 'Cytosol'
What is the product, chromosome, and porphyria of the enzymes located at 'Cytosol'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 product, chromosome, and porphyria of the enzymes located at 'Cytosol'?` to a syntactically-correct PostgreSQL query.
SELECT product , chromosome , porphyria FROM enzyme WHERE LOCATION = 'Cytosol'
What are the names of enzymes who does not produce 'Heme'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names of enzymes who does not produce 'Heme'?` to a syntactically-correct PostgreSQL query.
SELECT name FROM enzyme WHERE product != 'Heme'
What are the names of enzymes whose product is not 'Heme'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names of enzymes whose product is not 'Heme'?` to a syntactically-correct PostgreSQL query.
SELECT name FROM enzyme WHERE product != 'Heme'
What are the names and trade names of the medicines which has 'Yes' value in the FDA record?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names and trade names of the medicines which has 'Yes' value in the FDA record?` to a syntactically-correct PostgreSQL query.
SELECT name , trade_name FROM medicine WHERE FDA_approved = 'Yes'
What are the names and trade names of the medcines that are FDA approved?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names and trade names of the medcines that are FDA approved?` to a syntactically-correct PostgreSQL query.
SELECT name , trade_name FROM medicine WHERE FDA_approved = 'Yes'
What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'
What are the names of the enzymes used in the medicine Amisulpride that acts as inhibitors?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names of the enzymes used in the medicine Amisulpride that acts as inhibitors?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'
What are the ids and names of the medicine that can interact with two or more enzymes?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and names of the medicine that can interact with two or more enzymes?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING count(*) >= 2
For every medicine id, what are the names of the medicines that can interact with more than one enzyme?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 every medicine id, what are the names of the medicines that can interact with more than one enzyme?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING count(*) >= 2
What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with.
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with.` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.Name , T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC
What are the ids, names, and FDA approval status for medicines ordered by descending number of possible enzyme interactions?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids, names, and FDA approval status for medicines ordered by descending number of possible enzyme interactions?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.Name , T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC
What is the id and name of the enzyme with most number of medicines that can interact as 'activator'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 id and name of the enzyme with most number of medicines that can interact as 'activator'?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
What is the id and name of the enzyme that can interact with the most medicines as an activator?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 id and name of the enzyme that can interact with the most medicines as an activator?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?` to a syntactically-correct PostgreSQL query.
SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'
What is the type of interaction for the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 type of interaction for the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?` to a syntactically-correct PostgreSQL query.
SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'
What is the most common interaction type between enzymes and medicine? And how many are there?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 most common interaction type between enzymes and medicine? And how many are there?` to a syntactically-correct PostgreSQL query.
SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1
What are the most common types of interactions between enzymes and medicine, and how many types are there?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 most common types of interactions between enzymes and medicine, and how many types are there?` to a syntactically-correct PostgreSQL query.
SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1
How many medicines have the FDA approval status 'No' ?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 medicines have the FDA approval status 'No' ?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM medicine WHERE FDA_approved = 'No'
How many medicines were not approved by the FDA?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 medicines were not approved by the FDA?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM medicine WHERE FDA_approved = 'No'
How many enzymes do not have any interactions?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 enzymes do not have any interactions?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );
What is the count of enzymes without any interactions?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 count of enzymes without any interactions?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );
What is the id and trade name of the medicines can interact with at least 3 enzymes?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 id and trade name of the medicines can interact with at least 3 enzymes?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3
What are the ids and trade names of the medicine that can interact with at least 3 enzymes?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids and trade names of the medicine that can interact with at least 3 enzymes?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3
What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 distinct name, location and products of the enzymes which has any 'inhibitor' interaction?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'
What are the different names, locations, and products of the enzymes that are capable inhibitor interactions?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different names, locations, and products of the enzymes that are capable inhibitor interactions?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'
List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes.
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes.` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'
What are the medicine and trade names that can interact as an inhibitor and activitor with enzymes?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 medicine and trade names that can interact as an inhibitor and activitor with enzymes?` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'
Show the medicine names and trade names that cannot interact with the enzyme with product 'Heme'.
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 medicine names and trade names that cannot interact with the enzyme with product 'Heme'.` to a syntactically-correct PostgreSQL query.
SELECT name , trade_name FROM medicine EXCEPT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'
What are the medicine and trade names that cannot interact with the enzyme with the product 'Heme'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 medicine and trade names that cannot interact with the enzyme with the product 'Heme'?` to a syntactically-correct PostgreSQL query.
SELECT name , trade_name FROM medicine EXCEPT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'
How many distinct FDA approval statuses are there for the medicines?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 distinct FDA approval statuses are there for the medicines?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT FDA_approved) FROM medicine
How many different FDA approval statuses exist for medicines?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 different FDA approval statuses exist for medicines?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT FDA_approved) FROM medicine
Which enzyme names have the substring "ALA"?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 enzyme names have the substring "ALA"?` to a syntactically-correct PostgreSQL query.
SELECT name FROM enzyme WHERE name LIKE "%ALA%"
What are the names of enzymes that include the string 'ALA'?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 names of enzymes that include the string 'ALA'?` to a syntactically-correct PostgreSQL query.
SELECT name FROM enzyme WHERE name LIKE "%ALA%"
find the number of medicines offered by each trade.
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `find the number of medicines offered by each trade.` to a syntactically-correct PostgreSQL query.
SELECT trade_name , count(*) FROM medicine GROUP BY trade_name
How many medicines are offered by each trade name?
-- Language PostgreSQL -- Tables: -- Table: medicine columns : [['id', 'number'], ['name', 'text'], ['trade name', 'text'], ['fda approved', 'text']] -- Table: enzyme columns : [['id', 'number'], ['name', 'text'], ['location', 'text'], ['product', 'text'], ['chromosome', 'text'], ['omim', 'number'], ['porphyria', 'text']] -- Table: medicine enzyme interaction columns : [['enzyme id', 'number'], ['medicine id', 'number'], ['interaction type', '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 medicines are offered by each trade name?` to a syntactically-correct PostgreSQL query.
SELECT trade_name , count(*) FROM medicine GROUP BY trade_name
List all schools and their nicknames in the order of founded year.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all schools and their nicknames in the order of founded year.` to a syntactically-correct PostgreSQL query.
SELECT school , nickname FROM university ORDER BY founded
What are the different schools and their nicknames, ordered by their founding years?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different schools and their nicknames, ordered by their founding years?` to a syntactically-correct PostgreSQL query.
SELECT school , nickname FROM university ORDER BY founded
List all public schools and their locations.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all public schools and their locations.` to a syntactically-correct PostgreSQL query.
SELECT school , LOCATION FROM university WHERE affiliation = 'Public'
What are the public schools and what are their locations?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 public schools and what are their locations?` to a syntactically-correct PostgreSQL query.
SELECT school , LOCATION FROM university WHERE affiliation = 'Public'
When was the school with the largest enrollment founded?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 `When was the school with the largest enrollment founded?` to a syntactically-correct PostgreSQL query.
SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1
Return the founded year for the school with the largest enrollment.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 `Return the founded year for the school with the largest enrollment.` to a syntactically-correct PostgreSQL query.
SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1
Find the founded year of the newest non public school.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 founded year of the newest non public school.` to a syntactically-correct PostgreSQL query.
SELECT founded FROM university WHERE affiliation != 'Public' ORDER BY founded DESC LIMIT 1
What is the founded year of the non public school that was founded most recently?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 founded year of the non public school that was founded most recently?` to a syntactically-correct PostgreSQL query.
SELECT founded FROM university WHERE affiliation != 'Public' ORDER BY founded DESC LIMIT 1
How many schools are in the basketball match?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 schools are in the basketball match?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT school_id) FROM basketball_match
Count the number of schools that have had basketball matches.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 schools that have had basketball matches.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT school_id) FROM basketball_match
What is the highest acc percent score in the competition?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 highest acc percent score in the competition?` to a syntactically-correct PostgreSQL query.
SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1
Return the highest acc percent across all basketball matches.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 `Return the highest acc percent across all basketball matches.` to a syntactically-correct PostgreSQL query.
SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1
What is the primary conference of the school that has the lowest acc percent score in the competition?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 primary conference of the school that has the lowest acc percent score in the competition?` to a syntactically-correct PostgreSQL query.
SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent LIMIT 1
Return the primary conference of the school with the lowest acc percentage score.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 `Return the primary conference of the school with the lowest acc percentage score.` to a syntactically-correct PostgreSQL query.
SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent LIMIT 1
What is the team name and acc regular season score of the school that was founded for the longest time?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 team name and acc regular season score of the school that was founded for the longest time?` to a syntactically-correct PostgreSQL query.
SELECT t2.team_name , t2.ACC_Regular_Season FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t1.founded LIMIT 1
Return the name of the team and the acc during the regular season for the school that was founded the earliest.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 `Return the name of the team and the acc during the regular season for the school that was founded the earliest.` to a syntactically-correct PostgreSQL query.
SELECT t2.team_name , t2.ACC_Regular_Season FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t1.founded LIMIT 1
Find the location and all games score of the school that has Clemson as its team name.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 location and all games score of the school that has Clemson as its team name.` to a syntactically-correct PostgreSQL query.
SELECT t2.All_Games , t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson'
What are the all games score and location of the school called Clemson?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 all games score and location of the school called Clemson?` to a syntactically-correct PostgreSQL query.
SELECT t2.All_Games , t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson'
What are the average enrollment size of the universities that are founded before 1850?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 average enrollment size of the universities that are founded before 1850?` to a syntactically-correct PostgreSQL query.
SELECT avg(enrollment) FROM university WHERE founded < 1850
Return the average enrollment of universities founded before 1850.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 `Return the average enrollment of universities founded before 1850.` to a syntactically-correct PostgreSQL query.
SELECT avg(enrollment) FROM university WHERE founded < 1850
Show the enrollment and primary_conference of the oldest college.
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 enrollment and primary_conference of the oldest college.` to a syntactically-correct PostgreSQL query.
SELECT enrollment , primary_conference FROM university ORDER BY founded LIMIT 1
What are the enrollment and primary conference for the university which was founded the earliest?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 enrollment and primary conference for the university which was founded the earliest?` to a syntactically-correct PostgreSQL query.
SELECT enrollment , primary_conference FROM university ORDER BY founded LIMIT 1
What is the total and minimum enrollment of all schools?
-- Language PostgreSQL -- Tables: -- Table: basketball match columns : [['team id', 'number'], ['school id', 'number'], ['team name', 'text'], ['acc regular season', 'text'], ['acc percent', 'text'], ['acc home', 'text'], ['acc road', 'text'], ['all games', 'text'], ['all games percent', 'number'], ['all home', 'text'], ['all road', 'text'], ['all neutral', 'text']] -- Table: university columns : [['school id', 'number'], ['school', 'text'], ['location', 'text'], ['founded', 'number'], ['affiliation', 'text'], ['enrollment', 'number'], ['nickname', 'text'], ['primary conference', '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 total and minimum enrollment of all schools?` to a syntactically-correct PostgreSQL query.
SELECT sum(enrollment) , min(enrollment) FROM university