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 credits of courses provided by different department. [/INST]

Output: SELECT sum(credits) ,  dept_name FROM course GROUP BY 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 total credits are offered by each department? [/INST]

Output: SELECT sum(credits) ,  dept_name FROM course GROUP BY 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 minimum salary for the departments whose average salary is above the average payment of all instructors. [/INST]

Output: SELECT min(salary) ,  dept_name FROM instructor GROUP BY dept_name HAVING avg(salary)  >  (SELECT avg(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 is the lowest salary in departments with average salary greater than the overall average. [/INST]

Output: SELECT min(salary) ,  dept_name FROM instructor GROUP BY dept_name HAVING avg(salary)  >  (SELECT avg(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 number of courses provided in each semester and year. [/INST]

Output: SELECT count(*) ,  semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR;


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 courses are provided in each semester and year? [/INST]

Output: SELECT count(*) ,  semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR;


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 year which offers the largest number of courses. [/INST]

Output: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) 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: Which year had the greatest number of courses? [/INST]

Output: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) 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 year and semester when offers the largest number of courses. [/INST]

Output: SELECT semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR ORDER BY count(*) 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 year and semester with the most courses? [/INST]

Output: SELECT semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR ORDER BY count(*) 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 name of department has the highest amount of students? [/INST]

Output: SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) 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 name of the deparment with the highest enrollment? [/INST]

Output: SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) 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 total number of students in each department. [/INST]

Output: SELECT count(*) ,  dept_name FROM student GROUP BY 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 are in each department? [/INST]

Output: SELECT count(*) ,  dept_name FROM student GROUP BY 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 semester and year which has the least number of student taking any class. [/INST]

Output: SELECT semester ,  YEAR FROM takes GROUP BY semester ,  YEAR ORDER BY count(*) 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: Which semeseter and year had the fewest students? [/INST]

Output: SELECT semester ,  YEAR FROM takes GROUP BY semester ,  YEAR ORDER BY count(*) 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 id of the instructor who advises of all students from History department? [/INST]

Output: SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id WHERE T2.dept_name  =  'History';


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 id of the instructor who advises students in the History department. [/INST]

Output: SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id WHERE T2.dept_name  =  'History';


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 the instructors who are advisors of any student from History department? [/INST]

Output: SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'History';


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 of instructors who advises students in the History department? [/INST]

Output: SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'History';


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 id of the courses that do not have any prerequisite? [/INST]

Output: SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq;


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 without prerequisites? [/INST]

Output: SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq;


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 the courses that do not have any prerequisite? [/INST]

Output: SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq);


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 courses without prerequisites? [/INST]

Output: SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq);


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 of the prerequisite class of International Finance course? [/INST]

Output: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'International Finance');


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 of the prerequisite to the course International Finance. [/INST]

Output: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'International Finance');


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 title of course whose prerequisite is course Differential Geometry. [/INST]

Output: SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id  =  T2.course_id WHERE T2.title  =  'Differential Geometry');


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 of the course with Differential Geometry as a prerequisite? [/INST]

Output: SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id  =  T2.course_id WHERE T2.title  =  'Differential Geometry');


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 students who have taken any course in the fall semester of year 2003. [/INST]

Output: SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester  =  'Fall' AND YEAR  =  2003);


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 took a course in the Fall of 2003? [/INST]

Output: SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester  =  'Fall' AND YEAR  =  2003);


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 of the course that was offered at building Chandler during the fall semester in the year of 2010? [/INST]

Output: SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id  =  T2.course_id WHERE building  =  'Chandler' AND semester  =  'Fall' AND YEAR  =  2010;


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 of the course offered in Chandler during the Fall of 2010. [/INST]

Output: SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id  =  T2.course_id WHERE building  =  'Chandler' AND semester  =  'Fall' AND YEAR  =  2010;


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 the instructors who taught C Programming course before. [/INST]

Output: SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id  =  T2.id JOIN course AS T3 ON T2.course_id  =  T3.course_id WHERE T3.title  =  'C Programming';


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 have taught C Programming courses? [/INST]

Output: SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id  =  T2.id JOIN course AS T3 ON T2.course_id  =  T3.course_id WHERE T3.title  =  'C Programming';


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 who are advisors of the students from the Math department. [/INST]

Output: SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math';


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 of instructors who advise students in the Math department? [/INST]

Output: SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math';


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 instructors who are advisors of the students from the Math department, and sort the results by students' total credit. [/INST]

Output: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math' ORDER BY T3.tot_cred;


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 advise students in the math depart sorted by total credits of the student. [/INST]

Output: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math' ORDER BY T3.tot_cred;


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 course title of the prerequisite of course Mobile Computing? [/INST]

Output: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'Mobile Computing');


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 of the course that is a prerequisite for Mobile Computing? [/INST]

Output: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'Mobile Computing');


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 instructor who is the advisor of the student who has the highest number of total credits. [/INST]

Output: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id ORDER BY T3.tot_cred 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 name of the instructor who advises the student with the greatest number of total credits? [/INST]

Output: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id ORDER BY T3.tot_cred 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 name of instructors who didn't teach any courses? [/INST]

Output: SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches);


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 didn't teach? [/INST]

Output: SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches);


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 id of instructors who didn't teach any courses? [/INST]

Output: SELECT id FROM instructor EXCEPT SELECT id FROM teaches;


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 instructors who didnt' teach? [/INST]

Output: SELECT id FROM instructor EXCEPT SELECT id FROM teaches;


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 instructors who didn't each any courses in any Spring semester. [/INST]

Output: SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester  =  'Spring');


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 didn't teach courses in the Spring? [/INST]

Output: SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester  =  'Spring');


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 the department which has the highest average salary of professors. [/INST]

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