query_id
int64
0
7k
database_id
stringclasses
140 values
table_id
sequencelengths
1
5
query
stringlengths
16
224
answer
stringlengths
18
577
difficulty
stringclasses
4 values
3,800
e_learning
[ "Student_Tests_Taken" ]
For each distinct test result, find the number of students who got the result.
SELECT test_result , COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC
extra
3,801
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
Find the login name of the course author that teaches the course with name "advanced database".
SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "advanced database"
medium
3,802
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
Which course author teaches the "advanced database" course? Give me his or her login name.
SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "advanced database"
medium
3,803
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
Find the addresses of the course authors who teach the course with name "operating system" or "data structure".
SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "operating system" OR T2.course_name = "data structure"
hard
3,804
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
What are the addresses of the course authors who teach either "operating system" or "data structure" course.
SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "operating system" OR T2.course_name = "data structure"
hard
3,805
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
Find the personal name, family name, and author ID of the course author that teaches the most courses.
SELECT T1.personal_name , T1.family_name , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1
extra
3,806
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
What are the personal name, family name, and author ID of the course author who teaches the most courses?
SELECT T1.personal_name , T1.family_name , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1
extra
3,807
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
Find the addresses and author IDs of the course authors that teach at least two courses.
SELECT T1.address_line_1 , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id HAVING Count(*) >= 2
medium
3,808
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
Which course authors teach two or more courses? Give me their addresses and author IDs.
SELECT T1.address_line_1 , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id HAVING Count(*) >= 2
medium
3,809
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
Find the names of courses taught by the tutor who has personal name "Julio".
SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = "Julio"
medium
3,810
e_learning
[ "Course_Authors_and_Tutors", "Courses" ]
What are the names of the courses taught by the tutor whose personal name is "Julio"?
SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = "Julio"
medium
3,811
e_learning
[ "Subjects", "Courses" ]
Find the names and descriptions of courses that belong to the subject named "Computer Science".
SELECT T1.course_name , T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = "Computer Science"
medium
3,812
e_learning
[ "Subjects", "Courses" ]
What are the names and descriptions of the all courses under the "Computer Science" subject?
SELECT T1.course_name , T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = "Computer Science"
medium
3,813
e_learning
[ "Subjects", "Courses" ]
Find the subject ID, subject name, and the corresponding number of available courses for each subject.
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
medium
3,814
e_learning
[ "Subjects", "Courses" ]
What are the subject ID, subject name, and the number of available courses for each subject?
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
medium
3,815
e_learning
[ "Subjects", "Courses" ]
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.
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
hard
3,816
e_learning
[ "Subjects", "Courses" ]
List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.
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
hard
3,817
e_learning
[ "Courses", "Student_Course_Enrolment" ]
What is the date of enrollment of the course named "Spanish"?
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"
medium
3,818
e_learning
[ "Courses", "Student_Course_Enrolment" ]
Find the the date of enrollment of the "Spanish" course.
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"
medium
3,819
e_learning
[ "Courses", "Student_Course_Enrolment" ]
What is the name of the course that has the most student enrollment?
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
extra
3,820
e_learning
[ "Courses", "Student_Course_Enrolment" ]
Which course is enrolled in by the most students? Give me the course name.
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
extra
3,821
e_learning
[ "Courses", "Student_Course_Enrolment" ]
What are the names of the courses that have exactly 1 student enrollment?
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
medium
3,822
e_learning
[ "Courses", "Student_Course_Enrolment" ]
Find the names of the courses that have just one student enrollment.
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
medium
3,823
e_learning
[ "Courses", "Student_Course_Enrolment" ]
What are the descriptions and names of the courses that have student enrollment bigger than 2?
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
medium
3,824
e_learning
[ "Courses", "Student_Course_Enrolment" ]
Return the descriptions and names of the courses that have more than two students enrolled in.
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
medium
3,825
e_learning
[ "Courses", "Student_Course_Enrolment" ]
What is the name of each course and the corresponding number of student enrollment?
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
medium
3,826
e_learning
[ "Courses", "Student_Course_Enrolment" ]
List the name and the number of enrolled student for each course.
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
medium
3,827
e_learning
[ "Student_Tests_Taken", "Student_Course_Enrolment" ]
What are the enrollment dates of all the tests that have result "Pass"?
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"
medium
3,828
e_learning
[ "Student_Tests_Taken", "Student_Course_Enrolment" ]
Find the enrollment date for all the tests that have "Pass" result.
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"
medium
3,829
e_learning
[ "Student_Tests_Taken", "Student_Course_Enrolment" ]
What are the completion dates of all the tests that have result "Fail"?
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"
medium
3,830
e_learning
[ "Student_Tests_Taken", "Student_Course_Enrolment" ]
Return the completion date for all the tests that have "Fail" result.
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"
medium
3,831
e_learning
[ "Student_Course_Enrolment", "Students" ]
List the dates of enrollment and completion of the student with personal name "Karson".
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"
medium
3,832
e_learning
[ "Student_Course_Enrolment", "Students" ]
On what dates did the student whose personal name is "Karson" enroll in and complete the courses?
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"
medium
3,833
e_learning
[ "Student_Course_Enrolment", "Students" ]
List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie".
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"
extra
3,834
e_learning
[ "Student_Course_Enrolment", "Students" ]
On what dates did the student with family name "Zieme" and personal name "Bernie" enroll in and complete the courses?
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"
extra
3,835
e_learning
[ "Student_Course_Enrolment", "Students" ]
Find the student ID and login name of the student with the most course enrollments
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
extra
3,836
e_learning
[ "Student_Course_Enrolment", "Students" ]
What are the student ID and login name of the student who are enrolled in the most courses?
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
extra
3,837
e_learning
[ "Student_Course_Enrolment", "Students" ]
Find the student ID and personal name of the student with at least two enrollments.
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
medium
3,838
e_learning
[ "Student_Course_Enrolment", "Students" ]
Which student are enrolled in at least two courses? Give me the student ID and personal name.
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
medium
3,839
e_learning
[ "Student_Course_Enrolment", "Students" ]
Find the student ID and middle name for all the students with at most two enrollments.
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
medium
3,840
e_learning
[ "Student_Course_Enrolment", "Students" ]
What are the student IDs and middle names of the students enrolled in at most two courses?
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
medium
3,841
e_learning
[ "Student_Course_Enrolment", "Students" ]
Find the personal names of students not enrolled in any course.
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
hard
3,842
e_learning
[ "Student_Course_Enrolment", "Students" ]
Which students not enrolled in any course? Find their personal names.
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
hard
3,843
e_learning
[ "Student_Course_Enrolment", "Students" ]
How many students did not have any course enrollment?
SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment)
extra
3,844
e_learning
[ "Student_Course_Enrolment", "Students" ]
Count the number of students who did not enroll in any course.
SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment)
extra
3,845
e_learning
[ "Course_Authors_and_Tutors", "Students" ]
Find the common login name of course authors and students.
SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students
hard
3,846
e_learning
[ "Course_Authors_and_Tutors", "Students" ]
What are the login names used both by some course authors and some students?
SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students
hard
3,847
e_learning
[ "Course_Authors_and_Tutors", "Students" ]
Find the common personal name of course authors and students.
SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
hard
3,848
e_learning
[ "Course_Authors_and_Tutors", "Students" ]
What are the personal names used both by some course authors and some students?
SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
hard
3,849
insurance_policies
[ "Claims", "Settlements" ]
Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.
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 )
extra
3,850
insurance_policies
[ "Claims", "Settlements" ]
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.
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 )
extra
3,851
insurance_policies
[ "Claims", "Customer_Policies", "Customers" ]
Which customer had at least 2 policies but did not file any claims? List the customer details and id.
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
extra
3,852
insurance_policies
[ "Claims", "Customer_Policies", "Customers" ]
Give me the the customer details and id for the customers who had two or more policies but did not file any claims.
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
extra
3,853
insurance_policies
[ "Payments" ]
List the method, date and amount of all the payments, in ascending order of date.
SELECT Payment_Method_Code , Date_Payment_Made , Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC
medium
3,854
insurance_policies
[ "Payments" ]
What are the method, date and amount of each payment? Sort the list in ascending order of date.
SELECT Payment_Method_Code , Date_Payment_Made , Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC
medium
3,855
insurance_policies
[ "Claims" ]
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.
SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
medium
3,856
insurance_policies
[ "Claims" ]
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.
SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
medium
3,857
insurance_policies
[ "Claims" ]
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.
SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1
medium
3,858
insurance_policies
[ "Claims" ]
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.
SELECT Amount_Settled , Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC LIMIT 1
medium
3,859
insurance_policies
[ "Claims" ]
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.
SELECT Date_Claim_Made , Date_Claim_Settled FROM Claims WHERE Amount_Claimed > ( SELECT avg(Amount_Claimed) FROM Claims )
extra
3,860
insurance_policies
[ "Claims" ]
Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average.
SELECT Date_Claim_Made , Date_Claim_Settled FROM Claims WHERE Amount_Claimed > ( SELECT avg(Amount_Claimed) FROM Claims )
extra
3,861
insurance_policies
[ "Claims" ]
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.
SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= ( SELECT avg(Amount_Settled) FROM Claims )
hard
3,862
insurance_policies
[ "Claims" ]
Return the claim start date for the claims whose claimed amount is no more than the average
SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= ( SELECT avg(Amount_Settled) FROM Claims )
hard
3,863
insurance_policies
[ "Claims", "Settlements" ]
How many settlements does each claim correspond to? List the claim id and the number of settlements.
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
medium
3,864
insurance_policies
[ "Claims", "Settlements" ]
Find the number of settlements each claim corresponds to. Show the number together with the claim id.
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
medium
3,865
insurance_policies
[ "Claims", "Settlements" ]
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
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
extra
3,866
insurance_policies
[ "Claims", "Settlements" ]
Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.
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
extra
3,867
insurance_policies
[ "Claims", "Settlements" ]
How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.
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
extra
3,868
insurance_policies
[ "Claims", "Settlements" ]
Find the claim id and the number of settlements made for the claim with the most recent settlement date.
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
extra
3,869
insurance_policies
[ "Claims" ]
Of all the claims, what was the earliest date when any claim was made?
SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
medium
3,870
insurance_policies
[ "Claims" ]
Tell me the the date when the first claim was made.
SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
medium
3,871
insurance_policies
[ "Settlements" ]
What is the total amount of settlement made for all the settlements?
SELECT sum(Amount_Settled) FROM Settlements
easy
3,872
insurance_policies
[ "Settlements" ]
Compute the total amount of settlement across all the settlements.
SELECT sum(Amount_Settled) FROM Settlements
easy
3,873
insurance_policies
[ "Customer_Policies", "Customers" ]
Who are the customers that had more than 1 policy? List the customer details and id.
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
medium
3,874
insurance_policies
[ "Customer_Policies", "Customers" ]
Find the the customer details and id for the customers who had more than one policy.
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
medium
3,875
insurance_policies
[ "Settlements" ]
What are the claim dates and settlement dates of all the settlements?
SELECT Date_Claim_Made , Date_Claim_Settled FROM Settlements
medium
3,876
insurance_policies
[ "Settlements" ]
Tell me the the claim date and settlement date for each settlement case.
SELECT Date_Claim_Made , Date_Claim_Settled FROM Settlements
medium
3,877
insurance_policies
[ "Payments" ]
What is the most popular payment method?
SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1
hard
3,878
insurance_policies
[ "Payments" ]
Which payment method is used the most often?
SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) DESC LIMIT 1
hard
3,879
insurance_policies
[ "Payments" ]
With which kind of payment method were the least number of payments processed?
SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1
hard
3,880
insurance_policies
[ "Payments" ]
What is the payment method that were used the least often?
SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1
hard
3,881
insurance_policies
[ "Payments" ]
What is the total amount of payment?
SELECT sum(Amount_Payment) FROM Payments
easy
3,882
insurance_policies
[ "Payments" ]
Compute the total amount of payment processed.
SELECT sum(Amount_Payment) FROM Payments
easy
3,883
insurance_policies
[ "Customers" ]
What are all the distinct details of the customers?
SELECT DISTINCT customer_details FROM Customers
easy
3,884
insurance_policies
[ "Customers" ]
Return the distinct customer details.
SELECT DISTINCT customer_details FROM Customers
easy
3,885
insurance_policies
[ "Customer_Policies" ]
Which kind of policy type was chosen by the most customers?
SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1
hard
3,886
insurance_policies
[ "Customer_Policies" ]
Find the policy type the most customers choose.
SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY count(*) DESC LIMIT 1
hard
3,887
insurance_policies
[ "Settlements" ]
How many settlements are there in total?
SELECT count(*) FROM Settlements
easy
3,888
insurance_policies
[ "Settlements" ]
Count the total number of settlements made.
SELECT count(*) FROM Settlements
easy
3,889
insurance_policies
[ "Payments" ]
Which Payments were processed with Visa? List the payment Id, the date and the amount.
SELECT Payment_ID , Date_Payment_Made , Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'
medium
3,890
insurance_policies
[ "Payments" ]
Give me the payment Id, the date and the amount for all the payments processed with Visa.
SELECT Payment_ID , Date_Payment_Made , Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'
medium
3,891
insurance_policies
[ "Customer_Policies", "Customers" ]
List the details of the customers who do not have any policies.
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
hard
3,892
insurance_policies
[ "Customer_Policies", "Customers" ]
Which customers do not have any policies? Find the details of these customers.
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
hard
3,893
insurance_policies
[ "Claims", "Settlements" ]
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.
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
medium
3,894
insurance_policies
[ "Claims", "Settlements" ]
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.
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
medium
3,895
insurance_policies
[ "Claims" ]
Find the total claimed amount of all the claims.
SELECT sum(Amount_Claimed) FROM Claims
easy
3,896
insurance_policies
[ "Claims" ]
What is total amount claimed summed across all the claims?
SELECT sum(Amount_Claimed) FROM Claims
easy
3,897
hospital_1
[ "department" ]
Which department has the largest number of employees?
SELECT name FROM department GROUP BY departmentID ORDER BY count(departmentID) DESC LIMIT 1;
hard
3,898
hospital_1
[ "department" ]
Find the department with the most employees.
SELECT name FROM department GROUP BY departmentID ORDER BY count(departmentID) DESC LIMIT 1;
hard
3,899
hospital_1
[ "department" ]
What is the employee id of the head whose department has the least number of employees?
SELECT head FROM department GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;
hard