db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
|---|---|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the minimum salary for the departments whose average salary is above the average payment of all instructors.
#
### SQL:
#
# SELECT min(salary) , dept_name FROM instructor GROUP BY dept_name HAVING avg(salary) > (SELECT avg(salary) FROM instructor)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the lowest salary in departments with average salary greater than the overall average.
#
### SQL:
#
# SELECT min(salary) , dept_name FROM instructor GROUP BY dept_name HAVING avg(salary) > (SELECT avg(salary) FROM instructor)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the number of courses provided in each semester and year.
#
### SQL:
#
# SELECT count(*) , semester , YEAR FROM SECTION GROUP BY semester , YEAR
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# How many courses are provided in each semester and year?
#
### SQL:
#
# SELECT count(*) , semester , YEAR FROM SECTION GROUP BY semester , YEAR
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the year which offers the largest number of courses.
#
### SQL:
#
# SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Which year had the greatest number of courses?
#
### SQL:
#
# SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the year and semester when offers the largest number of courses.
#
### SQL:
#
# SELECT semester , YEAR FROM SECTION GROUP BY semester , YEAR ORDER BY count(*) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the year and semester with the most courses?
#
### SQL:
#
# SELECT semester , YEAR FROM SECTION GROUP BY semester , YEAR ORDER BY count(*) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of department has the highest amount of students?
#
### SQL:
#
# SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the name of the deparment with the highest enrollment?
#
### SQL:
#
# SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the total number of students in each department.
#
### SQL:
#
# SELECT count(*) , dept_name FROM student GROUP BY dept_name
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# How many students are in each department?
#
### SQL:
#
# SELECT count(*) , dept_name FROM student GROUP BY dept_name
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the semester and year which has the least number of student taking any class.
#
### SQL:
#
# SELECT semester , YEAR FROM takes GROUP BY semester , YEAR ORDER BY count(*) LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Which semeseter and year had the fewest students?
#
### SQL:
#
# SELECT semester , YEAR FROM takes GROUP BY semester , YEAR ORDER BY count(*) LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the id of the instructor who advises of all students from History department?
#
### SQL:
#
# SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Give id of the instructor who advises students in the History department.
#
### SQL:
#
# SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name and salary of the instructors who are advisors of any student from History department?
#
### SQL:
#
# 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'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names and salaries of instructors who advises students in the History department?
#
### SQL:
#
# 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'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the id of the courses that do not have any prerequisite?
#
### SQL:
#
# SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the ids of courses without prerequisites?
#
### SQL:
#
# SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of the courses that do not have any prerequisite?
#
### SQL:
#
# SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of courses without prerequisites?
#
### SQL:
#
# SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the title of the prerequisite class of International Finance course?
#
### SQL:
#
# 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')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Give the title of the prerequisite to the course International Finance.
#
### SQL:
#
# 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')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the title of course whose prerequisite is course Differential Geometry.
#
### SQL:
#
# 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')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the title of the course with Differential Geometry as a prerequisite?
#
### SQL:
#
# 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')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of students who have taken any course in the fall semester of year 2003.
#
### SQL:
#
# SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of students who took a course in the Fall of 2003?
#
### SQL:
#
# SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the title of the course that was offered at building Chandler during the fall semester in the year of 2010?
#
### SQL:
#
# 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
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Give the title of the course offered in Chandler during the Fall of 2010.
#
### SQL:
#
# 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
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of the instructors who taught C Programming course before.
#
### SQL:
#
# 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'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of instructors who have taught C Programming courses?
#
### SQL:
#
# 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'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name and salary of instructors who are advisors of the students from the Math department.
#
### SQL:
#
# 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'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names and salaries of instructors who advise students in the Math department?
#
### SQL:
#
# 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'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit.
#
### SQL:
#
# 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
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of all instructors who advise students in the math depart sorted by total credits of the student.
#
### SQL:
#
# 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
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the course title of the prerequisite of course Mobile Computing?
#
### SQL:
#
# 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')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the title of the course that is a prerequisite for Mobile Computing?
#
### SQL:
#
# 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')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of instructor who is the advisor of the student who has the highest number of total credits.
#
### SQL:
#
# 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
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the name of the instructor who advises the student with the greatest number of total credits?
#
### SQL:
#
# 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
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of instructors who didn't teach any courses?
#
### SQL:
#
# SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of instructors who didn't teach?
#
### SQL:
#
# SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the id of instructors who didn't teach any courses?
#
### SQL:
#
# SELECT id FROM instructor EXCEPT SELECT id FROM teaches
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the ids of instructors who didnt' teach?
#
### SQL:
#
# SELECT id FROM instructor EXCEPT SELECT id FROM teaches
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of instructors who didn't each any courses in any Spring semester.
#
### SQL:
#
# SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester = 'Spring')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of instructors who didn't teach courses in the Spring?
#
### SQL:
#
# SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester = 'Spring')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of the department which has the highest average salary of professors.
#
### SQL:
#
# SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Which department has the highest average instructor salary?
#
### SQL:
#
# SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the number and averaged salary of all instructors who are in the department with the highest budget.
#
### SQL:
#
# SELECT avg(T1.salary) , count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# How many instructors are in the department with the highest budget, and what is their average salary?
#
### SQL:
#
# SELECT avg(T1.salary) , count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)?
#
### SQL:
#
# SELECT T3.title , T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT max(capacity) FROM classroom)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Give the title and credits for the course that is taught in the classroom with the greatest capacity.
#
### SQL:
#
# SELECT T3.title , T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT max(capacity) FROM classroom)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of students who didn't take any course from Biology department.
#
### SQL:
#
# SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of students who haven't taken any Biology courses?
#
### SQL:
#
# SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the total number of students and total number of instructors for each department.
#
### SQL:
#
# SELECT count(DISTINCT T2.id) , count(DISTINCT T3.id) , T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# How many students and instructors are in each department?
#
### SQL:
#
# SELECT count(DISTINCT T2.id) , count(DISTINCT T3.id) , T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of students who have taken the prerequisite course of the course with title International Finance.
#
### SQL:
#
# SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of students who have taken the prerequisite for the course International Finance?
#
### SQL:
#
# SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department.
#
### SQL:
#
# SELECT name , salary FROM instructor WHERE salary < (SELECT avg(salary) FROM instructor WHERE dept_name = 'Physics')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names and salaries for instructors who earn less than the average salary of instructors in the Physics department?
#
### SQL:
#
# SELECT name , salary FROM instructor WHERE salary < (SELECT avg(salary) FROM instructor WHERE dept_name = 'Physics')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the name of students who took some course offered by Statistics department.
#
### SQL:
#
# SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of students who have taken Statistics courses?
#
### SQL:
#
# SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles.
#
### SQL:
#
# SELECT T2.building , T2.room_number , T2.semester , T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the building, room number, semester and year of courses in the Psychology department, sorted using course title?
#
### SQL:
#
# SELECT T2.building , T2.room_number , T2.semester , T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of all instructors in computer science department
#
### SQL:
#
# SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of all instructors in the Comp. Sci. department?
#
### SQL:
#
# SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of all instructors in Comp. Sci. department with salary > 80000.
#
### SQL:
#
# SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of the instructors in the Comp. Sci. department who earn more than 80000?
#
### SQL:
#
# SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of all instructors who have taught some course and the course_id.
#
### SQL:
#
# SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of all instructors who have taught a course, as well as the corresponding course id?
#
### SQL:
#
# SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of all instructors in the Art department who have taught some course and the course_id.
#
### SQL:
#
# SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of Art instructors who have taught a course, and the corresponding course id?
#
### SQL:
#
# SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of all instructors whose name includes the substring “dar”.
#
### SQL:
#
# SELECT name FROM instructor WHERE name LIKE '%dar%'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of all instructors with names that include "dar"?
#
### SQL:
#
# SELECT name FROM instructor WHERE name LIKE '%dar%'
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# List in alphabetic order the names of all distinct instructors.
#
### SQL:
#
# SELECT DISTINCT name FROM instructor ORDER BY name
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# List the distinct names of the instructors, ordered by name.
#
### SQL:
#
# SELECT DISTINCT name FROM instructor ORDER BY name
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find courses that ran in Fall 2009 or in Spring 2010.
#
### SQL:
#
# SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the ids for courses in the Fall of 2009 or the Spring of 2010?
#
### SQL:
#
# SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find courses that ran in Fall 2009 and in Spring 2010.
#
### SQL:
#
# SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the ids for courses that were offered in both Fall of 2009 and Spring of 2010?
#
### SQL:
#
# SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find courses that ran in Fall 2009 but not in Spring 2010.
#
### SQL:
#
# SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the ids of courses offered in Fall of 2009 but not in Spring of 2010?
#
### SQL:
#
# SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the salaries of all distinct instructors that are less than the largest salary.
#
### SQL:
#
# SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT max(salary) FROM instructor)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the distinct salaries of all instructors who earned less than the maximum salary?
#
### SQL:
#
# SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT max(salary) FROM instructor)
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the total number of instructors who teach a course in the Spring 2010 semester.
#
### SQL:
#
# SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# How many instructors teach a course in the Spring of 2010?
#
### SQL:
#
# SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names and average salaries of all departments whose average salary is greater than 42000.
#
### SQL:
#
# SELECT dept_name , AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary) > 42000
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names and average salaries for departments with average salary higher than 42000?
#
### SQL:
#
# SELECT dept_name , AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary) > 42000
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department.
#
### SQL:
#
# SELECT name FROM instructor WHERE salary > (SELECT min(salary) FROM instructor WHERE dept_name = 'Biology')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of instructors who earn more than at least one instructor from the Biology department?
#
### SQL:
#
# SELECT name FROM instructor WHERE salary > (SELECT min(salary) FROM instructor WHERE dept_name = 'Biology')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department.
#
### SQL:
#
# SELECT name FROM instructor WHERE salary > (SELECT max(salary) FROM instructor WHERE dept_name = 'Biology')
#
### End.
|
college_2
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# classroom ( building, room_number, capacity )
# department ( dept_name, building, budget )
# course ( course_id, title, dept_name, credits )
# instructor ( ID, name, dept_name, salary )
# section ( course_id, sec_id, semester, year, building, room_number, time_slot_id )
# teaches ( ID, course_id, sec_id, semester, year )
# student ( ID, name, dept_name, tot_cred )
# takes ( ID, course_id, sec_id, semester, year, grade )
# advisor ( s_ID, i_ID )
# time_slot ( time_slot_id, day, start_hr, start_min, end_hr, end_min )
# prereq ( course_id, prereq_id )
#
# course.dept_name can be joined with department.dept_name
# instructor.dept_name can be joined with department.dept_name
# section.building can be joined with classroom.building
# section.room_number can be joined with classroom.room_number
# section.course_id can be joined with course.course_id
# teaches.ID can be joined with instructor.ID
# teaches.course_id can be joined with section.course_id
# teaches.sec_id can be joined with section.sec_id
# teaches.semester can be joined with section.semester
# teaches.year can be joined with section.year
# student.dept_name can be joined with department.dept_name
# takes.ID can be joined with student.ID
# takes.course_id can be joined with section.course_id
# takes.sec_id can be joined with section.sec_id
# takes.semester can be joined with section.semester
# takes.year can be joined with section.year
# advisor.s_ID can be joined with student.ID
# advisor.i_ID can be joined with instructor.ID
# prereq.prereq_id can be joined with course.course_id
# prereq.course_id can be joined with course.course_id
#
### Question:
#
# What are the names of all instructors with a higher salary than any of the instructors in the Biology department?
#
### SQL:
#
# SELECT name FROM instructor WHERE salary > (SELECT max(salary) FROM instructor WHERE dept_name = 'Biology')
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# How many debates are there?
#
### SQL:
#
# SELECT count(*) FROM debate
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# List the venues of debates in ascending order of the number of audience.
#
### SQL:
#
# SELECT Venue FROM debate ORDER BY Num_of_Audience ASC
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# What are the date and venue of each debate?
#
### SQL:
#
# SELECT Date , Venue FROM debate
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# List the dates of debates with number of audience bigger than 150
#
### SQL:
#
# SELECT Date FROM debate WHERE Num_of_Audience > 150
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# Show the names of people aged either 35 or 36.
#
### SQL:
#
# SELECT Name FROM people WHERE Age = 35 OR Age = 36
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# What is the party of the youngest people?
#
### SQL:
#
# SELECT Party FROM people ORDER BY Age ASC LIMIT 1
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# Show different parties of people along with the number of people in each party.
#
### SQL:
#
# SELECT Party , COUNT(*) FROM people GROUP BY Party
#
### End.
|
debate
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# people ( People_ID, District, Name, Party, Age )
# debate ( Debate_ID, Date, Venue, Num_of_Audience )
# debate_people ( Debate_ID, Affirmative, Negative, If_Affirmative_Win )
#
# debate_people.Negative can be joined with people.People_ID
# debate_people.Affirmative can be joined with people.People_ID
# debate_people.Debate_ID can be joined with debate.Debate_ID
#
### Question:
#
# Show the party that has the most people.
#
### SQL:
#
# SELECT Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.