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