db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
---|---|
soccer_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Player_Attributes ( id, player_fifa_api_id, player_api_id, date, overall_rating, potential, preferred_foot, attacking_work_rate, defensive_work_rate, crossing, finishing, heading_accuracy, short_passing, volleys, dribbling, curve, free_kick_accuracy, long_passing, ball_control, acceleration, sprint_speed, agility, reactions, balance, shot_power, jumping, stamina, strength, long_shots, aggression, interceptions, positioning, vision, penalties, marking, standing_tackle, sliding_tackle, gk_diving, gk_handling, gk_kicking, gk_positioning, gk_reflexes )
# sqlite_sequence ( name, seq )
# Player ( id, player_api_id, player_name, player_fifa_api_id, birthday, height, weight )
# League ( id, country_id, name )
# Country ( id, name )
# Team ( id, team_api_id, team_fifa_api_id, team_long_name, team_short_name )
# Team_Attributes ( id, team_fifa_api_id, team_api_id, date, buildUpPlaySpeed, buildUpPlaySpeedClass, buildUpPlayDribbling, buildUpPlayDribblingClass, buildUpPlayPassing, buildUpPlayPassingClass, buildUpPlayPositioningClass, chanceCreationPassing, chanceCreationPassingClass, chanceCreationCrossing, chanceCreationCrossingClass, chanceCreationShooting, chanceCreationShootingClass, chanceCreationPositioningClass, defencePressure, defencePressureClass, defenceAggression, defenceAggressionClass, defenceTeamWidth, defenceTeamWidthClass, defenceDefenderLineClass )
#
# Player_Attributes.player_api_id can be joined with Player.player_api_id
# Player_Attributes.player_fifa_api_id can be joined with Player.player_fifa_api_id
# League.country_id can be joined with Country.id
# Team_Attributes.team_api_id can be joined with Team.team_api_id
# Team_Attributes.team_fifa_api_id can be joined with Team.team_fifa_api_id
#
### Question:
#
# List the names of all left-footed players who have overall rating between 85 and 90.
#
### SQL:
#
# SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = "left" AND T2.overall_rating >= 85 AND T2.overall_rating <= 90
#
### End.
|
soccer_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Player_Attributes ( id, player_fifa_api_id, player_api_id, date, overall_rating, potential, preferred_foot, attacking_work_rate, defensive_work_rate, crossing, finishing, heading_accuracy, short_passing, volleys, dribbling, curve, free_kick_accuracy, long_passing, ball_control, acceleration, sprint_speed, agility, reactions, balance, shot_power, jumping, stamina, strength, long_shots, aggression, interceptions, positioning, vision, penalties, marking, standing_tackle, sliding_tackle, gk_diving, gk_handling, gk_kicking, gk_positioning, gk_reflexes )
# sqlite_sequence ( name, seq )
# Player ( id, player_api_id, player_name, player_fifa_api_id, birthday, height, weight )
# League ( id, country_id, name )
# Country ( id, name )
# Team ( id, team_api_id, team_fifa_api_id, team_long_name, team_short_name )
# Team_Attributes ( id, team_fifa_api_id, team_api_id, date, buildUpPlaySpeed, buildUpPlaySpeedClass, buildUpPlayDribbling, buildUpPlayDribblingClass, buildUpPlayPassing, buildUpPlayPassingClass, buildUpPlayPositioningClass, chanceCreationPassing, chanceCreationPassingClass, chanceCreationCrossing, chanceCreationCrossingClass, chanceCreationShooting, chanceCreationShootingClass, chanceCreationPositioningClass, defencePressure, defencePressureClass, defenceAggression, defenceAggressionClass, defenceTeamWidth, defenceTeamWidthClass, defenceDefenderLineClass )
#
# Player_Attributes.player_api_id can be joined with Player.player_api_id
# Player_Attributes.player_fifa_api_id can be joined with Player.player_fifa_api_id
# League.country_id can be joined with Country.id
# Team_Attributes.team_api_id can be joined with Team.team_api_id
# Team_Attributes.team_fifa_api_id can be joined with Team.team_fifa_api_id
#
### Question:
#
# What is the average rating for right-footed players and left-footed players?
#
### SQL:
#
# SELECT preferred_foot , avg(overall_rating) FROM Player_Attributes GROUP BY preferred_foot
#
### End.
|
soccer_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Player_Attributes ( id, player_fifa_api_id, player_api_id, date, overall_rating, potential, preferred_foot, attacking_work_rate, defensive_work_rate, crossing, finishing, heading_accuracy, short_passing, volleys, dribbling, curve, free_kick_accuracy, long_passing, ball_control, acceleration, sprint_speed, agility, reactions, balance, shot_power, jumping, stamina, strength, long_shots, aggression, interceptions, positioning, vision, penalties, marking, standing_tackle, sliding_tackle, gk_diving, gk_handling, gk_kicking, gk_positioning, gk_reflexes )
# sqlite_sequence ( name, seq )
# Player ( id, player_api_id, player_name, player_fifa_api_id, birthday, height, weight )
# League ( id, country_id, name )
# Country ( id, name )
# Team ( id, team_api_id, team_fifa_api_id, team_long_name, team_short_name )
# Team_Attributes ( id, team_fifa_api_id, team_api_id, date, buildUpPlaySpeed, buildUpPlaySpeedClass, buildUpPlayDribbling, buildUpPlayDribblingClass, buildUpPlayPassing, buildUpPlayPassingClass, buildUpPlayPositioningClass, chanceCreationPassing, chanceCreationPassingClass, chanceCreationCrossing, chanceCreationCrossingClass, chanceCreationShooting, chanceCreationShootingClass, chanceCreationPositioningClass, defencePressure, defencePressureClass, defenceAggression, defenceAggressionClass, defenceTeamWidth, defenceTeamWidthClass, defenceDefenderLineClass )
#
# Player_Attributes.player_api_id can be joined with Player.player_api_id
# Player_Attributes.player_fifa_api_id can be joined with Player.player_fifa_api_id
# League.country_id can be joined with Country.id
# Team_Attributes.team_api_id can be joined with Team.team_api_id
# Team_Attributes.team_fifa_api_id can be joined with Team.team_fifa_api_id
#
### Question:
#
# Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
#
### SQL:
#
# SELECT preferred_foot , count(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot
#
### End.
|
soccer_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Player_Attributes ( id, player_fifa_api_id, player_api_id, date, overall_rating, potential, preferred_foot, attacking_work_rate, defensive_work_rate, crossing, finishing, heading_accuracy, short_passing, volleys, dribbling, curve, free_kick_accuracy, long_passing, ball_control, acceleration, sprint_speed, agility, reactions, balance, shot_power, jumping, stamina, strength, long_shots, aggression, interceptions, positioning, vision, penalties, marking, standing_tackle, sliding_tackle, gk_diving, gk_handling, gk_kicking, gk_positioning, gk_reflexes )
# sqlite_sequence ( name, seq )
# Player ( id, player_api_id, player_name, player_fifa_api_id, birthday, height, weight )
# League ( id, country_id, name )
# Country ( id, name )
# Team ( id, team_api_id, team_fifa_api_id, team_long_name, team_short_name )
# Team_Attributes ( id, team_fifa_api_id, team_api_id, date, buildUpPlaySpeed, buildUpPlaySpeedClass, buildUpPlayDribbling, buildUpPlayDribblingClass, buildUpPlayPassing, buildUpPlayPassingClass, buildUpPlayPositioningClass, chanceCreationPassing, chanceCreationPassingClass, chanceCreationCrossing, chanceCreationCrossingClass, chanceCreationShooting, chanceCreationShootingClass, chanceCreationPositioningClass, defencePressure, defencePressureClass, defenceAggression, defenceAggressionClass, defenceTeamWidth, defenceTeamWidthClass, defenceDefenderLineClass )
#
# Player_Attributes.player_api_id can be joined with Player.player_api_id
# Player_Attributes.player_fifa_api_id can be joined with Player.player_fifa_api_id
# League.country_id can be joined with Country.id
# Team_Attributes.team_api_id can be joined with Team.team_api_id
# Team_Attributes.team_fifa_api_id can be joined with Team.team_fifa_api_id
#
### Question:
#
# List all of the player ids with a height of at least 180cm and an overall rating higher than 85.
#
### SQL:
#
# SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85
#
### End.
|
soccer_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Player_Attributes ( id, player_fifa_api_id, player_api_id, date, overall_rating, potential, preferred_foot, attacking_work_rate, defensive_work_rate, crossing, finishing, heading_accuracy, short_passing, volleys, dribbling, curve, free_kick_accuracy, long_passing, ball_control, acceleration, sprint_speed, agility, reactions, balance, shot_power, jumping, stamina, strength, long_shots, aggression, interceptions, positioning, vision, penalties, marking, standing_tackle, sliding_tackle, gk_diving, gk_handling, gk_kicking, gk_positioning, gk_reflexes )
# sqlite_sequence ( name, seq )
# Player ( id, player_api_id, player_name, player_fifa_api_id, birthday, height, weight )
# League ( id, country_id, name )
# Country ( id, name )
# Team ( id, team_api_id, team_fifa_api_id, team_long_name, team_short_name )
# Team_Attributes ( id, team_fifa_api_id, team_api_id, date, buildUpPlaySpeed, buildUpPlaySpeedClass, buildUpPlayDribbling, buildUpPlayDribblingClass, buildUpPlayPassing, buildUpPlayPassingClass, buildUpPlayPositioningClass, chanceCreationPassing, chanceCreationPassingClass, chanceCreationCrossing, chanceCreationCrossingClass, chanceCreationShooting, chanceCreationShootingClass, chanceCreationPositioningClass, defencePressure, defencePressureClass, defenceAggression, defenceAggressionClass, defenceTeamWidth, defenceTeamWidthClass, defenceDefenderLineClass )
#
# Player_Attributes.player_api_id can be joined with Player.player_api_id
# Player_Attributes.player_fifa_api_id can be joined with Player.player_fifa_api_id
# League.country_id can be joined with Country.id
# Team_Attributes.team_api_id can be joined with Team.team_api_id
# Team_Attributes.team_fifa_api_id can be joined with Team.team_fifa_api_id
#
### Question:
#
# List all of the ids for left-footed players with a height between 180cm and 190cm.
#
### SQL:
#
# SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = "left"
#
### End.
|
soccer_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Player_Attributes ( id, player_fifa_api_id, player_api_id, date, overall_rating, potential, preferred_foot, attacking_work_rate, defensive_work_rate, crossing, finishing, heading_accuracy, short_passing, volleys, dribbling, curve, free_kick_accuracy, long_passing, ball_control, acceleration, sprint_speed, agility, reactions, balance, shot_power, jumping, stamina, strength, long_shots, aggression, interceptions, positioning, vision, penalties, marking, standing_tackle, sliding_tackle, gk_diving, gk_handling, gk_kicking, gk_positioning, gk_reflexes )
# sqlite_sequence ( name, seq )
# Player ( id, player_api_id, player_name, player_fifa_api_id, birthday, height, weight )
# League ( id, country_id, name )
# Country ( id, name )
# Team ( id, team_api_id, team_fifa_api_id, team_long_name, team_short_name )
# Team_Attributes ( id, team_fifa_api_id, team_api_id, date, buildUpPlaySpeed, buildUpPlaySpeedClass, buildUpPlayDribbling, buildUpPlayDribblingClass, buildUpPlayPassing, buildUpPlayPassingClass, buildUpPlayPositioningClass, chanceCreationPassing, chanceCreationPassingClass, chanceCreationCrossing, chanceCreationCrossingClass, chanceCreationShooting, chanceCreationShootingClass, chanceCreationPositioningClass, defencePressure, defencePressureClass, defenceAggression, defenceAggressionClass, defenceTeamWidth, defenceTeamWidthClass, defenceDefenderLineClass )
#
# Player_Attributes.player_api_id can be joined with Player.player_api_id
# Player_Attributes.player_fifa_api_id can be joined with Player.player_fifa_api_id
# League.country_id can be joined with Country.id
# Team_Attributes.team_api_id can be joined with Team.team_api_id
# Team_Attributes.team_fifa_api_id can be joined with Team.team_fifa_api_id
#
### Question:
#
# Who are the top 3 players in terms of overall rating?
#
### SQL:
#
# SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3
#
### End.
|
soccer_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Player_Attributes ( id, player_fifa_api_id, player_api_id, date, overall_rating, potential, preferred_foot, attacking_work_rate, defensive_work_rate, crossing, finishing, heading_accuracy, short_passing, volleys, dribbling, curve, free_kick_accuracy, long_passing, ball_control, acceleration, sprint_speed, agility, reactions, balance, shot_power, jumping, stamina, strength, long_shots, aggression, interceptions, positioning, vision, penalties, marking, standing_tackle, sliding_tackle, gk_diving, gk_handling, gk_kicking, gk_positioning, gk_reflexes )
# sqlite_sequence ( name, seq )
# Player ( id, player_api_id, player_name, player_fifa_api_id, birthday, height, weight )
# League ( id, country_id, name )
# Country ( id, name )
# Team ( id, team_api_id, team_fifa_api_id, team_long_name, team_short_name )
# Team_Attributes ( id, team_fifa_api_id, team_api_id, date, buildUpPlaySpeed, buildUpPlaySpeedClass, buildUpPlayDribbling, buildUpPlayDribblingClass, buildUpPlayPassing, buildUpPlayPassingClass, buildUpPlayPositioningClass, chanceCreationPassing, chanceCreationPassingClass, chanceCreationCrossing, chanceCreationCrossingClass, chanceCreationShooting, chanceCreationShootingClass, chanceCreationPositioningClass, defencePressure, defencePressureClass, defenceAggression, defenceAggressionClass, defenceTeamWidth, defenceTeamWidthClass, defenceDefenderLineClass )
#
# Player_Attributes.player_api_id can be joined with Player.player_api_id
# Player_Attributes.player_fifa_api_id can be joined with Player.player_fifa_api_id
# League.country_id can be joined with Country.id
# Team_Attributes.team_api_id can be joined with Team.team_api_id
# Team_Attributes.team_fifa_api_id can be joined with Team.team_fifa_api_id
#
### Question:
#
# List the names and birthdays of the top five players in terms of potential.
#
### SQL:
#
# SELECT DISTINCT T1.player_name , T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# How many performances are there?
#
### SQL:
#
# SELECT count(*) FROM performance
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# List the hosts of performances in ascending order of attendance.
#
### SQL:
#
# SELECT HOST FROM performance ORDER BY Attendance ASC
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# What are the dates and locations of performances?
#
### SQL:
#
# SELECT Date , LOCATION FROM performance
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the attendances of the performances at location "TD Garden" or "Bell Centre"
#
### SQL:
#
# SELECT Attendance FROM performance WHERE LOCATION = "TD Garden" OR LOCATION = "Bell Centre"
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# What is the average number of attendees for performances?
#
### SQL:
#
# SELECT avg(Attendance) FROM performance
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# What is the date of the performance with the highest number of attendees?
#
### SQL:
#
# SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show different locations and the number of performances at each location.
#
### SQL:
#
# SELECT LOCATION , COUNT(*) FROM performance GROUP BY LOCATION
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the most common location of performances.
#
### SQL:
#
# SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the locations that have at least two performances.
#
### SQL:
#
# SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the locations that have both performances with more than 2000 attendees and performances with less than 1000 attendees.
#
### SQL:
#
# SELECT LOCATION FROM performance WHERE Attendance > 2000 INTERSECT SELECT LOCATION FROM performance WHERE Attendance < 1000
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the names of members and the location of the performances they attended.
#
### SQL:
#
# SELECT T2.Name , T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the names of members and the location of performances they attended in ascending alphabetical order of their names.
#
### SQL:
#
# SELECT T2.Name , T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T2.Name ASC
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the dates of performances with attending members whose roles are "Violin".
#
### SQL:
#
# SELECT T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin"
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# Show the names of members and the dates of performances they attended in descending order of attendance of the performances.
#
### SQL:
#
# SELECT T2.Name , T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T3.Attendance DESC
#
### End.
|
performance_attendance
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# member ( Member_ID, Name, Nationality, Role )
# performance ( Performance_ID, Date, Host, Location, Attendance )
# member_attendance ( Member_ID, Performance_ID, Num_of_Pieces )
#
# member_attendance.Performance_ID can be joined with performance.Performance_ID
# member_attendance.Member_ID can be joined with member.Member_ID
#
### Question:
#
# List the names of members who did not attend any performance.
#
### SQL:
#
# SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM member_attendance)
#
### 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 buildings which have rooms with capacity more than 50.
#
### SQL:
#
# SELECT DISTINCT building FROM classroom WHERE capacity > 50
#
### 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 buildings with capacities of greater than 50?
#
### SQL:
#
# SELECT DISTINCT building FROM classroom WHERE capacity > 50
#
### 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:
#
# Count the number of rooms that are not in the Lamberton building.
#
### SQL:
#
# SELECT count(*) FROM classroom WHERE building != 'Lamberton'
#
### 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 classrooms are not in Lamberton?
#
### SQL:
#
# SELECT count(*) FROM classroom WHERE building != 'Lamberton'
#
### 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 and building of the departments whose budget is more than the average budget?
#
### SQL:
#
# SELECT dept_name , building FROM department WHERE budget > (SELECT avg(budget) FROM department)
#
### 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 name and building of the departments with greater than average budget.
#
### SQL:
#
# SELECT dept_name , building FROM department WHERE budget > (SELECT avg(budget) FROM department)
#
### 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 room number of the rooms which can sit 50 to 100 students and their buildings.
#
### SQL:
#
# SELECT building , room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
#
### 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 room numbers and corresponding buildings for classrooms which can seat between 50 to 100 students?
#
### SQL:
#
# SELECT building , room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
#
### 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 building of the department with the highest budget.
#
### SQL:
#
# SELECT dept_name , building FROM department ORDER BY 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 department name and corresponding building for the department with the greatest budget?
#
### SQL:
#
# SELECT dept_name , building FROM department ORDER BY 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 name of the student who has the highest total credits in the History department.
#
### SQL:
#
# SELECT name FROM student WHERE dept_name = 'History' ORDER BY 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:
#
# Give the name of the student in the History department with the most credits.
#
### SQL:
#
# SELECT name FROM student WHERE dept_name = 'History' ORDER BY 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:
#
# How many rooms does the Lamberton building have?
#
### SQL:
#
# SELECT count(*) FROM classroom WHERE building = 'Lamberton'
#
### 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:
#
# Count the number of classrooms in Lamberton.
#
### SQL:
#
# SELECT count(*) FROM classroom WHERE building = 'Lamberton'
#
### 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 have advisors?
#
### SQL:
#
# SELECT count(DISTINCT s_id) FROM advisor
#
### 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:
#
# Count the number of students who have advisors.
#
### SQL:
#
# SELECT count(DISTINCT s_id) FROM advisor
#
### 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 departments offer courses?
#
### SQL:
#
# SELECT count(DISTINCT dept_name) FROM course
#
### 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:
#
# Count the number of departments which offer courses.
#
### SQL:
#
# SELECT count(DISTINCT dept_name) FROM course
#
### 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 different courses offered by Physics department?
#
### SQL:
#
# SELECT count(DISTINCT course_id) FROM course 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:
#
# Count the number of courses in the Physics department.
#
### SQL:
#
# SELECT count(DISTINCT course_id) FROM course 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 title of courses that have two prerequisites?
#
### SQL:
#
# SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) = 2
#
### 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 titles for courses with two prerequisites?
#
### SQL:
#
# SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) = 2
#
### 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, credit, and department name of courses that have more than one prerequisites?
#
### SQL:
#
# SELECT T1.title , T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) > 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, credit value, and department name for courses with more than one prerequisite?
#
### SQL:
#
# SELECT T1.title , T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING count(*) > 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 courses that do not have prerequisite?
#
### SQL:
#
# SELECT count(*) 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:
#
# Count the number of courses without prerequisites.
#
### SQL:
#
# SELECT count(*) 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:
#
# 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 titles 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:
#
# How many different instructors have taught some course?
#
### SQL:
#
# SELECT COUNT (DISTINCT 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:
#
# Count the number of distinct instructors who have taught a course.
#
### SQL:
#
# SELECT COUNT (DISTINCT 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 total budgets of the Marketing or Finance department.
#
### SQL:
#
# SELECT sum(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = '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 is the sum of budgets of the Marketing and Finance departments?
#
### SQL:
#
# SELECT sum(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = '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 department name of the instructor whose name contains 'Soisalon'.
#
### SQL:
#
# SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
#
### 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 department with an instructure who has a name like 'Soisalon'?
#
### SQL:
#
# SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
#
### 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 rooms whose capacity is less than 50 does the Lamberton building have?
#
### SQL:
#
# SELECT count(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50
#
### 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:
#
# Count the number of rooms in Lamberton with capacity lower than 50.
#
### SQL:
#
# SELECT count(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50
#
### 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 budget of departments whose budgets are more than the average budget.
#
### SQL:
#
# SELECT dept_name , budget FROM department WHERE budget > (SELECT avg(budget) FROM department)
#
### 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 budgets of departments with budgets greater than the average?
#
### SQL:
#
# SELECT dept_name , budget FROM department WHERE budget > (SELECT avg(budget) FROM department)
#
### 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 is in Statistics department and earns the lowest salary?
#
### SQL:
#
# SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary 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:
#
# Give the name of the lowest earning instructor in the Statistics department.
#
### SQL:
#
# SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary 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 title of course that is provided by both Statistics and Psychology departments.
#
### SQL:
#
# SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'
#
### 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 a course that is listed in both the Statistics and Psychology departments?
#
### SQL:
#
# SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'
#
### 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 that is provided by Statistics but not Psychology departments.
#
### SQL:
#
# SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'
#
### 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 titles of courses that are in the Statistics department but not the Psychology department?
#
### SQL:
#
# SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'
#
### 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 taught a class in Fall 2009 but not in Spring 2010.
#
### SQL:
#
# SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT 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:
#
# What are the ids of instructors who taught in the Fall of 2009 but not in the Spring of 2010?
#
### SQL:
#
# SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT 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 name of students who took any class in the years of 2009 and 2010.
#
### SQL:
#
# SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR 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 names of the students who took classes in 2009 or 2010?
#
### SQL:
#
# SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR 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 of the top 3 departments that provide the largest amount of courses?
#
### SQL:
#
# SELECT dept_name FROM course GROUP BY dept_name ORDER BY count(*) DESC LIMIT 3
#
### 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 3 departments with the most courses?
#
### SQL:
#
# SELECT dept_name FROM course GROUP BY dept_name ORDER BY count(*) DESC LIMIT 3
#
### 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 that offers the highest total credits?
#
### SQL:
#
# SELECT dept_name FROM course GROUP BY dept_name ORDER BY sum(credits) 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 department with the most credits?
#
### SQL:
#
# SELECT dept_name FROM course GROUP BY dept_name ORDER BY sum(credits) 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:
#
# List the names of all courses ordered by their titles and credits.
#
### SQL:
#
# SELECT title FROM course ORDER BY title , credits
#
### 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:
#
# Given the titles of all courses, in order of titles and credits.
#
### SQL:
#
# SELECT title FROM course ORDER BY title , credits
#
### 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 lowest budget?
#
### SQL:
#
# SELECT dept_name FROM department ORDER BY budget 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:
#
# Give the name of the department with the lowest budget.
#
### SQL:
#
# SELECT dept_name FROM department ORDER BY budget 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:
#
# List the names and buildings of all departments sorted by the budget from large to small.
#
### SQL:
#
# SELECT dept_name , building FROM department ORDER BY budget DESC
#
### 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 buildings of the deparments, sorted by budget descending?
#
### SQL:
#
# SELECT dept_name , building FROM department ORDER BY budget DESC
#
### 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:
#
# Who is the instructor with the highest salary?
#
### SQL:
#
# SELECT name FROM instructor ORDER BY 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:
#
# Give the name of the highest paid instructor.
#
### SQL:
#
# SELECT name FROM instructor ORDER BY 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:
#
# List the information of all instructors ordered by their salary in ascending order.
#
### SQL:
#
# SELECT * FROM instructor ORDER BY salary
#
### 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 all information regarding instructors, in order of salary from least to greatest.
#
### SQL:
#
# SELECT * FROM instructor ORDER BY salary
#
### 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 students and their department names sorted by their total credits in ascending order.
#
### SQL:
#
# SELECT name , dept_name FROM student ORDER BY 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 students and their respective departments, ordered by number of credits from least to greatest?
#
### SQL:
#
# SELECT name , dept_name FROM student ORDER BY 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:
#
# list in alphabetic order all course names and their instructors' names in year 2008.
#
### SQL:
#
# SELECT T1.title , T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 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:
#
# Show all titles and their instructors' names for courses in 2008, in alphabetical order by title.
#
### SQL:
#
# SELECT T1.title , T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 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 name of instructors who are advising more than one student.
#
### SQL:
#
# SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING count(*) > 1
#
### 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 advise more than one student?
#
### SQL:
#
# SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING count(*) > 1
#
### 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 students who have more than one advisor?
#
### SQL:
#
# SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING count(*) > 1
#
### 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 more than one advisor?
#
### SQL:
#
# SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING count(*) > 1
#
### 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 rooms with more than 50 capacity for each building.
#
### SQL:
#
# SELECT count(*) , building FROM classroom WHERE capacity > 50 GROUP BY building
#
### 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 rooms in each building have a capacity of over 50?
#
### SQL:
#
# SELECT count(*) , building FROM classroom WHERE capacity > 50 GROUP BY building
#
### 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 maximum and average capacity among rooms in each building.
#
### SQL:
#
# SELECT max(capacity) , avg(capacity) , building FROM classroom GROUP BY building
#
### 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 greatest and average capacity for rooms in each building?
#
### SQL:
#
# SELECT max(capacity) , avg(capacity) , building FROM classroom GROUP BY building
#
### 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 the course that is offered by more than one department.
#
### SQL:
#
# SELECT title FROM course GROUP BY title HAVING count(*) > 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 are the titles of courses that are offered in more than one department?
#
### SQL:
#
# SELECT title FROM course GROUP BY title HAVING count(*) > 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 credits of courses provided by different department.
#
### SQL:
#
# SELECT sum(credits) , dept_name FROM course 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 total credits are offered by each department?
#
### SQL:
#
# SELECT sum(credits) , dept_name FROM course GROUP BY dept_name
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.