Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Which department has the highest average instructor salary? [/INST]

Output: SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the number and averaged salary of all instructors who are in the department with the highest budget. [/INST]

Output: SELECT avg(T1.salary) ,  count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name  =  T2.dept_name ORDER BY T2.budget DESC LIMIT 1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many instructors are in the department with the highest budget, and what is their average salary? [/INST]

Output: SELECT avg(T1.salary) ,  count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name  =  T2.dept_name ORDER BY T2.budget DESC LIMIT 1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)? [/INST]

Output: 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);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Give the title and credits for the course that is taught in the classroom with the greatest capacity. [/INST]

Output: 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);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the name of students who didn't take any course from Biology department. [/INST]

Output: SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.dept_name  =  'Biology');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of students who haven't taken any Biology courses? [/INST]

Output: SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.dept_name  =  'Biology');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the total number of students and total number of instructors for each department. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many students and instructors are in each department? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the name of students who have taken the prerequisite course of the course with title International Finance. [/INST]

Output: 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');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of students who have taken the prerequisite for the course International Finance? [/INST]

Output: 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');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department. [/INST]

Output: SELECT name ,  salary FROM instructor WHERE salary  <  (SELECT avg(salary) FROM instructor WHERE dept_name  =  'Physics');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names and salaries for instructors who earn less than the average salary of instructors in the Physics department? [/INST]

Output: SELECT name ,  salary FROM instructor WHERE salary  <  (SELECT avg(salary) FROM instructor WHERE dept_name  =  'Physics');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the name of students who took some course offered by Statistics department. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of students who have taken Statistics courses? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the building, room number, semester and year of courses in the Psychology department, sorted using course title? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the names of all instructors in computer science department [/INST]

Output: SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of all instructors in the Comp. Sci. department? [/INST]

Output: SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the names of all instructors in Comp. Sci. department with salary > 80000. [/INST]

Output: SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.'  AND salary  >  80000;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of the instructors in the Comp. Sci. department who earn more than 80000? [/INST]

Output: SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.'  AND salary  >  80000;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the names of all instructors who have taught some course and the course_id. [/INST]

Output: SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of all instructors who have taught a course, as well as the corresponding course id? [/INST]

Output: SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the names of all instructors in the Art department who have taught some course and the course_id. [/INST]

Output: SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID WHERE T1.dept_name  =  'Art';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of Art instructors who have taught a course, and the corresponding course id? [/INST]

Output: SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID WHERE T1.dept_name  =  'Art';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the names of all instructors whose name includes the substring “dar”. [/INST]

Output: SELECT name FROM instructor WHERE name LIKE '%dar%';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of all instructors with names that include "dar"? [/INST]

Output: SELECT name FROM instructor WHERE name LIKE '%dar%';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: List in alphabetic order the names of all distinct instructors. [/INST]

Output: SELECT DISTINCT name FROM  instructor ORDER BY name;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: List the distinct names of the instructors, ordered by name. [/INST]

Output: SELECT DISTINCT name FROM  instructor ORDER BY name;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find courses that ran in Fall 2009 or in Spring 2010. [/INST]

Output: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 UNION SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the ids for courses in the Fall of 2009 or the Spring of 2010? [/INST]

Output: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 UNION SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find courses that ran in Fall 2009 and in Spring 2010. [/INST]

Output: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 INTERSECT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the ids for courses that were offered in both Fall of 2009 and Spring of 2010? [/INST]

Output: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 INTERSECT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find courses that ran in Fall 2009 but not in Spring 2010. [/INST]

Output: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 EXCEPT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the ids of courses offered in Fall of 2009 but not in Spring of 2010? [/INST]

Output: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 EXCEPT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the salaries of all distinct instructors that are less than the largest salary. [/INST]

Output: SELECT DISTINCT salary FROM instructor WHERE salary  <  (SELECT max(salary) FROM instructor);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the distinct salaries of all instructors who earned less than the maximum salary? [/INST]

Output: SELECT DISTINCT salary FROM instructor WHERE salary  <  (SELECT max(salary) FROM instructor);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the total number of instructors who teach a course in the Spring 2010 semester. [/INST]

Output: SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many instructors teach a course in the Spring of 2010? [/INST]

Output: SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the names and average salaries of all departments whose average salary is greater than 42000. [/INST]

Output: SELECT dept_name ,  AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary)  >  42000;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names and average salaries for departments with average salary higher than 42000? [/INST]

Output: SELECT dept_name ,  AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary)  >  42000;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department. [/INST]

Output: SELECT name FROM instructor WHERE salary  >  (SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of instructors who earn more than at least one instructor from the Biology department? [/INST]

Output: SELECT name FROM instructor WHERE salary  >  (SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department. [/INST]

Output: SELECT name FROM instructor WHERE salary  >  (SELECT max(salary) FROM instructor WHERE dept_name  =  'Biology');


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the names of all instructors with a higher salary than any of the instructors in the Biology department? [/INST]

Output: SELECT name FROM instructor WHERE salary  >  (SELECT max(salary) FROM instructor WHERE dept_name  =  'Biology');


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: How many debates are there? [/INST]

Output: SELECT count(*) FROM debate;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: List the venues of debates in ascending order of the number of audience. [/INST]

Output: SELECT Venue FROM debate ORDER BY Num_of_Audience ASC;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: What are the date and venue of each debate? [/INST]

Output: SELECT Date ,  Venue FROM debate;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: List the dates of debates with number of audience bigger than 150 [/INST]

Output: SELECT Date FROM debate WHERE Num_of_Audience  >  150;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of people aged either 35 or 36. [/INST]

Output: SELECT Name FROM  people WHERE Age  =  35 OR Age  =  36;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: What is the party of the youngest people? [/INST]

Output: SELECT Party FROM people ORDER BY Age ASC LIMIT 1;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show different parties of people along with the number of people in each party. [/INST]

Output: SELECT Party ,  COUNT(*) FROM people GROUP BY Party;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show the party that has the most people. [/INST]

Output: SELECT Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show the distinct venues of debates [/INST]

Output: SELECT DISTINCT Venue FROM debate;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of people, and dates and venues of debates they are on the affirmative side. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
people :
People_ID [ INT ] primary_key
District [ TEXT ]
Name [ TEXT ]
Party [ TEXT ]
Age [ INT ]

debate :
Debate_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Num_of_Audience [ INT ]

debate_people :
Debate_ID [ INT ] primary_key debate_people.Debate_ID = debate.Debate_ID
Affirmative [ INT ] debate_people.Affirmative = people.People_ID
Negative [ INT ] debate_people.Negative = people.People_ID
If_Affirmative_Win [ TEXT ]

Please write me a SQL statement that answers the following 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]

Output: 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 ASC;