sert121/SpiderSQL huggingface dataset:
-- 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.



Question: Which services have been used more than twice in first notification of loss? Return the service name.
SQL: 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
-- 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.



Question: What is the effective date of the claim that has the largest amount of total settlement?
SQL: 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
-- 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.



Question: Find the claim that has the largest total settlement amount. Return the effective date of the claim.
SQL: 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
-- 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.



Question: How many policies are listed for the customer named "Dayana Robel"?
SQL: SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.customer_name  =  "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.



Question: Count the total number of policies used by the customer named "Dayana Robel".
SQL: SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id  =  t2.customer_id WHERE t1.customer_name  =  "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.



Question: What is the name of the customer who has the most policies listed?
SQL: 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
-- 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.



Question: Which customer uses the most policies? Give me the customer name.
SQL: 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
-- 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.



Question: What are all the policy types of the customer named "Dayana Robel"?
SQL: 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"
-- 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.



Question: Tell me the types of the policy used by the customer named "Dayana Robel".
SQL: 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"
-- 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.



Question: What are all the policy types of the customer that has the most policies listed?
SQL: 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)
-- 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.



Question: List all the policy types used by the customer enrolled in the most policies.
SQL: 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)
-- 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.



Question: List all the services in the alphabetical order.
SQL: SELECT service_name FROM services ORDER BY 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.



Question: Give me a list of all the service names sorted alphabetically.
SQL: SELECT service_name FROM services ORDER BY 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.



Question: How many services are there?
SQL: SELECT count(*) FROM 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.



Question: Count the total number of available services.
SQL: SELECT count(*) FROM 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.



Question: Find the names of users who do not have a first notification of loss record.
SQL: 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
-- 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.



Question: Which customers do not have a first notification of loss record? Give me the customer names.
SQL: 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
-- 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.



Question: Find the names of customers who have used either the service "Close a policy" or the service "Upgrade a policy".
SQL: 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"
-- 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.



Question: Which customers have used the service named "Close a policy" or "Upgrade a policy"? Give me the customer names.
SQL: 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"
-- 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.



Question: Find the names of customers who have used both the service "Close a policy" and the service "New policy application".
SQL: 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"
-- 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.



Question: Which customers have used both the service named "Close a policy" and the service named "Upgrade a policy"? Give me the customer names.
SQL: 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"
-- 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.



Question: Find the IDs of customers whose name contains "Diana".
SQL: SELECT customer_id FROM customers WHERE customer_name LIKE "%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.



Question: What are the IDs of customers who have "Diana" in part of their names?
SQL: SELECT customer_id FROM customers WHERE customer_name LIKE "%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.



Question: What are the maximum and minimum settlement amount on record?
SQL: SELECT max(settlement_amount) ,  min(settlement_amount) FROM 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.



Question: Find the maximum and minimum settlement amount.
SQL: SELECT max(settlement_amount) ,  min(settlement_amount) FROM 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.



Question: List all the customers in increasing order of IDs.
SQL: SELECT customer_id ,  customer_name FROM customers ORDER BY customer_id ASC
-- 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.



Question: What is the ordered list of customer ids?
SQL: SELECT customer_id ,  customer_name FROM customers ORDER BY customer_id ASC
-- 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.



Question: Retrieve the open and close dates of all the policies associated with the customer whose name contains "Diana"
SQL: 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%"
-- 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.



Question: What are the open and close dates of all the policies used by the customer who have "Diana" in part of their names?
SQL: 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%"
-- 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.



Question: How many kinds of enzymes are there?
SQL: SELECT count(*) FROM 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.



Question: What is the total count of enzymes?
SQL: SELECT count(*) FROM 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.



Question: List the name of enzymes in descending lexicographical order.
SQL: SELECT name FROM enzyme ORDER BY name DESC
-- 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.



Question: What are the names of enzymes in descending order?
SQL: SELECT name FROM enzyme ORDER BY name DESC
-- 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.



Question: List the names and the locations that the enzymes can make an effect.
SQL: SELECT name ,  LOCATION FROM 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.



Question: What are the names and locations of all enzymes listed?
SQL: SELECT name ,  LOCATION FROM enzyme