instruction
stringlengths 12
244
| input
stringlengths 27
489
| output
stringlengths 18
557
| text
stringlengths 194
1.14k
|
---|---|---|---|
Find the name of instructors who are advising more than one student. | CREATE TABLE advisor (i_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) | SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING COUNT(*) > 1 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE advisor (i_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) Question: Find the name of instructors who are advising more than one student. [/INST] SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING COUNT(*) > 1 </s> |
Find the name of the students who have more than one advisor? | CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE advisor (s_id VARCHAR) | SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING COUNT(*) > 1 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE advisor (s_id VARCHAR) Question: Find the name of the students who have more than one advisor? [/INST] SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING COUNT(*) > 1 </s> |
Find the number of rooms with more than 50 capacity for each building. | CREATE TABLE classroom (building VARCHAR, capacity INTEGER) | SELECT COUNT(*), building FROM classroom WHERE capacity > 50 GROUP BY building | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE classroom (building VARCHAR, capacity INTEGER) Question: Find the number of rooms with more than 50 capacity for each building. [/INST] SELECT COUNT(*), building FROM classroom WHERE capacity > 50 GROUP BY building </s> |
Find the maximum and average capacity among rooms in each building. | CREATE TABLE classroom (building VARCHAR, capacity INTEGER) | SELECT MAX(capacity), AVG(capacity), building FROM classroom GROUP BY building | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE classroom (building VARCHAR, capacity INTEGER) Question: Find the maximum and average capacity among rooms in each building. [/INST] SELECT MAX(capacity), AVG(capacity), building FROM classroom GROUP BY building </s> |
Find the title of the course that is offered by more than one department. | CREATE TABLE course (title VARCHAR) | SELECT title FROM course GROUP BY title HAVING COUNT(*) > 1 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE course (title VARCHAR) Question: Find the title of the course that is offered by more than one department. [/INST] SELECT title FROM course GROUP BY title HAVING COUNT(*) > 1 </s> |
Find the total credits of courses provided by different department. | CREATE TABLE course (dept_name VARCHAR, credits INTEGER) | SELECT SUM(credits), dept_name FROM course GROUP BY dept_name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE course (dept_name VARCHAR, credits INTEGER) Question: Find the total credits of courses provided by different department. [/INST] SELECT SUM(credits), dept_name FROM course GROUP BY dept_name </s> |
Find the minimum salary for the departments whose average salary is above the average payment of all instructors. | CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) | SELECT MIN(salary), dept_name FROM instructor GROUP BY dept_name HAVING AVG(salary) > (SELECT AVG(salary) FROM instructor) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) Question: Find the minimum salary for the departments whose average salary is above the average payment of all instructors. [/INST] SELECT MIN(salary), dept_name FROM instructor GROUP BY dept_name HAVING AVG(salary) > (SELECT AVG(salary) FROM instructor) </s> |
Find the number of courses provided in each semester and year. | CREATE TABLE SECTION (semester VARCHAR, YEAR VARCHAR) | SELECT COUNT(*), semester, YEAR FROM SECTION GROUP BY semester, YEAR | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (semester VARCHAR, YEAR VARCHAR) Question: Find the number of courses provided in each semester and year. [/INST] SELECT COUNT(*), semester, YEAR FROM SECTION GROUP BY semester, YEAR </s> |
Find the year which offers the largest number of courses. | CREATE TABLE SECTION (YEAR VARCHAR) | SELECT TOP 1 YEAR FROM SECTION GROUP BY YEAR ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (YEAR VARCHAR) Question: Find the year which offers the largest number of courses. [/INST] SELECT TOP 1 YEAR FROM SECTION GROUP BY YEAR ORDER BY COUNT(*) DESC </s> |
Find the year and semester when offers the largest number of courses. | CREATE TABLE SECTION (semester VARCHAR, YEAR VARCHAR) | SELECT TOP 1 semester, YEAR FROM SECTION GROUP BY semester, YEAR ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (semester VARCHAR, YEAR VARCHAR) Question: Find the year and semester when offers the largest number of courses. [/INST] SELECT TOP 1 semester, YEAR FROM SECTION GROUP BY semester, YEAR ORDER BY COUNT(*) DESC </s> |
Find the name of department has the highest amount of students? | CREATE TABLE student (dept_name VARCHAR) | SELECT TOP 1 dept_name FROM student GROUP BY dept_name ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (dept_name VARCHAR) Question: Find the name of department has the highest amount of students? [/INST] SELECT TOP 1 dept_name FROM student GROUP BY dept_name ORDER BY COUNT(*) DESC </s> |
Find the total number of students in each department. | CREATE TABLE student (dept_name VARCHAR) | SELECT COUNT(*), dept_name FROM student GROUP BY dept_name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (dept_name VARCHAR) Question: Find the total number of students in each department. [/INST] SELECT COUNT(*), dept_name FROM student GROUP BY dept_name </s> |
Find the semester and year which has the least number of student taking any class. | CREATE TABLE takes (semester VARCHAR, YEAR VARCHAR) | SELECT TOP 1 semester, YEAR FROM takes GROUP BY semester, YEAR ORDER BY COUNT(*) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE takes (semester VARCHAR, YEAR VARCHAR) Question: Find the semester and year which has the least number of student taking any class. [/INST] SELECT TOP 1 semester, YEAR FROM takes GROUP BY semester, YEAR ORDER BY COUNT(*) </s> |
What is the id of the instructor who advises of all students from History department? | CREATE TABLE advisor (s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) | SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE advisor (s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) Question: What is the id of the instructor who advises of all students from History department? [/INST] SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History' </s> |
Find the name and salary of the instructors who are advisors of any student from History department? | CREATE TABLE instructor (name VARCHAR, salary VARCHAR, id VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) | SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'History' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR, salary VARCHAR, id VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) Question: Find the name and salary of the instructors who are advisors of any student from History department? [/INST] SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'History' </s> |
Find the id of the courses that do not have any prerequisite? | CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (course_id VARCHAR) | SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (course_id VARCHAR) Question: Find the id of the courses that do not have any prerequisite? [/INST] SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq </s> |
What is the title of the prerequisite class of International Finance course? | CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) | SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'International Finance') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) Question: What is the title of the prerequisite class of International Finance course? [/INST] SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'International Finance') </s> |
Find the title of course whose prerequisite is course Differential Geometry. | CREATE TABLE prereq (course_id VARCHAR, prereq_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) | SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE prereq (course_id VARCHAR, prereq_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) Question: Find the title of course whose prerequisite is course Differential Geometry. [/INST] SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry') </s> |
Find the names of students who have taken any course in the fall semester of year 2003. | CREATE TABLE student (name VARCHAR, id VARCHAR, semester VARCHAR, YEAR VARCHAR); CREATE TABLE takes (name VARCHAR, id VARCHAR, semester VARCHAR, YEAR VARCHAR) | SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (name VARCHAR, id VARCHAR, semester VARCHAR, YEAR VARCHAR); CREATE TABLE takes (name VARCHAR, id VARCHAR, semester VARCHAR, YEAR VARCHAR) Question: Find the names of students who have taken any course in the fall semester of year 2003. [/INST] SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003) </s> |
What is the title of the course that was offered at building Chandler during the fall semester in the year of 2010? | CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE SECTION (course_id VARCHAR) | SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE building = 'Chandler' AND semester = 'Fall' AND YEAR = 2010 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE SECTION (course_id VARCHAR) Question: What is the title of the course that was offered at building Chandler during the fall semester in the year of 2010? [/INST] SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE building = 'Chandler' AND semester = 'Fall' AND YEAR = 2010 </s> |
Find the name of the instructors who taught C Programming course before. | CREATE TABLE teaches (id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) | SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE teaches (id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) Question: Find the name of the instructors who taught C Programming course before. [/INST] SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming' </s> |
Find the name and salary of instructors who are advisors of the students from the Math department. | CREATE TABLE instructor (name VARCHAR, salary VARCHAR, id VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) | SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR, salary VARCHAR, id VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) Question: Find the name and salary of instructors who are advisors of the students from the Math department. [/INST] SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' </s> |
Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit. | CREATE TABLE student (id VARCHAR, dept_name VARCHAR, tot_cred VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) | SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (id VARCHAR, dept_name VARCHAR, tot_cred VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) Question: Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit. [/INST] SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred </s> |
What is the course title of the prerequisite of course Mobile Computing? | CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) | SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'Mobile Computing') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) Question: What is the course title of the prerequisite of course Mobile Computing? [/INST] SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'Mobile Computing') </s> |
Find the name of instructor who is the advisor of the student who has the highest number of total credits. | CREATE TABLE student (id VARCHAR, tot_cred VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) | SELECT TOP 1 T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id ORDER BY T3.tot_cred DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (id VARCHAR, tot_cred VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) Question: Find the name of instructor who is the advisor of the student who has the highest number of total credits. [/INST] SELECT TOP 1 T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id ORDER BY T3.tot_cred DESC </s> |
Find the name of instructors who didn't teach any courses? | CREATE TABLE teaches (name VARCHAR, id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) | SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE teaches (name VARCHAR, id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) Question: Find the name of instructors who didn't teach any courses? [/INST] SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches) </s> |
Find the id of instructors who didn't teach any courses? | CREATE TABLE teaches (id VARCHAR); CREATE TABLE instructor (id VARCHAR) | SELECT id FROM instructor EXCEPT SELECT id FROM teaches | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE teaches (id VARCHAR); CREATE TABLE instructor (id VARCHAR) Question: Find the id of instructors who didn't teach any courses? [/INST] SELECT id FROM instructor EXCEPT SELECT id FROM teaches </s> |
Find the names of instructors who didn't each any courses in any Spring semester. | CREATE TABLE teaches (name VARCHAR, id VARCHAR, semester VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR, semester VARCHAR) | SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches WHERE semester = 'Spring') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE teaches (name VARCHAR, id VARCHAR, semester VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR, semester VARCHAR) Question: Find the names of instructors who didn't each any courses in any Spring semester. [/INST] SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches WHERE semester = 'Spring') </s> |
Find the name of the department which has the highest average salary of professors. | CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) | SELECT TOP 1 dept_name FROM instructor GROUP BY dept_name ORDER BY AVG(salary) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) Question: Find the name of the department which has the highest average salary of professors. [/INST] SELECT TOP 1 dept_name FROM instructor GROUP BY dept_name ORDER BY AVG(salary) DESC </s> |
Find the number and averaged salary of all instructors who are in the department with the highest budget. | CREATE TABLE department (dept_name VARCHAR, budget VARCHAR); CREATE TABLE instructor (salary INTEGER, dept_name VARCHAR) | SELECT TOP 1 AVG(T1.salary), COUNT(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE department (dept_name VARCHAR, budget VARCHAR); CREATE TABLE instructor (salary INTEGER, dept_name VARCHAR) Question: Find the number and averaged salary of all instructors who are in the department with the highest budget. [/INST] SELECT TOP 1 AVG(T1.salary), COUNT(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC </s> |
What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)? | CREATE TABLE SECTION (course_id VARCHAR, building VARCHAR, room_number VARCHAR); CREATE TABLE course (title VARCHAR, credits VARCHAR, course_id VARCHAR); CREATE TABLE classroom (capacity INTEGER, building VARCHAR, room_number VARCHAR); CREATE TABLE classroom (capacity INTEGER) | SELECT T3.title, T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT MAX(capacity) FROM classroom) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (course_id VARCHAR, building VARCHAR, room_number VARCHAR); CREATE TABLE course (title VARCHAR, credits VARCHAR, course_id VARCHAR); CREATE TABLE classroom (capacity INTEGER, building VARCHAR, room_number VARCHAR); CREATE TABLE classroom (capacity INTEGER) Question: What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)? [/INST] SELECT T3.title, T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT MAX(capacity) FROM classroom) </s> |
Find the name of students who didn't take any course from Biology department. | CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR); CREATE TABLE takes (id VARCHAR, course_id VARCHAR) | SELECT name FROM student WHERE NOT id IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR); CREATE TABLE takes (id VARCHAR, course_id VARCHAR) Question: Find the name of students who didn't take any course from Biology department. [/INST] SELECT name FROM student WHERE NOT id IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology') </s> |
Find the total number of students and total number of instructors for each department. | CREATE TABLE department (dept_name VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR); CREATE TABLE instructor (dept_name VARCHAR, id VARCHAR) | SELECT COUNT(DISTINCT T2.id), COUNT(DISTINCT T3.id), T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE department (dept_name VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR); CREATE TABLE instructor (dept_name VARCHAR, id VARCHAR) Question: Find the total number of students and total number of instructors for each department. [/INST] SELECT COUNT(DISTINCT T2.id), COUNT(DISTINCT T3.id), T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name </s> |
Find the name of students who have taken the prerequisite course of the course with title International Finance. | CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE takes (id VARCHAR, course_id VARCHAR) | SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE takes (id VARCHAR, course_id VARCHAR) Question: Find the name of students who have taken the prerequisite course of the course with title International Finance. [/INST] SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance') </s> |
Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department. | CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) | SELECT name, salary FROM instructor WHERE salary < (SELECT AVG(salary) FROM instructor WHERE dept_name = 'Physics') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) Question: Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department. [/INST] SELECT name, salary FROM instructor WHERE salary < (SELECT AVG(salary) FROM instructor WHERE dept_name = 'Physics') </s> |
Find the name of students who took some course offered by Statistics department. | CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE takes (course_id VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR) | SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE takes (course_id VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR) Question: Find the name of students who took some course offered by Statistics department. [/INST] SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics' </s> |
Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles. | CREATE TABLE SECTION (building VARCHAR, room_number VARCHAR, semester VARCHAR, year VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR, title VARCHAR) | SELECT T2.building, T2.room_number, T2.semester, T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (building VARCHAR, room_number VARCHAR, semester VARCHAR, year VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR, title VARCHAR) Question: Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles. [/INST] SELECT T2.building, T2.room_number, T2.semester, T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title </s> |
Find the names of all instructors in computer science department | CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR) | SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR) Question: Find the names of all instructors in computer science department [/INST] SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' </s> |
Find the names of all instructors in Comp. Sci. department with salary > 80000. | CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR, salary VARCHAR) | SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR, salary VARCHAR) Question: Find the names of all instructors in Comp. Sci. department with salary > 80000. [/INST] SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000 </s> |
Find the names of all instructors who have taught some course and the course_id. | CREATE TABLE instructor (ID VARCHAR); CREATE TABLE teaches (ID VARCHAR) | SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (ID VARCHAR); CREATE TABLE teaches (ID VARCHAR) Question: Find the names of all instructors who have taught some course and the course_id. [/INST] SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID </s> |
Find the names of all instructors in the Art department who have taught some course and the course_id. | CREATE TABLE instructor (ID VARCHAR, dept_name VARCHAR); CREATE TABLE teaches (ID VARCHAR) | SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (ID VARCHAR, dept_name VARCHAR); CREATE TABLE teaches (ID VARCHAR) Question: Find the names of all instructors in the Art department who have taught some course and the course_id. [/INST] SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art' </s> |
Find the names of all instructors whose name includes the substring “dar”. | CREATE TABLE instructor (name VARCHAR) | SELECT name FROM instructor WHERE name LIKE '%dar%' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR) Question: Find the names of all instructors whose name includes the substring “dar”. [/INST] SELECT name FROM instructor WHERE name LIKE '%dar%' </s> |
List in alphabetic order the names of all distinct instructors. | CREATE TABLE instructor (name VARCHAR) | SELECT DISTINCT name FROM instructor ORDER BY name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR) Question: List in alphabetic order the names of all distinct instructors. [/INST] SELECT DISTINCT name FROM instructor ORDER BY name </s> |
Find courses that ran in Fall 2009 or in Spring 2010. | CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) | SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) Question: Find courses that ran in Fall 2009 or in Spring 2010. [/INST] SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 </s> |
Find courses that ran in Fall 2009 and in Spring 2010. | CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) | SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) Question: Find courses that ran in Fall 2009 and in Spring 2010. [/INST] SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 </s> |
Find courses that ran in Fall 2009 but not in Spring 2010. | CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) | SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) Question: Find courses that ran in Fall 2009 but not in Spring 2010. [/INST] SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010 </s> |
Find the salaries of all distinct instructors that are less than the largest salary. | CREATE TABLE instructor (salary INTEGER) | SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT MAX(salary) FROM instructor) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (salary INTEGER) Question: Find the salaries of all distinct instructors that are less than the largest salary. [/INST] SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT MAX(salary) FROM instructor) </s> |
Find the total number of instructors who teach a course in the Spring 2010 semester. | CREATE TABLE teaches (ID VARCHAR, semester VARCHAR, YEAR VARCHAR) | SELECT COUNT(DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE teaches (ID VARCHAR, semester VARCHAR, YEAR VARCHAR) Question: Find the total number of instructors who teach a course in the Spring 2010 semester. [/INST] SELECT COUNT(DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010 </s> |
Find the names and average salaries of all departments whose average salary is greater than 42000. | CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) | SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name HAVING AVG(salary) > 42000 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) Question: Find the names and average salaries of all departments whose average salary is greater than 42000. [/INST] SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name HAVING AVG(salary) > 42000 </s> |
Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department. | CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) | SELECT name FROM instructor WHERE salary > (SELECT MIN(salary) FROM instructor WHERE dept_name = 'Biology') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) Question: Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department. [/INST] SELECT name FROM instructor WHERE salary > (SELECT MIN(salary) FROM instructor WHERE dept_name = 'Biology') </s> |
Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department. | CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) | SELECT name FROM instructor WHERE salary > (SELECT MAX(salary) FROM instructor WHERE dept_name = 'Biology') | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) Question: Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department. [/INST] SELECT name FROM instructor WHERE salary > (SELECT MAX(salary) FROM instructor WHERE dept_name = 'Biology') </s> |
How many debates are there? | CREATE TABLE debate (Id VARCHAR) | SELECT COUNT(*) FROM debate | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE debate (Id VARCHAR) Question: How many debates are there? [/INST] SELECT COUNT(*) FROM debate </s> |
List the venues of debates in ascending order of the number of audience. | CREATE TABLE debate (Venue VARCHAR, Num_of_Audience VARCHAR) | SELECT Venue FROM debate ORDER BY Num_of_Audience | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE debate (Venue VARCHAR, Num_of_Audience VARCHAR) Question: List the venues of debates in ascending order of the number of audience. [/INST] SELECT Venue FROM debate ORDER BY Num_of_Audience </s> |
What are the date and venue of each debate? | CREATE TABLE debate (Date VARCHAR, Venue VARCHAR) | SELECT Date, Venue FROM debate | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE debate (Date VARCHAR, Venue VARCHAR) Question: What are the date and venue of each debate? [/INST] SELECT Date, Venue FROM debate </s> |
List the dates of debates with number of audience bigger than 150 | CREATE TABLE debate (Date VARCHAR, Num_of_Audience INTEGER) | SELECT Date FROM debate WHERE Num_of_Audience > 150 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE debate (Date VARCHAR, Num_of_Audience INTEGER) Question: List the dates of debates with number of audience bigger than 150 [/INST] SELECT Date FROM debate WHERE Num_of_Audience > 150 </s> |
Show the names of people aged either 35 or 36. | CREATE TABLE people (Name VARCHAR, Age VARCHAR) | SELECT Name FROM people WHERE Age = 35 OR Age = 36 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Name VARCHAR, Age VARCHAR) Question: Show the names of people aged either 35 or 36. [/INST] SELECT Name FROM people WHERE Age = 35 OR Age = 36 </s> |
What is the party of the youngest people? | CREATE TABLE people (Party VARCHAR, Age VARCHAR) | SELECT TOP 1 Party FROM people ORDER BY Age | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Party VARCHAR, Age VARCHAR) Question: What is the party of the youngest people? [/INST] SELECT TOP 1 Party FROM people ORDER BY Age </s> |
Show different parties of people along with the number of people in each party. | CREATE TABLE people (Party VARCHAR) | SELECT Party, COUNT(*) FROM people GROUP BY Party | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Party VARCHAR) Question: Show different parties of people along with the number of people in each party. [/INST] SELECT Party, COUNT(*) FROM people GROUP BY Party </s> |
Show the party that has the most people. | CREATE TABLE people (Party VARCHAR) | SELECT TOP 1 Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Party VARCHAR) Question: Show the party that has the most people. [/INST] SELECT TOP 1 Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC </s> |
Show the distinct venues of debates | CREATE TABLE debate (Venue VARCHAR) | SELECT DISTINCT Venue FROM debate | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE debate (Venue VARCHAR) Question: Show the distinct venues of debates [/INST] SELECT DISTINCT Venue FROM debate </s> |
Show the names of people, and dates and venues of debates they are on the affirmative side. | CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Date VARCHAR, Venue VARCHAR, Debate_ID VARCHAR); CREATE TABLE debate_people (Debate_ID VARCHAR, Affirmative VARCHAR) | SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Date VARCHAR, Venue VARCHAR, Debate_ID VARCHAR); CREATE TABLE debate_people (Debate_ID VARCHAR, Affirmative VARCHAR) Question: Show the names of people, and dates and venues of debates they are on the affirmative side. [/INST] SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID </s> |
Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name. | CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Date VARCHAR, Venue VARCHAR, Debate_ID VARCHAR); CREATE TABLE debate_people (Debate_ID VARCHAR, Negative VARCHAR) | SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID ORDER BY T3.Name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Date VARCHAR, Venue VARCHAR, Debate_ID VARCHAR); CREATE TABLE debate_people (Debate_ID VARCHAR, Negative VARCHAR) Question: Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name. [/INST] SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID ORDER BY T3.Name </s> |
Show the names of people that are on affirmative side of debates with number of audience bigger than 200. | CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Debate_ID VARCHAR, Num_of_Audience INTEGER); CREATE TABLE debate_people (Debate_ID VARCHAR, Affirmative VARCHAR) | SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID WHERE T2.Num_of_Audience > 200 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Debate_ID VARCHAR, Num_of_Audience INTEGER); CREATE TABLE debate_people (Debate_ID VARCHAR, Affirmative VARCHAR) Question: Show the names of people that are on affirmative side of debates with number of audience bigger than 200. [/INST] SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID WHERE T2.Num_of_Audience > 200 </s> |
Show the names of people and the number of times they have been on the affirmative side of debates. | CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate_people (Affirmative VARCHAR) | SELECT T2.Name, COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate_people (Affirmative VARCHAR) Question: Show the names of people and the number of times they have been on the affirmative side of debates. [/INST] SELECT T2.Name, COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name </s> |
Show the names of people who have been on the negative side of debates at least twice. | CREATE TABLE debate_people (Negative VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) | SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative = T2.People_ID GROUP BY T2.Name HAVING COUNT(*) >= 2 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE debate_people (Negative VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) Question: Show the names of people who have been on the negative side of debates at least twice. [/INST] SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative = T2.People_ID GROUP BY T2.Name HAVING COUNT(*) >= 2 </s> |
List the names of people that have not been on the affirmative side of debates. | CREATE TABLE debate_people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR); CREATE TABLE people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR) | SELECT Name FROM people WHERE NOT People_id IN (SELECT Affirmative FROM debate_people) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE debate_people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR); CREATE TABLE people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR) Question: List the names of people that have not been on the affirmative side of debates. [/INST] SELECT Name FROM people WHERE NOT People_id IN (SELECT Affirmative FROM debate_people) </s> |
List the names of all the customers in alphabetical order. | CREATE TABLE customers (customer_details VARCHAR) | SELECT customer_details FROM customers ORDER BY customer_details | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (customer_details VARCHAR) Question: List the names of all the customers in alphabetical order. [/INST] SELECT customer_details FROM customers ORDER BY customer_details </s> |
Find all the policy type codes associated with the customer "Dayana Robel" | CREATE TABLE customers (customer_id VARCHAR, customer_details VARCHAR); CREATE TABLE policies (customer_id VARCHAR) | SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = "Dayana Robel" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (customer_id VARCHAR, customer_details VARCHAR); CREATE TABLE policies (customer_id VARCHAR) Question: Find all the policy type codes associated with the customer "Dayana Robel" [/INST] SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = "Dayana Robel" </s> |
Which type of policy is most frequently used? Give me the policy type code. | CREATE TABLE policies (policy_type_code VARCHAR) | SELECT TOP 1 policy_type_code FROM 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 policies (policy_type_code VARCHAR) Question: Which type of policy is most frequently used? Give me the policy type code. [/INST] SELECT TOP 1 policy_type_code FROM policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC </s> |
Find all the policy types that are used by more than 2 customers. | CREATE TABLE policies (policy_type_code VARCHAR) | SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING COUNT(*) > 2 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE policies (policy_type_code VARCHAR) Question: Find all the policy types that are used by more than 2 customers. [/INST] SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING COUNT(*) > 2 </s> |
Find the total and average amount paid in claim headers. | CREATE TABLE claim_headers (amount_piad INTEGER) | SELECT SUM(amount_piad), AVG(amount_piad) FROM claim_headers | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE claim_headers (amount_piad INTEGER) Question: Find the total and average amount paid in claim headers. [/INST] SELECT SUM(amount_piad), AVG(amount_piad) FROM claim_headers </s> |
Find the total amount claimed in the most recently created document. | CREATE TABLE claim_headers (amount_claimed INTEGER, claim_header_id VARCHAR); CREATE TABLE claims_documents (claim_id VARCHAR, created_date VARCHAR); CREATE TABLE claims_documents (created_date VARCHAR) | SELECT SUM(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT TOP 1 created_date FROM claims_documents ORDER BY created_date) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE claim_headers (amount_claimed INTEGER, claim_header_id VARCHAR); CREATE TABLE claims_documents (claim_id VARCHAR, created_date VARCHAR); CREATE TABLE claims_documents (created_date VARCHAR) Question: Find the total amount claimed in the most recently created document. [/INST] SELECT SUM(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT TOP 1 created_date FROM claims_documents ORDER BY created_date) </s> |
What is the name of the customer who has made the largest amount of claim in a single claim? | CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (amount_claimed INTEGER); CREATE TABLE policies (policy_id VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (policy_id VARCHAR, amount_claimed INTEGER) | SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT MAX(amount_claimed) FROM claim_headers) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (amount_claimed INTEGER); CREATE TABLE policies (policy_id VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (policy_id VARCHAR, amount_claimed INTEGER) Question: What is the name of the customer who has made the largest amount of claim in a single claim? [/INST] SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT MAX(amount_claimed) FROM claim_headers) </s> |
What is the name of the customer who has made the minimum amount of payment in one claim? | CREATE TABLE claim_headers (amount_piad INTEGER); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (policy_id VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (policy_id VARCHAR, amount_piad INTEGER) | SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT MIN(amount_piad) FROM claim_headers) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE claim_headers (amount_piad INTEGER); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (policy_id VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (policy_id VARCHAR, amount_piad INTEGER) Question: What is the name of the customer who has made the minimum amount of payment in one claim? [/INST] SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT MIN(amount_piad) FROM claim_headers) </s> |
Find the names of customers who have no policies associated. | CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_details VARCHAR); CREATE TABLE policies (customer_id VARCHAR) | SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers 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 customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_details VARCHAR); CREATE TABLE policies (customer_id VARCHAR) Question: Find the names of customers who have no policies associated. [/INST] SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id </s> |
How many claim processing stages are there in total? | CREATE TABLE claims_processing_stages (Id VARCHAR) | SELECT COUNT(*) FROM claims_processing_stages | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE claims_processing_stages (Id VARCHAR) Question: How many claim processing stages are there in total? [/INST] SELECT COUNT(*) FROM claims_processing_stages </s> |
What is the name of the claim processing stage that most of the claims are on? | CREATE TABLE claims_processing (claim_stage_id VARCHAR); CREATE TABLE claims_processing_stages (claim_status_name VARCHAR, claim_stage_id VARCHAR) | SELECT TOP 1 t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE claims_processing (claim_stage_id VARCHAR); CREATE TABLE claims_processing_stages (claim_status_name VARCHAR, claim_stage_id VARCHAR) Question: What is the name of the claim processing stage that most of the claims are on? [/INST] SELECT TOP 1 t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY COUNT(*) DESC </s> |
Find the names of customers whose name contains "Diana". | CREATE TABLE customers (customer_details VARCHAR) | SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (customer_details VARCHAR) Question: Find the names of customers whose name contains "Diana". [/INST] SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%" </s> |
Find the names of the customers who have an deputy policy. | CREATE TABLE policies (customer_id VARCHAR, policy_type_code VARCHAR); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR) | SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE policies (customer_id VARCHAR, policy_type_code VARCHAR); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR) Question: Find the names of the customers who have an deputy policy. [/INST] SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy" </s> |
Find the names of customers who either have an deputy policy or uniformed policy. | CREATE TABLE policies (customer_id VARCHAR, policy_type_code VARCHAR); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR) | SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy" OR t1.policy_type_code = "Uniform" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE policies (customer_id VARCHAR, policy_type_code VARCHAR); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR) Question: Find the names of customers who either have an deputy policy or uniformed policy. [/INST] SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy" OR t1.policy_type_code = "Uniform" </s> |
Find the names of all the customers and staff members. | CREATE TABLE staff (customer_details VARCHAR, staff_details VARCHAR); CREATE TABLE customers (customer_details VARCHAR, staff_details VARCHAR) | SELECT customer_details FROM customers UNION SELECT staff_details FROM staff | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE staff (customer_details VARCHAR, staff_details VARCHAR); CREATE TABLE customers (customer_details VARCHAR, staff_details VARCHAR) Question: Find the names of all the customers and staff members. [/INST] SELECT customer_details FROM customers UNION SELECT staff_details FROM staff </s> |
Find the number of records of each policy type and its type code. | CREATE TABLE policies (policy_type_code VARCHAR) | SELECT policy_type_code, COUNT(*) FROM policies GROUP BY policy_type_code | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE policies (policy_type_code VARCHAR) Question: Find the number of records of each policy type and its type code. [/INST] SELECT policy_type_code, COUNT(*) FROM policies GROUP BY policy_type_code </s> |
Find the name of the customer that has been involved in the most policies. | CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (customer_id VARCHAR) | SELECT TOP 1 t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (customer_id VARCHAR) Question: Find the name of the customer that has been involved in the most policies. [/INST] SELECT TOP 1 t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details ORDER BY COUNT(*) DESC </s> |
What is the description of the claim status "Open"? | CREATE TABLE claims_processing_stages (claim_status_description VARCHAR, claim_status_name VARCHAR) | SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE claims_processing_stages (claim_status_description VARCHAR, claim_status_name VARCHAR) Question: What is the description of the claim status "Open"? [/INST] SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = "Open" </s> |
How many distinct claim outcome codes are there? | CREATE TABLE claims_processing (claim_outcome_code VARCHAR) | SELECT COUNT(DISTINCT claim_outcome_code) FROM claims_processing | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE claims_processing (claim_outcome_code VARCHAR) Question: How many distinct claim outcome codes are there? [/INST] SELECT COUNT(DISTINCT claim_outcome_code) FROM claims_processing </s> |
Which customer is associated with the latest policy? | CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (start_date INTEGER); CREATE TABLE policies (customer_id VARCHAR, start_date INTEGER) | SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT MAX(start_date) FROM policies) | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (start_date INTEGER); CREATE TABLE policies (customer_id VARCHAR, start_date INTEGER) Question: Which customer is associated with the latest policy? [/INST] SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT MAX(start_date) FROM policies) </s> |
Show the id, the date of account opened, the account name, and other account detail for all accounts. | CREATE TABLE Accounts (account_id VARCHAR, date_account_opened VARCHAR, account_name VARCHAR, other_account_details VARCHAR) | SELECT account_id, date_account_opened, account_name, other_account_details FROM Accounts | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (account_id VARCHAR, date_account_opened VARCHAR, account_name VARCHAR, other_account_details VARCHAR) Question: Show the id, the date of account opened, the account name, and other account detail for all accounts. [/INST] SELECT account_id, date_account_opened, account_name, other_account_details FROM Accounts </s> |
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'. | CREATE TABLE Accounts (account_id VARCHAR, date_account_opened VARCHAR, account_name VARCHAR, other_account_details VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR) | SELECT T1.account_id, T1.date_account_opened, T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan' | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (account_id VARCHAR, date_account_opened VARCHAR, account_name VARCHAR, other_account_details VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR) Question: Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'. [/INST] SELECT T1.account_id, T1.date_account_opened, T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan' </s> |
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling. | CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, other_account_details VARCHAR, customer_id VARCHAR) | SELECT T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Meaghan" AND T2.customer_last_name = "Keeling" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, other_account_details VARCHAR, customer_id VARCHAR) Question: Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling. [/INST] SELECT T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Meaghan" AND T2.customer_last_name = "Keeling" </s> |
Show the first name and last name for the customer with account name 900. | CREATE TABLE Accounts (customer_id VARCHAR, account_name VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) | SELECT T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "900" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR, account_name VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) Question: Show the first name and last name for the customer with account name 900. [/INST] SELECT T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "900" </s> |
Show the unique first names, last names, and phone numbers for all customers with any account. | CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR) | SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts 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 Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR) Question: Show the unique first names, last names, and phone numbers for all customers with any account. [/INST] SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id </s> |
Show customer ids who don't have an account. | CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) | SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) Question: Show customer ids who don't have an account. [/INST] SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts </s> |
How many accounts does each customer have? List the number and customer id. | CREATE TABLE Accounts (customer_id VARCHAR) | SELECT COUNT(*), customer_id FROM Accounts GROUP BY customer_id | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR) Question: How many accounts does each customer have? List the number and customer id. [/INST] SELECT COUNT(*), customer_id FROM Accounts GROUP BY customer_id </s> |
What is the customer id, first and last name with most number of accounts. | CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) | SELECT TOP 1 T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) Question: What is the customer id, first and last name with most number of accounts. [/INST] SELECT TOP 1 T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC </s> |
Show id, first name and last name for all customers and the number of accounts. | CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) | SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) Question: Show id, first name and last name for all customers and the number of accounts. [/INST] SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id </s> |
Show first name and id for all customers with at least 2 accounts. | CREATE TABLE Customers (customer_first_name VARCHAR, customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) | SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2 | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (customer_first_name VARCHAR, customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) Question: Show first name and id for all customers with at least 2 accounts. [/INST] SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2 </s> |
Show the number of customers for each gender. | CREATE TABLE Customers (gender VARCHAR) | SELECT gender, COUNT(*) FROM Customers GROUP BY gender | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Customers (gender VARCHAR) Question: Show the number of customers for each gender. [/INST] SELECT gender, COUNT(*) FROM Customers GROUP BY gender </s> |
How many transactions do we have? | CREATE TABLE Financial_transactions (Id VARCHAR) | SELECT COUNT(*) FROM Financial_transactions | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Financial_transactions (Id VARCHAR) Question: How many transactions do we have? [/INST] SELECT COUNT(*) FROM Financial_transactions </s> |
How many transaction does each account have? Show the number and account id. | CREATE TABLE Financial_transactions (account_id VARCHAR) | SELECT COUNT(*), account_id FROM Financial_transactions | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Financial_transactions (account_id VARCHAR) Question: How many transaction does each account have? Show the number and account id. [/INST] SELECT COUNT(*), account_id FROM Financial_transactions </s> |
How many transaction does account with name 337 have? | CREATE TABLE Accounts (account_id VARCHAR, account_name VARCHAR); CREATE TABLE Financial_transactions (account_id VARCHAR) | SELECT COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337" | <s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Accounts (account_id VARCHAR, account_name VARCHAR); CREATE TABLE Financial_transactions (account_id VARCHAR) Question: How many transaction does account with name 337 have? [/INST] SELECT COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337" </s> |
Subsets and Splits