training_input
stringlengths
118
1.06k
###context:CREATE TABLE channel (name VARCHAR, channel_id VARCHAR); CREATE TABLE broadcast (channel_id VARCHAR, time_of_day VARCHAR) ###human: what are the names of the channels that broadcast in both morning and night? ###assistant: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'
###context:CREATE TABLE broadcast (time_of_day VARCHAR) ###human: how many programs are broadcast in each time section of the day? ###assistant: SELECT COUNT(*), time_of_day FROM broadcast GROUP BY time_of_day
###context:CREATE TABLE broadcast (program_id VARCHAR, time_of_day VARCHAR) ###human: find the number of different programs that are broadcast during night time. ###assistant: SELECT COUNT(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
###context:CREATE TABLE broadcast (program_id VARCHAR, Time_of_day VARCHAR); CREATE TABLE program (name VARCHAR, program_id VARCHAR); CREATE TABLE program (name VARCHAR) ###human: Find the names of programs that are never broadcasted in the morning. ###assistant: SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning"
###context:CREATE TABLE broadcast (program_id VARCHAR, Time_of_day VARCHAR); CREATE TABLE program (owner VARCHAR, program_id VARCHAR) ###human: find the program owners that have some programs in both morning and night time. ###assistant: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Night"
###context:CREATE TABLE program (origin VARCHAR) ###human: List all program origins in the alphabetical order. ###assistant: SELECT origin FROM program ORDER BY origin
###context:CREATE TABLE channel (OWNER VARCHAR) ###human: what is the number of different channel owners? ###assistant: SELECT COUNT(DISTINCT OWNER) FROM channel
###context:CREATE TABLE program (name VARCHAR, origin VARCHAR) ###human: find the names of programs whose origin is not in Beijing. ###assistant: SELECT name FROM program WHERE origin <> 'Beijing'
###context:CREATE TABLE channel (name VARCHAR, OWNER VARCHAR) ###human: What are the names of the channels owned by CCTV or HBS? ###assistant: SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'
###context:CREATE TABLE channel (OWNER VARCHAR, Rating_in_percent INTEGER) ###human: Find the total rating ratio for each channel owner. ###assistant: SELECT SUM(Rating_in_percent), OWNER FROM channel GROUP BY OWNER
###context:CREATE TABLE program (name VARCHAR, program_id VARCHAR); CREATE TABLE broadcast (program_id VARCHAR) ###human: Find the name of the program that is broadcast most frequently. ###assistant: SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE COURSES (Id VARCHAR) ###human: How many courses are there in total? ###assistant: SELECT COUNT(*) FROM COURSES
###context:CREATE TABLE COURSES (course_description VARCHAR, course_name VARCHAR) ###human: What are the descriptions of the courses with name "database"? ###assistant: SELECT course_description FROM COURSES WHERE course_name = "database"
###context:CREATE TABLE Course_Authors_and_Tutors (address_line_1 VARCHAR, personal_name VARCHAR) ###human: What are the addresses of the course authors or tutors with personal name "Cathrine" ###assistant: SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine"
###context:CREATE TABLE Course_Authors_and_Tutors (address_line_1 VARCHAR) ###human: List the addresses of all the course authors or tutors. ###assistant: SELECT address_line_1 FROM Course_Authors_and_Tutors
###context:CREATE TABLE Course_Authors_and_Tutors (login_name VARCHAR, family_name VARCHAR) ###human: List all the login names and family names of course author and tutors. ###assistant: SELECT login_name, family_name FROM Course_Authors_and_Tutors
###context:CREATE TABLE Student_Course_Enrolment (date_of_enrolment VARCHAR, date_of_completion VARCHAR) ###human: List all the dates of enrollment and completion of students. ###assistant: SELECT date_of_enrolment, date_of_completion FROM Student_Course_Enrolment
###context:CREATE TABLE Student_Course_Enrolment (student_id VARCHAR) ###human: How many distinct students are enrolled in courses? ###assistant: SELECT COUNT(DISTINCT student_id) FROM Student_Course_Enrolment
###context:CREATE TABLE Student_Course_Enrolment (course_id VARCHAR) ###human: How many distinct courses are enrolled in by students? ###assistant: SELECT COUNT(course_id) FROM Student_Course_Enrolment
###context:CREATE TABLE Student_Tests_Taken (date_test_taken VARCHAR, test_result VARCHAR) ###human: Find the dates of the tests taken with result "Pass". ###assistant: SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = "Pass"
###context:CREATE TABLE Student_Tests_Taken (test_result VARCHAR) ###human: How many tests have result "Fail"? ###assistant: SELECT COUNT(*) FROM Student_Tests_Taken WHERE test_result = "Fail"
###context:CREATE TABLE Students (login_name VARCHAR, family_name VARCHAR) ###human: What are the login names of the students with family name "Ward"? ###assistant: SELECT login_name FROM Students WHERE family_name = "Ward"
###context:CREATE TABLE Students (date_of_latest_logon VARCHAR, family_name VARCHAR) ###human: What are the dates of the latest logon of the students with family name "Jaskolski" or "Langosh"? ###assistant: SELECT date_of_latest_logon FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
###context:CREATE TABLE Students (personal_name VARCHAR) ###human: How many students have personal names that contain the word "son"? ###assistant: SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"
###context:CREATE TABLE SUBJECTS (subject_name VARCHAR) ###human: List all the subject names. ###assistant: SELECT subject_name FROM SUBJECTS
###context:CREATE TABLE Course_Authors_and_Tutors (personal_name VARCHAR) ###human: List all the information about course authors and tutors in alphabetical order of the personal name. ###assistant: SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name
###context:CREATE TABLE Students (personal_name VARCHAR, family_name VARCHAR) ###human: List the personal names and family names of all the students in alphabetical order of family name. ###assistant: SELECT personal_name, family_name FROM Students ORDER BY family_name
###context:CREATE TABLE Student_Tests_Taken (test_result VARCHAR) ###human: List each test result and its count in descending order of count. ###assistant: SELECT test_result, COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC
###context:CREATE TABLE Courses (author_id VARCHAR, course_name VARCHAR); CREATE TABLE Course_Authors_and_Tutors (login_name VARCHAR, author_id VARCHAR) ###human: Find the login name of the course author that teaches the course with name "advanced database". ###assistant: 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"
###context:CREATE TABLE Courses (author_id VARCHAR, course_name VARCHAR); CREATE TABLE Course_Authors_and_Tutors (address_line_1 VARCHAR, author_id VARCHAR) ###human: Find the addresses of the course authors who teach the course with name "operating system" or "data structure". ###assistant: 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"
###context:CREATE TABLE Courses (author_id VARCHAR); CREATE TABLE Course_Authors_and_Tutors (personal_name VARCHAR, family_name VARCHAR, author_id VARCHAR) ###human: Find the personal name, family name, and author ID of the course author that teaches the most courses. ###assistant: 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
###context:CREATE TABLE Courses (author_id VARCHAR); CREATE TABLE Course_Authors_and_Tutors (address_line_1 VARCHAR, author_id VARCHAR) ###human: Find the addresses and author IDs of the course authors that teach at least two courses. ###assistant: 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
###context:CREATE TABLE Course_Authors_and_Tutors (author_id VARCHAR, personal_name VARCHAR); CREATE TABLE Courses (course_name VARCHAR, author_id VARCHAR) ###human: Find the names of courses taught by the tutor who has personal name "Julio". ###assistant: 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"
###context:CREATE TABLE Courses (course_name VARCHAR, course_description VARCHAR, subject_id VARCHAR); CREATE TABLE Subjects (subject_id VARCHAR, subject_name VARCHAR) ###human: Find the names and descriptions of courses that belong to the subject named "Computer Science". ###assistant: 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"
###context:CREATE TABLE Courses (subject_id VARCHAR); CREATE TABLE Subjects (subject_name VARCHAR, subject_id VARCHAR) ###human: Find the subject ID, subject name, and the corresponding number of available courses for each subject. ###assistant: 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
###context:CREATE TABLE Courses (subject_id VARCHAR); CREATE TABLE Subjects (subject_name VARCHAR, subject_id VARCHAR) ###human: 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. ###assistant: 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(*)
###context:CREATE TABLE Student_Course_Enrolment (date_of_enrolment VARCHAR, course_id VARCHAR); CREATE TABLE Courses (course_id VARCHAR, course_name VARCHAR) ###human: What is the date of enrollment of the course named "Spanish"? ###assistant: 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"
###context:CREATE TABLE Courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE Student_Course_Enrolment (course_id VARCHAR) ###human: What is the name of the course that has the most student enrollment? ###assistant: 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
###context:CREATE TABLE Courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE Student_Course_Enrolment (course_id VARCHAR) ###human: What are the names of the courses that have exactly 1 student enrollment? ###assistant: 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
###context:CREATE TABLE Student_Course_Enrolment (course_id VARCHAR); CREATE TABLE Courses (course_description VARCHAR, course_name VARCHAR, course_id VARCHAR) ###human: What are the descriptions and names of the courses that have student enrollment bigger than 2? ###assistant: 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
###context:CREATE TABLE Courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE Student_Course_Enrolment (course_id VARCHAR) ###human: What is the name of each course and the corresponding number of student enrollment? ###assistant: 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
###context:CREATE TABLE Student_Tests_Taken (registration_id VARCHAR, test_result VARCHAR); CREATE TABLE Student_Course_Enrolment (date_of_enrolment VARCHAR, registration_id VARCHAR) ###human: What are the enrollment dates of all the tests that have result "Pass"? ###assistant: 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"
###context:CREATE TABLE Student_Tests_Taken (registration_id VARCHAR, test_result VARCHAR); CREATE TABLE Student_Course_Enrolment (date_of_completion VARCHAR, registration_id VARCHAR) ###human: What are the completion dates of all the tests that have result "Fail"? ###assistant: 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"
###context:CREATE TABLE Student_Course_Enrolment (date_of_enrolment VARCHAR, date_of_completion VARCHAR, student_id VARCHAR); CREATE TABLE Students (student_id VARCHAR, personal_name VARCHAR) ###human: List the dates of enrollment and completion of the student with personal name "Karson". ###assistant: 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"
###context:CREATE TABLE Student_Course_Enrolment (date_of_enrolment VARCHAR, date_of_completion VARCHAR, student_id VARCHAR); CREATE TABLE Students (student_id VARCHAR, family_name VARCHAR, personal_name VARCHAR) ###human: List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie". ###assistant: 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"
###context:CREATE TABLE Student_Course_Enrolment (student_id VARCHAR); CREATE TABLE Students (login_name VARCHAR, student_id VARCHAR) ###human: Find the student ID and login name of the student with the most course enrollments ###assistant: 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
###context:CREATE TABLE Student_Course_Enrolment (student_id VARCHAR); CREATE TABLE Students (personal_name VARCHAR, student_id VARCHAR) ###human: Find the student ID and personal name of the student with at least two enrollments. ###assistant: 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
###context:CREATE TABLE Student_Course_Enrolment (student_id VARCHAR); CREATE TABLE Students (middle_name VARCHAR, student_id VARCHAR) ###human: Find the student ID and middle name for all the students with at most two enrollments. ###assistant: 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
###context:CREATE TABLE Student_Course_Enrolment (student_id VARCHAR); CREATE TABLE Students (personal_name VARCHAR); CREATE TABLE Students (personal_name VARCHAR, student_id VARCHAR) ###human: Find the personal names of students not enrolled in any course. ###assistant: 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
###context:CREATE TABLE Students (student_id VARCHAR); CREATE TABLE Student_Course_Enrolment (student_id VARCHAR) ###human: How many students did not have any course enrollment? ###assistant: SELECT COUNT(*) FROM Students WHERE NOT student_id IN (SELECT student_id FROM Student_Course_Enrolment)
###context:CREATE TABLE Course_Authors_and_Tutors (login_name VARCHAR); CREATE TABLE Students (login_name VARCHAR) ###human: Find the common login name of course authors and students. ###assistant: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students
###context:CREATE TABLE Course_Authors_and_Tutors (personal_name VARCHAR); CREATE TABLE Students (personal_name VARCHAR) ###human: Find the common personal name of course authors and students. ###assistant: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
###context:CREATE TABLE Settlements (Claim_id VARCHAR); CREATE TABLE Claims (Amount_Claimed INTEGER); CREATE TABLE Claims (Date_Claim_Made VARCHAR, Claim_id VARCHAR, Amount_Claimed INTEGER) ###human: Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id. ###assistant: 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)
###context:CREATE TABLE Customers (customer_details VARCHAR, customer_id VARCHAR, Customer_id VARCHAR); CREATE TABLE Customer_Policies (customer_id VARCHAR, policy_id VARCHAR); CREATE TABLE Claims (policy_id VARCHAR) ###human: Which customer had at least 2 policies but did not file any claims? List the customer details and id. ###assistant: 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
###context:CREATE TABLE Payments (Payment_Method_Code VARCHAR, Date_Payment_Made VARCHAR, Amount_Payment VARCHAR) ###human: List the method, date and amount of all the payments, in ascending order of date. ###assistant: SELECT Payment_Method_Code, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made
###context:CREATE TABLE Claims (Amount_Settled VARCHAR, Amount_Claimed VARCHAR) ###human: 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. ###assistant: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1
###context:CREATE TABLE Claims (Amount_Settled VARCHAR, Amount_Claimed VARCHAR) ###human: 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. ###assistant: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled LIMIT 1
###context:CREATE TABLE Claims (Date_Claim_Made VARCHAR, Date_Claim_Settled VARCHAR, Amount_Claimed INTEGER) ###human: 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. ###assistant: SELECT Date_Claim_Made, Date_Claim_Settled FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims)
###context:CREATE TABLE Claims (Date_Claim_Made VARCHAR, Amount_Settled INTEGER) ###human: Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date. ###assistant: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims)
###context:CREATE TABLE Settlements (claim_id VARCHAR); CREATE TABLE Claims (Claim_id VARCHAR, claim_id VARCHAR) ###human: How many settlements does each claim correspond to? List the claim id and the number of settlements. ###assistant: 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
###context:CREATE TABLE Claims (claim_id VARCHAR, date_claim_made VARCHAR); CREATE TABLE Settlements (claim_id VARCHAR) ###human: Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number. ###assistant: 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
###context:CREATE TABLE Settlements (claim_id VARCHAR); CREATE TABLE Claims (claim_id VARCHAR, Date_Claim_Settled VARCHAR) ###human: How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id. ###assistant: 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
###context:CREATE TABLE Claims (Date_Claim_Made VARCHAR) ###human: Of all the claims, what was the earliest date when any claim was made? ###assistant: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made LIMIT 1
###context:CREATE TABLE Settlements (Amount_Settled INTEGER) ###human: What is the total amount of settlement made for all the settlements? ###assistant: SELECT SUM(Amount_Settled) FROM Settlements
###context:CREATE TABLE Customers (customer_details VARCHAR, customer_id VARCHAR, Customer_id VARCHAR); CREATE TABLE Customer_Policies (Customer_id VARCHAR) ###human: Who are the customers that had more than 1 policy? List the customer details and id. ###assistant: 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
###context:CREATE TABLE Settlements (Date_Claim_Made VARCHAR, Date_Claim_Settled VARCHAR) ###human: What are the claim dates and settlement dates of all the settlements? ###assistant: SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements
###context:CREATE TABLE Payments (Payment_Method_Code VARCHAR) ###human: What is the most popular payment method? ###assistant: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Payments (Payment_Method_Code VARCHAR) ###human: With which kind of payment method were the least number of payments processed? ###assistant: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) LIMIT 1
###context:CREATE TABLE Payments (Amount_Payment INTEGER) ###human: What is the total amount of payment? ###assistant: SELECT SUM(Amount_Payment) FROM Payments
###context:CREATE TABLE Customers (customer_details VARCHAR) ###human: What are all the distinct details of the customers? ###assistant: SELECT DISTINCT customer_details FROM Customers
###context:CREATE TABLE Customer_Policies (Policy_Type_Code VARCHAR) ###human: Which kind of policy type was chosen by the most customers? ###assistant: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Settlements (Id VARCHAR) ###human: How many settlements are there in total? ###assistant: SELECT COUNT(*) FROM Settlements
###context:CREATE TABLE Payments (Payment_ID VARCHAR, Date_Payment_Made VARCHAR, Amount_Payment VARCHAR, Payment_Method_Code VARCHAR) ###human: Which Payments were processed with Visa? List the payment Id, the date and the amount. ###assistant: SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'
###context:CREATE TABLE Customer_Policies (customer_id VARCHAR); CREATE TABLE Customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_details VARCHAR) ###human: List the details of the customers who do not have any policies. ###assistant: 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
###context:CREATE TABLE Claims (claim_id VARCHAR, date_claim_made VARCHAR, Date_Claim_Settled VARCHAR, Claim_id VARCHAR); CREATE TABLE Settlements (Claim_id VARCHAR) ###human: 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. ###assistant: 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
###context:CREATE TABLE Claims (Amount_Claimed INTEGER) ###human: Find the total claimed amount of all the claims. ###assistant: SELECT SUM(Amount_Claimed) FROM Claims
###context:CREATE TABLE department (name VARCHAR, departmentID VARCHAR) ###human: Which department has the largest number of employees? ###assistant: SELECT name FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) DESC LIMIT 1
###context:CREATE TABLE department (head VARCHAR, departmentID VARCHAR) ###human: What is the employee id of the head whose department has the least number of employees? ###assistant: SELECT head FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) LIMIT 1
###context:CREATE TABLE department (head VARCHAR); CREATE TABLE physician (name VARCHAR, position VARCHAR, EmployeeID VARCHAR) ###human: what is the name and position of the head whose department has least number of employees? ###assistant: 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) LIMIT 1
###context:CREATE TABLE appointment (patient VARCHAR); CREATE TABLE patient (ssn VARCHAR) ###human: What are names of patients who made an appointment? ###assistant: SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn
###context:CREATE TABLE appointment (patient VARCHAR); CREATE TABLE patient (ssn VARCHAR) ###human: what are name and phone number of patients who had more than one appointment? ###assistant: SELECT name, phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING COUNT(*) > 1
###context:CREATE TABLE appointment (appointmentid VARCHAR, START VARCHAR) ###human: Find the id of the appointment with the most recent start date? ###assistant: SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1
###context:CREATE TABLE appointment (Physician VARCHAR); CREATE TABLE physician (name VARCHAR, EmployeeID VARCHAR) ###human: List the name of physicians who took some appointment. ###assistant: SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
###context:CREATE TABLE physician (name VARCHAR); CREATE TABLE appointment (Physician VARCHAR); CREATE TABLE physician (name VARCHAR, EmployeeID VARCHAR) ###human: List the name of physicians who never took any appointment. ###assistant: SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
###context:CREATE TABLE department (name VARCHAR, DepartmentID VARCHAR); CREATE TABLE affiliated_with (physician VARCHAR, department VARCHAR, PrimaryAffiliation VARCHAR); CREATE TABLE physician (name VARCHAR, EmployeeID VARCHAR) ###human: Find the names of all physicians and their primary affiliated departments' names. ###assistant: 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
###context:CREATE TABLE patient (name VARCHAR, ssn VARCHAR); CREATE TABLE appointment (patient VARCHAR, start VARCHAR) ###human: What is the name of the patient who made the most recent appointment? ###assistant: SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1
###context:CREATE TABLE stay (patient VARCHAR, room VARCHAR) ###human: How many patients stay in room 112? ###assistant: SELECT COUNT(patient) FROM stay WHERE room = 112
###context:CREATE TABLE patient (SSN VARCHAR); CREATE TABLE prescribes (patient VARCHAR, physician VARCHAR); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR) ###human: How many patients' prescriptions are made by physician John Dorian? ###assistant: 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"
###context:CREATE TABLE Prescribes (Patient VARCHAR, Medication VARCHAR); CREATE TABLE Medication (name VARCHAR, Code VARCHAR); CREATE TABLE patient (SSN VARCHAR); CREATE TABLE stay (Patient VARCHAR) ###human: Find the name of medication used on the patient who stays in room 111? ###assistant: 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
###context:CREATE TABLE stay (patient VARCHAR, room VARCHAR, staystart VARCHAR) ###human: Find the patient who most recently stayed in room 111. ###assistant: SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1
###context:CREATE TABLE nurse (name VARCHAR, employeeid VARCHAR); CREATE TABLE appointment (prepnurse VARCHAR) ###human: What is the name of the nurse has the most appointments? ###assistant: 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
###context:CREATE TABLE patient (PCP VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR) ###human: How many patients do each physician take care of? List their names and number of patients they take care of. ###assistant: SELECT T1.name, COUNT(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid
###context:CREATE TABLE patient (PCP VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR) ###human: Find the name of physicians who are in charge of more than one patient. ###assistant: SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING COUNT(*) > 1
###context:CREATE TABLE room (blockfloor VARCHAR, blockcode VARCHAR); CREATE TABLE BLOCK (blockfloor VARCHAR, blockcode VARCHAR) ###human: Find the number of rooms located on each block floor. ###assistant: 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
###context:CREATE TABLE room (blockfloor VARCHAR, blockcode VARCHAR); CREATE TABLE BLOCK (blockcode VARCHAR, blockfloor VARCHAR) ###human: Find the number of rooms for different block code? ###assistant: 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
###context:CREATE TABLE room (blockcode VARCHAR, unavailable VARCHAR) ###human: What are the unique block codes that have available rooms? ###assistant: SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
###context:CREATE TABLE room (roomtype VARCHAR) ###human: How many different types of rooms are there? ###assistant: SELECT COUNT(DISTINCT roomtype) FROM room
###context:CREATE TABLE physician (name VARCHAR, employeeid VARCHAR); CREATE TABLE prescribes (physician VARCHAR, medication VARCHAR); CREATE TABLE medication (code VARCHAR, name VARCHAR) ###human: What is the names of the physicians who prescribe medication Thesisin? ###assistant: 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"
###context:CREATE TABLE medication (code VARCHAR, Brand VARCHAR); CREATE TABLE prescribes (physician VARCHAR, medication VARCHAR); CREATE TABLE physician (name VARCHAR, position VARCHAR, employeeid VARCHAR) ###human: Find the name and position of physicians who prescribe some medication whose brand is X? ###assistant: 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"
###context:CREATE TABLE medication (name VARCHAR, brand VARCHAR, code VARCHAR); CREATE TABLE prescribes (medication VARCHAR) ###human: Find the number of medications prescribed for each brand. ###assistant: SELECT COUNT(*), T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand