target-benchmark/spider-queries huggingface dataset:
Database: e_learning (tables: subjects, courses)
Question: What are the subject ID, subject name, and the number of available courses for each subject?
SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id
Database: e_learning (tables: subjects, courses)
Question: Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.
SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC
Database: e_learning (tables: subjects, courses)
Question: List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.
SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC
Database: e_learning (tables: courses, student_course_enrolment)
Question: What is the date of enrollment of the course named "Spanish"?
SQL: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id WHERE T1.course_name  =  "Spanish"
Database: e_learning (tables: courses, student_course_enrolment)
Question: Find the the date of enrollment of the "Spanish" course.
SQL: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id WHERE T1.course_name  =  "Spanish"
Database: e_learning (tables: courses, student_course_enrolment)
Question: What is the name of the course that has the most student enrollment?
SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1
Database: e_learning (tables: courses, student_course_enrolment)
Question: Which course is enrolled in by the most students? Give me the course name.
SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1
Database: e_learning (tables: courses, student_course_enrolment)
Question: What are the names of the courses that have exactly 1 student enrollment?
SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  =  1
Database: e_learning (tables: courses, student_course_enrolment)
Question: Find the names of the courses that have just one student enrollment.
SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  =  1
Database: e_learning (tables: courses, student_course_enrolment)
Question: What are the descriptions and names of the courses that have student enrollment bigger than 2?
SQL: SELECT T1.course_description ,  T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  >  2
Database: e_learning (tables: courses, student_course_enrolment)
Question: Return the descriptions and names of the courses that have more than two students enrolled in.
SQL: SELECT T1.course_description ,  T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  >  2
Database: e_learning (tables: courses, student_course_enrolment)
Question: What is the name of each course and the corresponding number of student enrollment?
SQL: SELECT T1.course_name ,  COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name
Database: e_learning (tables: courses, student_course_enrolment)
Question: List the name and the number of enrolled student for each course.
SQL: SELECT T1.course_name ,  COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name
Database: e_learning (tables: student_tests_taken, student_course_enrolment)
Question: What are the enrollment dates of all the tests that have result "Pass"?
SQL: SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id  =  T2.registration_id WHERE T2.test_result  =  "Pass"
Database: e_learning (tables: student_tests_taken, student_course_enrolment)
Question: Find the enrollment date for all the tests that have "Pass" result.
SQL: SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id  =  T2.registration_id WHERE T2.test_result  =  "Pass"
Database: e_learning (tables: student_tests_taken, student_course_enrolment)
Question: What are the completion dates of all the tests that have result "Fail"?
SQL: SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id  =  T2.registration_id WHERE T2.test_result  =  "Fail"
Database: e_learning (tables: student_tests_taken, student_course_enrolment)
Question: Return the completion date for all the tests that have "Fail" result.
SQL: SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id  =  T2.registration_id WHERE T2.test_result  =  "Fail"
Database: e_learning (tables: student_course_enrolment, students)
Question: List the dates of enrollment and completion of the student with personal name "Karson".
SQL: SELECT T1.date_of_enrolment ,  T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id WHERE T2.personal_name  =  "Karson"
Database: e_learning (tables: student_course_enrolment, students)
Question: On what dates did the student whose personal name is "Karson" enroll in and complete the courses?
SQL: SELECT T1.date_of_enrolment ,  T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id WHERE T2.personal_name  =  "Karson"
Database: e_learning (tables: student_course_enrolment, students)
Question: List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie".
SQL: SELECT T1.date_of_enrolment ,  T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id WHERE T2.family_name  =  "Zieme" AND T2.personal_name  =  "Bernie"
Database: e_learning (tables: student_course_enrolment, students)
Question: On what dates did the student with family name "Zieme" and personal name "Bernie" enroll in and complete the courses?
SQL: SELECT T1.date_of_enrolment ,  T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id WHERE T2.family_name  =  "Zieme" AND T2.personal_name  =  "Bernie"
Database: e_learning (tables: student_course_enrolment, students)
Question: Find the student ID and login name of the student with the most course enrollments
SQL: SELECT T1.student_id ,  T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1
Database: e_learning (tables: student_course_enrolment, students)
Question: What are the student ID and login name of the student who are enrolled in the most courses?
SQL: SELECT T1.student_id ,  T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id  =  T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1
Database: e_learning (tables: student_course_enrolment, students)
Question: Find the student ID and personal name of the student with at least two enrollments.
SQL: SELECT T1.student_id ,  T2.personal_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
Database: e_learning (tables: student_course_enrolment, students)
Question: Which student are enrolled in at least two courses? Give me the student ID and personal name.
SQL: SELECT T1.student_id ,  T2.personal_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
Database: e_learning (tables: student_course_enrolment, students)
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
Database: e_learning (tables: student_course_enrolment, students)
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
Database: e_learning (tables: student_course_enrolment, students)
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
Database: e_learning (tables: student_course_enrolment, students)
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
Database: e_learning (tables: student_course_enrolment, students)
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)
Database: e_learning (tables: student_course_enrolment, students)
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)
Database: e_learning (tables: course_authors_and_tutors, students)
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
Database: e_learning (tables: course_authors_and_tutors, students)
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
Database: e_learning (tables: course_authors_and_tutors, students)
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
Database: e_learning (tables: course_authors_and_tutors, students)
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
Database: insurance_policies (tables: claims, settlements)
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 )
Database: insurance_policies (tables: claims, settlements)
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 )
Database: insurance_policies (tables: claims, customer_policies, customers)
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
Database: insurance_policies (tables: claims, customer_policies, customers)
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
Database: insurance_policies (tables: payments)
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
Database: insurance_policies (tables: payments)
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
Database: insurance_policies (tables: claims)
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
Database: insurance_policies (tables: claims)
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
Database: insurance_policies (tables: claims)
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
Database: insurance_policies (tables: claims)
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
Database: insurance_policies (tables: claims)
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 )
Database: insurance_policies (tables: claims)
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 )
Database: insurance_policies (tables: claims)
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 )
Database: insurance_policies (tables: claims)
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 )
Database: insurance_policies (tables: claims, settlements)
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
Database: insurance_policies (tables: claims, settlements)
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
Database: insurance_policies (tables: claims, settlements)
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
Database: insurance_policies (tables: claims, settlements)
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
Database: insurance_policies (tables: claims, settlements)
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
Database: insurance_policies (tables: claims, settlements)
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
Database: insurance_policies (tables: claims)
Question: Of all the claims, what was the earliest date when any claim was made?
SQL: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
Database: insurance_policies (tables: claims)
Question: Tell me the the date when the first claim was made.
SQL: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
Database: insurance_policies (tables: settlements)
Question: What is the total amount of settlement made for all the settlements?
SQL: SELECT sum(Amount_Settled) FROM Settlements
Database: insurance_policies (tables: settlements)
Question: Compute the total amount of settlement across all the settlements.
SQL: SELECT sum(Amount_Settled) FROM Settlements
Database: insurance_policies (tables: customer_policies, customers)
Question: Who are the customers that had more than 1 policy? 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(*)  >  1
Database: insurance_policies (tables: customer_policies, customers)
Question: Find the the customer details and id for the customers who had more than one policy.
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(*)  >  1
Database: insurance_policies (tables: settlements)
Question: What are the claim dates and settlement dates of all the settlements?
SQL: SELECT Date_Claim_Made ,  Date_Claim_Settled FROM Settlements
Database: insurance_policies (tables: settlements)
Question: Tell me the the claim date and settlement date for each settlement case.
SQL: SELECT Date_Claim_Made ,  Date_Claim_Settled FROM Settlements
Database: insurance_policies (tables: payments)
Question: What is the most popular payment method?
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1
Database: insurance_policies (tables: payments)
Question: Which payment method is used the most often?
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1
Database: insurance_policies (tables: payments)
Question: With which kind of payment method were the least number of payments processed?
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1
Database: insurance_policies (tables: payments)
Question: What is the payment method that were used the least often?
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1
Database: insurance_policies (tables: payments)
Question: What is the total amount of payment?
SQL: SELECT sum(Amount_Payment) FROM Payments
Database: insurance_policies (tables: payments)
Question: Compute the total amount of payment processed.
SQL: SELECT sum(Amount_Payment) FROM Payments
Database: insurance_policies (tables: customers)
Question: What are all the distinct details of the customers?
SQL: SELECT DISTINCT customer_details FROM Customers
Database: insurance_policies (tables: customers)
Question: Return the distinct customer details.
SQL: SELECT DISTINCT customer_details FROM Customers
Database: insurance_policies (tables: customer_policies)
Question: Which kind of policy type was chosen by the most customers?
SQL: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1
Database: insurance_policies (tables: customer_policies)
Question: Find the policy type the most customers choose.
SQL: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1
Database: insurance_policies (tables: settlements)
Question: How many settlements are there in total?
SQL: SELECT count(*) FROM Settlements
Database: insurance_policies (tables: settlements)
Question: Count the total number of settlements made.
SQL: SELECT count(*) FROM Settlements
Database: insurance_policies (tables: payments)
Question: Which Payments were processed with Visa? List the payment Id, the date and the amount.
SQL: SELECT Payment_ID ,  Date_Payment_Made ,  Amount_Payment FROM Payments WHERE Payment_Method_Code  =  'Visa'
Database: insurance_policies (tables: payments)
Question: Give me the payment Id, the date and the amount for all the payments processed with Visa.
SQL: SELECT Payment_ID ,  Date_Payment_Made ,  Amount_Payment FROM Payments WHERE Payment_Method_Code  =  'Visa'
Database: insurance_policies (tables: customer_policies, customers)
Question: List the details of the customers who do not have any policies.
SQL: SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id  =  T2.customer_id
Database: insurance_policies (tables: customer_policies, customers)
Question: Which customers do not have any policies? Find the details of these customers.
SQL: SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id  =  T2.customer_id
Database: insurance_policies (tables: claims, settlements)
Question: List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.
SQL: SELECT T1.claim_id ,  T1.date_claim_made ,  T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id  =  T2.Claim_id GROUP BY T1.claim_id HAVING count(*)  =  1
Database: insurance_policies (tables: claims, settlements)
Question: Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled.
SQL: SELECT T1.claim_id ,  T1.date_claim_made ,  T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id  =  T2.Claim_id GROUP BY T1.claim_id HAVING count(*)  =  1