cnatale/presto-athena-txt-2-sql huggingface dataset:
For each distinct test result, find the number of students who got the result.
Additional table information: table: e_learning
SQL: SELECT test_result, COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC
Find the login name of the course author that teaches the course with name 'advanced database'.
Additional table information: table: e_learning
SQL: 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'
Which course author teaches the 'advanced database' course? Give me his or her login name.
Additional table information: table: e_learning
SQL: 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'
Find the addresses of the course authors who teach the course with name 'operating system' or 'data structure'.
Additional table information: table: e_learning
SQL: 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'
What are the addresses of the course authors who teach either 'operating system' or 'data structure' course.
Additional table information: table: e_learning
SQL: 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'
Find the personal name, family name, and author ID of the course author that teaches the most courses.
Additional table information: table: e_learning
SQL: 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
What are the personal name, family name, and author ID of the course author who teaches the most courses?
Additional table information: table: e_learning
SQL: 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
Find the addresses and author IDs of the course authors that teach at least two courses.
Additional table information: table: e_learning
SQL: 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
Which course authors teach two or more courses? Give me their addresses and author IDs.
Additional table information: table: e_learning
SQL: 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
Find the names of courses taught by the tutor who has personal name 'Julio'.
Additional table information: table: e_learning
SQL: 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'
What are the names of the courses taught by the tutor whose personal name is 'Julio'?
Additional table information: table: e_learning
SQL: 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'
Find the names and descriptions of courses that belong to the subject named 'Computer Science'.
Additional table information: table: e_learning
SQL: 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'
What are the names and descriptions of the all courses under the 'Computer Science' subject?
Additional table information: table: e_learning
SQL: 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'
Find the subject ID, subject name, and the corresponding number of available courses for each subject.
Additional table information: table: e_learning
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
What are the subject ID, subject name, and the number of available courses for each subject?
Additional table information: table: e_learning
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
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.
Additional table information: table: e_learning
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 NULLS FIRST
List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.
Additional table information: table: e_learning
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 NULLS FIRST
What is the date of enrollment of the course named 'Spanish'?
Additional table information: table: e_learning
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'
Find the the date of enrollment of the 'Spanish' course.
Additional table information: table: e_learning
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'
What is the name of the course that has the most student enrollment?
Additional table information: table: e_learning
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
Which course is enrolled in by the most students? Give me the course name.
Additional table information: table: e_learning
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
What are the names of the courses that have exactly 1 student enrollment?
Additional table information: table: e_learning
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
Find the names of the courses that have just one student enrollment.
Additional table information: table: e_learning
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
What are the descriptions and names of the courses that have student enrollment bigger than 2?
Additional table information: table: e_learning
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
Return the descriptions and names of the courses that have more than two students enrolled in.
Additional table information: table: e_learning
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
What is the name of each course and the corresponding number of student enrollment?
Additional table information: table: e_learning
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
List the name and the number of enrolled student for each course.
Additional table information: table: e_learning
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
What are the enrollment dates of all the tests that have result 'Pass'?
Additional table information: table: e_learning
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'
Find the enrollment date for all the tests that have 'Pass' result.
Additional table information: table: e_learning
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'
What are the completion dates of all the tests that have result 'Fail'?
Additional table information: table: e_learning
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'
Return the completion date for all the tests that have 'Fail' result.
Additional table information: table: e_learning
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'
List the dates of enrollment and completion of the student with personal name 'Karson'.
Additional table information: table: e_learning
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'
On what dates did the student whose personal name is 'Karson' enroll in and complete the courses?
Additional table information: table: e_learning
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'
List the dates of enrollment and completion of the student with family name 'Zieme' and personal name 'Bernie'.
Additional table information: table: e_learning
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'
On what dates did the student with family name 'Zieme' and personal name 'Bernie' enroll in and complete the courses?
Additional table information: table: e_learning
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'
Find the student ID and login name of the student with the most course enrollments
Additional table information: table: e_learning
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
What are the student ID and login name of the student who are enrolled in the most courses?
Additional table information: table: e_learning
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
Find the student ID and personal name of the student with at least two enrollments.
Additional table information: table: e_learning
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
Which student are enrolled in at least two courses? Give me the student ID and personal name.
Additional table information: table: e_learning
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
Find the student ID and middle name for all the students with at most two enrollments.
Additional table information: table: e_learning
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
What are the student IDs and middle names of the students enrolled in at most two courses?
Additional table information: table: e_learning
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
Find the personal names of students not enrolled in any course.
Additional table information: table: e_learning
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
Which students not enrolled in any course? Find their personal names.
Additional table information: table: e_learning
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
How many students did not have any course enrollment?
Additional table information: table: e_learning
SQL: SELECT COUNT(*) FROM Students WHERE NOT student_id IN (SELECT student_id FROM Student_Course_Enrolment)
Count the number of students who did not enroll in any course.
Additional table information: table: e_learning
SQL: SELECT COUNT(*) FROM Students WHERE NOT student_id IN (SELECT student_id FROM Student_Course_Enrolment)
Find the common login name of course authors and students.
Additional table information: table: e_learning
SQL: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students
What are the login names used both by some course authors and some students?
Additional table information: table: e_learning
SQL: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students
Find the common personal name of course authors and students.
Additional table information: table: e_learning
SQL: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
What are the personal names used both by some course authors and some students?
Additional table information: table: e_learning
SQL: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.
Additional table information: table: insurance_policies
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)
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.
Additional table information: table: insurance_policies
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)
Which customer had at least 2 policies but did not file any claims? List the customer details and id.
Additional table information: table: insurance_policies
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
Give me the the customer details and id for the customers who had two or more policies but did not file any claims.
Additional table information: table: insurance_policies
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
List the method, date and amount of all the payments, in ascending order of date.
Additional table information: table: insurance_policies
SQL: SELECT Payment_Method_Code, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC NULLS FIRST
What are the method, date and amount of each payment? Sort the list in ascending order of date.
Additional table information: table: insurance_policies
SQL: SELECT Payment_Method_Code, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC NULLS FIRST
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.
Additional table information: table: insurance_policies
SQL: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.
Additional table information: table: insurance_policies
SQL: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
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.
Additional table information: table: insurance_policies
SQL: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC NULLS FIRST LIMIT 1
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.
Additional table information: table: insurance_policies
SQL: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC NULLS FIRST LIMIT 1
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.
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made, Date_Claim_Settled FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims)
Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average.
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made, Date_Claim_Settled FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims)
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims)
Return the claim start date for the claims whose claimed amount is no more than the average
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims)
How many settlements does each claim correspond to? List the claim id and the number of settlements.
Additional table information: table: insurance_policies
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
Find the number of settlements each claim corresponds to. Show the number together with the claim id.
Additional table information: table: insurance_policies
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
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
Additional table information: table: insurance_policies
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
Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.
Additional table information: table: insurance_policies
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
How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.
Additional table information: table: insurance_policies
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
Find the claim id and the number of settlements made for the claim with the most recent settlement date.
Additional table information: table: insurance_policies
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
Of all the claims, what was the earliest date when any claim was made?
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC NULLS FIRST LIMIT 1
Tell me the the date when the first claim was made.
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC NULLS FIRST LIMIT 1
What is the total amount of settlement made for all the settlements?
Additional table information: table: insurance_policies
SQL: SELECT SUM(Amount_Settled) FROM Settlements
Compute the total amount of settlement across all the settlements.
Additional table information: table: insurance_policies
SQL: SELECT SUM(Amount_Settled) FROM Settlements
Who are the customers that had more than 1 policy? List the customer details and id.
Additional table information: table: insurance_policies
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
Find the the customer details and id for the customers who had more than one policy.
Additional table information: table: insurance_policies
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
What are the claim dates and settlement dates of all the settlements?
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements
Tell me the the claim date and settlement date for each settlement case.
Additional table information: table: insurance_policies
SQL: SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements
What is the most popular payment method?
Additional table information: table: insurance_policies
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) DESC LIMIT 1
Which payment method is used the most often?
Additional table information: table: insurance_policies
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) DESC LIMIT 1
With which kind of payment method were the least number of payments processed?
Additional table information: table: insurance_policies
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
What is the payment method that were used the least often?
Additional table information: table: insurance_policies
SQL: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
What is the total amount of payment?
Additional table information: table: insurance_policies
SQL: SELECT SUM(Amount_Payment) FROM Payments
Compute the total amount of payment processed.
Additional table information: table: insurance_policies
SQL: SELECT SUM(Amount_Payment) FROM Payments
What are all the distinct details of the customers?
Additional table information: table: insurance_policies
SQL: SELECT DISTINCT customer_details FROM Customers
Return the distinct customer details.
Additional table information: table: insurance_policies
SQL: SELECT DISTINCT customer_details FROM Customers
Which kind of policy type was chosen by the most customers?
Additional table information: table: insurance_policies
SQL: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC LIMIT 1
Find the policy type the most customers choose.
Additional table information: table: insurance_policies
SQL: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC LIMIT 1
How many settlements are there in total?
Additional table information: table: insurance_policies
SQL: SELECT COUNT(*) FROM Settlements
Count the total number of settlements made.
Additional table information: table: insurance_policies
SQL: SELECT COUNT(*) FROM Settlements
Which Payments were processed with Visa? List the payment Id, the date and the amount.
Additional table information: table: insurance_policies
SQL: SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'
Give me the payment Id, the date and the amount for all the payments processed with Visa.
Additional table information: table: insurance_policies
SQL: SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'
List the details of the customers who do not have any policies.
Additional table information: table: insurance_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
Which customers do not have any policies? Find the details of these customers.
Additional table information: table: insurance_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
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.
Additional table information: table: insurance_policies
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
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.
Additional table information: table: insurance_policies
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
Find the total claimed amount of all the claims.
Additional table information: table: insurance_policies
SQL: SELECT SUM(Amount_Claimed) FROM Claims
What is total amount claimed summed across all the claims?
Additional table information: table: insurance_policies
SQL: SELECT SUM(Amount_Claimed) FROM Claims
Which department has the largest number of employees?
Additional table information: table: hospital_1
SQL: SELECT name FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) DESC LIMIT 1
Find the department with the most employees.
Additional table information: table: hospital_1
SQL: SELECT name FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) DESC LIMIT 1
What is the employee id of the head whose department has the least number of employees?
Additional table information: table: hospital_1
SQL: SELECT head FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1
Tell me the employee id of the head of the department with the least employees.
Additional table information: table: hospital_1
SQL: SELECT head FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1
what is the name and position of the head whose department has least number of employees?
Additional table information: table: hospital_1
SQL: SELECT T2.name, T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1
Find the name and position of the head of the department with the least employees.
Additional table information: table: hospital_1
SQL: SELECT T2.name, T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1
What are names of patients who made an appointment?
Additional table information: table: hospital_1
SQL: SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn
List the names of patients who have made appointments.
Additional table information: table: hospital_1
SQL: SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn
what are name and phone number of patients who had more than one appointment?
Additional table information: table: hospital_1
SQL: SELECT name, phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING COUNT(*) > 1
Which patients made more than one appointment? Tell me the name and phone number of these patients.
Additional table information: table: hospital_1
SQL: SELECT name, phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING COUNT(*) > 1
Find the id of the appointment with the most recent start date?
Additional table information: table: hospital_1
SQL: SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1
What is the id of the appointment that started most recently?
Additional table information: table: hospital_1
SQL: SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1
List the name of physicians who took some appointment.
Additional table information: table: hospital_1
SQL: SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
What are the names of all the physicians who took appointments.
Additional table information: table: hospital_1
SQL: SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
List the name of physicians who never took any appointment.
Additional table information: table: hospital_1
SQL: SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
Which physicians have never taken any appointment? Find their names.
Additional table information: table: hospital_1
SQL: SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
Find the names of all physicians and their primary affiliated departments' names.
Additional table information: table: hospital_1
SQL: SELECT T1.name, T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1
What are the name and primarily affiliated department name of each physician?
Additional table information: table: hospital_1
SQL: SELECT T1.name, T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1
What is the name of the patient who made the most recent appointment?
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1
Find the name of the patient who made the appointment with the most recent start date.
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1
How many patients stay in room 112?
Additional table information: table: hospital_1
SQL: SELECT COUNT(patient) FROM stay WHERE room = 112
Count the number of patients who stayed in room 112.
Additional table information: table: hospital_1
SQL: SELECT COUNT(patient) FROM stay WHERE room = 112
How many patients' prescriptions are made by physician John Dorian?
Additional table information: table: hospital_1
SQL: SELECT COUNT(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = 'John Dorian'
Find the number of patients' prescriptions physician John Dorian made.
Additional table information: table: hospital_1
SQL: SELECT COUNT(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = 'John Dorian'
Find the name of medication used on the patient who stays in room 111?
Additional table information: table: hospital_1
SQL: SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111
What is the name of the medication used for the patient staying in room 111?
Additional table information: table: hospital_1
SQL: SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111
Find the patient who most recently stayed in room 111.
Additional table information: table: hospital_1
SQL: SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1
What is the id of the patient who stayed in room 111 most recently?
Additional table information: table: hospital_1
SQL: SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1
What is the name of the nurse has the most appointments?
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY COUNT(*) DESC LIMIT 1
Find the name of the nurse who has the largest number of appointments.
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY COUNT(*) DESC LIMIT 1
How many patients do each physician take care of? List their names and number of patients they take care of.
Additional table information: table: hospital_1
SQL: SELECT T1.name, COUNT(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid
Return the name of each physician and the number of patients he or she treats.
Additional table information: table: hospital_1
SQL: SELECT T1.name, COUNT(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid
Find the name of physicians who are in charge of more than one patient.
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING COUNT(*) > 1
Which physicians are in charge of more than one patient? Give me their names.
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING COUNT(*) > 1
Find the number of rooms located on each block floor.
Additional table information: table: hospital_1
SQL: SELECT COUNT(*), T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor
How many rooms does each block floor have?
Additional table information: table: hospital_1
SQL: SELECT COUNT(*), T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor
Find the number of rooms for different block code?
Additional table information: table: hospital_1
SQL: SELECT COUNT(*), T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode
How many rooms are located for each block code?
Additional table information: table: hospital_1
SQL: SELECT COUNT(*), T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode
What are the unique block codes that have available rooms?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
Tell me the distinct block codes where some rooms are available.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
How many different types of rooms are there?
Additional table information: table: hospital_1
SQL: SELECT COUNT(DISTINCT roomtype) FROM room
Find the number of distinct room types available.
Additional table information: table: hospital_1
SQL: SELECT COUNT(DISTINCT roomtype) FROM room
What is the names of the physicians who prescribe medication Thesisin?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = 'Thesisin'
List the names of all the physicians who prescribe Thesisin as medication.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = 'Thesisin'
Find the name and position of physicians who prescribe some medication whose brand is X?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T1.name, T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = 'X'
Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T1.name, T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = 'X'
Find the number of medications prescribed for each brand.
Additional table information: table: hospital_1
SQL: SELECT COUNT(*), T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand
How many medications are prescribed for each brand?
Additional table information: table: hospital_1
SQL: SELECT COUNT(*), T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand
Find the name of physicians whose position title contains the word 'senior'.
Additional table information: table: hospital_1
SQL: SELECT name FROM physician WHERE POSITION LIKE '%senior%'
What are the names of the physicians who have 'senior' in their titles.
Additional table information: table: hospital_1
SQL: SELECT name FROM physician WHERE POSITION LIKE '%senior%'
Find the patient who has the most recent undergoing treatment?
Additional table information: table: hospital_1
SQL: SELECT patient FROM undergoes ORDER BY dateundergoes NULLS FIRST LIMIT 1
Which patient is undergoing the most recent treatment?
Additional table information: table: hospital_1
SQL: SELECT patient FROM undergoes ORDER BY dateundergoes NULLS FIRST LIMIT 1
Find the names of all patients who have an undergoing treatment and are staying in room 111.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111
What are the names of patients who are staying in room 111 and have an undergoing treatment?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111
List the names of all distinct nurses ordered by alphabetical order?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT name FROM nurse ORDER BY name NULLS FIRST
What is the alphabetically ordered list of all the distinct names of nurses?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT name FROM nurse ORDER BY name NULLS FIRST
Find the names of nurses who are nursing an undergoing treatment.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID
Which nurses are in charge of patients undergoing treatments?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID
List the names of all distinct medications, ordered in an alphabetical order.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT name FROM medication ORDER BY name NULLS FIRST
What is the alphabetically ordered list of all distinct medications?
Additional table information: table: hospital_1
SQL: SELECT DISTINCT name FROM medication ORDER BY name NULLS FIRST
What are the names of the physician who prescribed the highest dose?
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1
Find the physician who prescribed the highest dose. What is his or her name?
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1
List the physicians' employee ids together with their primary affiliation departments' ids.
Additional table information: table: hospital_1
SQL: SELECT physician, department FROM affiliated_with WHERE primaryaffiliation = 1
What are each physician's employee id and department id primarily affiliated.
Additional table information: table: hospital_1
SQL: SELECT physician, department FROM affiliated_with WHERE primaryaffiliation = 1
List the names of departments where some physicians are primarily affiliated with.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1
What are the names of departments that have primarily affiliated physicians.
Additional table information: table: hospital_1
SQL: SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1
What nurses are on call with block floor 1 and block code 1? Tell me their names.
Additional table information: table: hospital_1
SQL: SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1
Find the ids of the nurses who are on call in block floor 1 and block code 1.
Additional table information: table: hospital_1
SQL: SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1
What are the highest cost, lowest cost and average cost of procedures?
Additional table information: table: hospital_1
SQL: SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures
Tell me the highest, lowest, and average cost of procedures.
Additional table information: table: hospital_1
SQL: SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures
List the name and cost of all procedures sorted by the cost from the highest to the lowest.
Additional table information: table: hospital_1
SQL: SELECT name, cost FROM procedures ORDER BY cost DESC
Sort the list of names and costs of all procedures in the descending order of cost.
Additional table information: table: hospital_1
SQL: SELECT name, cost FROM procedures ORDER BY cost DESC
Find the three most expensive procedures.
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures ORDER BY cost NULLS FIRST LIMIT 3
What are the three most costly procedures?
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures ORDER BY cost NULLS FIRST LIMIT 3
Find the physicians who are trained in a procedure that costs more than 5000.
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000
Which physicians are trained in procedures that are more expensive than 5000?
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000
Find the physician who was trained in the most expensive procedure?
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1
Which physician was trained in the procedure that costs the most.
Additional table information: table: hospital_1
SQL: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1
What is the average cost of procedures that physician John Wen was trained in?
Additional table information: table: hospital_1
SQL: SELECT AVG(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
Compute the mean price of procedures physician John Wen was trained in.
Additional table information: table: hospital_1
SQL: SELECT AVG(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
Find the names of procedures which physician John Wen was trained in.
Additional table information: table: hospital_1
SQL: SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
What are the names of procedures physician John Wen was trained in?
Additional table information: table: hospital_1
SQL: SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
Find all procedures which cost more than 1000 or which physician John Wen was trained in.
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
What are the procedures that cost more than 1000 or are specialized in by physician John Wen?
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
Find the names of all procedures which cost more than 1000 but which physician John Wen was not trained in?
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
Among the procedures that cost more than 1000, which were not specialized in by physician John Wen?
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in.
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'
What procedures cost less than 5000 and have John Wen as a trained physician?
Additional table information: table: hospital_1
SQL: SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'