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