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