sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the student ID and middle name for all the students with at most two enrollments.
SQL: SELECT T1.student_id ,  T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id GROUP BY T1.student_id HAVING COUNT(*)  <=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the student IDs and middle names of the students enrolled in at most two courses?
SQL: SELECT T1.student_id ,  T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id GROUP BY T1.student_id HAVING COUNT(*)  <=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the personal names of students not enrolled in any course.
SQL: SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id  =  T2.student_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which students not enrolled in any course? Find their personal names.
SQL: SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id  =  T2.student_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many students did not have any course enrollment?
SQL: SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment)
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Count the number of students who did not enroll in any course.
SQL: SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment)
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the common login name of course authors and students.
SQL: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the login names used both by some course authors and some students?
SQL: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the common personal name of course authors and students.
SQL: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
-- Language PostgreSQL
        -- Tables: 
             -- Table: course authors and tutors 
columns : [['author id', 'number'], ['author tutor atb', 'text'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text'], ['gender mf', 'text'], ['address line 1', 'text']]

 -- Table: students 
columns : [['student id', 'number'], ['date of registration', 'time'], ['date of latest logon', 'time'], ['login name', 'text'], ['password', 'text'], ['personal name', 'text'], ['middle name', 'text'], ['family name', 'text']]

 -- Table: subjects 
columns : [['subject id', 'number'], ['subject name', 'text']]

 -- Table: courses 
columns : [['course id', 'number'], ['author id', 'number'], ['subject id', 'number'], ['course name', 'text'], ['course description', 'text']]

 -- Table: student course enrolment 
columns : [['registration id', 'number'], ['student id', 'number'], ['course id', 'number'], ['date of enrolment', 'time'], ['date of completion', 'time']]

 -- Table: student tests taken 
columns : [['registration id', 'number'], ['date test taken', 'time'], ['test result', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the personal names used both by some course authors and some students?
SQL: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.
SQL: SELECT T1.Date_Claim_Made ,  T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id  =  T2.Claim_id GROUP BY T1.Claim_id HAVING count(*)  >  2 UNION SELECT T1.Date_Claim_Made ,  T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id  =  T2.Claim_id WHERE T1.Amount_Claimed  =  ( SELECT max(Amount_Claimed) FROM Claims )
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 claims that led to more than two settlements or have the maximum claim value. For each of them, return the date the claim was made and the id of the claim.
SQL: SELECT T1.Date_Claim_Made ,  T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id  =  T2.Claim_id GROUP BY T1.Claim_id HAVING count(*)  >  2 UNION SELECT T1.Date_Claim_Made ,  T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id  =  T2.Claim_id WHERE T1.Amount_Claimed  =  ( SELECT max(Amount_Claimed) FROM Claims )
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 had at least 2 policies but did not file any claims? List the customer details and id.
SQL: SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >=  2 EXCEPT SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.customer_id JOIN Claims AS T3 ON T2.policy_id  =  T3.policy_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 the the customer details and id for the customers who had two or more policies but did not file any claims.
SQL: SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >=  2 EXCEPT SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.customer_id JOIN Claims AS T3 ON T2.policy_id  =  T3.policy_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 the method, date and amount of all the payments, in ascending order of date.
SQL: SELECT Payment_Method_Code ,  Date_Payment_Made ,  Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 method, date and amount of each payment? Sort the list in ascending order of date.
SQL: SELECT Payment_Method_Code ,  Date_Payment_Made ,  Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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: Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.
SQL: SELECT Amount_Settled ,  Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.
SQL: SELECT Amount_Settled ,  Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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: Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount.
SQL: SELECT Amount_Settled ,  Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.
SQL: SELECT Amount_Settled ,  Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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: Among all the claims, which claims have a claimed amount larger than the average? List the date the claim was made and the date it was settled.
SQL: SELECT Date_Claim_Made ,  Date_Claim_Settled FROM Claims WHERE Amount_Claimed  >  ( SELECT avg(Amount_Claimed) FROM Claims )
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 the claim date, settlement date for all the claims whose claimed amount is larger than the average.
SQL: SELECT Date_Claim_Made ,  Date_Claim_Settled FROM Claims WHERE Amount_Claimed  >  ( SELECT avg(Amount_Claimed) FROM Claims )
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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: Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.
SQL: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled  <=  ( SELECT avg(Amount_Settled) FROM Claims )
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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: Return the claim start date for the claims whose claimed amount is no more than the average
SQL: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled  <=  ( SELECT avg(Amount_Settled) FROM Claims )
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 settlements does each claim correspond to? List the claim id and the number of settlements.
SQL: SELECT T1.Claim_id ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 number of settlements each claim corresponds to. Show the number together with the claim id.
SQL: SELECT T1.Claim_id ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
SQL: SELECT T1.claim_id ,  T1.date_claim_made ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 id and claim date of the claim that incurred the most settlement count. Also tell me the count.
SQL: SELECT T1.claim_id ,  T1.date_claim_made ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.
SQL: SELECT count(*) ,  T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer details', 'text']]

 -- Table: customer policies 
columns : [['policy id', 'number'], ['customer id', 'number'], ['policy type code', 'text'], ['start date', 'time'], ['end date', 'time']]

 -- Table: claims 
columns : [['claim id', 'number'], ['policy id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['date claim made', 'time'], ['date claim settled', 'time'], ['amount claimed', 'number'], ['amount settled', 'number'], ['customer policy id', 'number']]

 -- Table: payments 
columns : [['payment id', 'number'], ['settlement id', 'number'], ['payment method code', 'text'], ['date payment made', 'time'], ['amount payment', '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 id and the number of settlements made for the claim with the most recent settlement date.
SQL: SELECT count(*) ,  T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1