Question:
What is the duration, file size, and song format for every pop song, ordered by title alphabetically?
Additional table information: table: music_1

Answer: SELECT T1.duration, T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = 'pop' ORDER BY T2.song_name NULLS FIRST


Question:
Find the names of the artists who have produced English songs but have never received rating higher than 8.
Additional table information: table: music_1

Answer: SELECT DISTINCT artist_name FROM song WHERE languages = 'english' EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8


Question:
What are the names of the different artists that have produced a song in English but have never receieved a rating higher than 8?
Additional table information: table: music_1

Answer: SELECT DISTINCT artist_name FROM song WHERE languages = 'english' EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8


Question:
Find the names of the artists who are from Bangladesh and have never received rating higher than 7.
Additional table information: table: music_1

Answer: SELECT DISTINCT artist_name FROM artist WHERE country = 'Bangladesh' EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7


Question:
What are the names of the different artists from Bangladesh who never received a rating higher than a 7?
Additional table information: table: music_1

Answer: SELECT DISTINCT artist_name FROM artist WHERE country = 'Bangladesh' EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7


Question:
what is the full name and id of the college with the largest number of baseball players?
Additional table information: table: baseball_1

Answer: SELECT T1.name_full, T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the full name and id of the college that has the most baseball players.
Additional table information: table: baseball_1

Answer: SELECT T1.name_full, T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is average salary of the players in the team named 'Boston Red Stockings' ?
Additional table information: table: baseball_1

Answer: SELECT AVG(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'


Question:
Compute the average salary of the players in the team called 'Boston Red Stockings'.
Additional table information: table: baseball_1

Answer: SELECT AVG(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'


Question:
What are first and last names of players participating in all star game in 1998?
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE YEAR = 1998


Question:
List the first and last name for players who participated in all star game in 1998.
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE YEAR = 1998


Question:
What are the first name, last name and id of the player with the most all star game experiences? Also list the count.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T1.player_id, COUNT(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which player has the most all star game experiences? Give me the first name, last name and id of the player, as well as the number of times the player participated in all star game.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T1.player_id, COUNT(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many players enter hall of fame each year?
Additional table information: table: baseball_1

Answer: SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid


Question:
Count the number of players who enter hall of fame for each year.
Additional table information: table: baseball_1

Answer: SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid


Question:
What is the average number of attendance at home games for each year?
Additional table information: table: baseball_1

Answer: SELECT YEAR, AVG(attendance) FROM home_game GROUP BY YEAR


Question:
For each year, return the year and the average number of attendance at home games.
Additional table information: table: baseball_1

Answer: SELECT YEAR, AVG(attendance) FROM home_game GROUP BY YEAR


Question:
In 2014, what are the id and rank of the team that has the largest average number of attendance?
Additional table information: table: baseball_1

Answer: SELECT T2.team_id, T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY AVG(T1.attendance) DESC LIMIT 1


Question:
Find the id and rank of the team that has the highest average attendance rate in 2014.
Additional table information: table: baseball_1

Answer: SELECT T2.team_id, T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY AVG(T1.attendance) DESC LIMIT 1


Question:
What are the manager's first name, last name and id who won the most manager award?
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which manager won the most manager award? Give me the manager's first name, last name and id.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many parks are there in the state of NY?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM park WHERE state = 'NY'


Question:
Show me the number of parks the state of NY has.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM park WHERE state = 'NY'


Question:
Which 3 players won the most player awards? List their full name and id.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC LIMIT 3


Question:
Find the first name, last name and id for the top three players won the most player awards.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC LIMIT 3


Question:
List three countries which are the origins of the least players.
Additional table information: table: baseball_1

Answer: SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 3


Question:
What are the three countries that the least players are from?
Additional table information: table: baseball_1

Answer: SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 3


Question:
Find all the players' first name and last name who have empty death record.
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player WHERE death_year = ''


Question:
What are the first name and last name of the players whose death record is empty?
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player WHERE death_year = ''


Question:
How many players born in USA are right-handed batters? That is, have the batter value 'R'.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM player WHERE birth_country = 'USA' AND bats = 'R'


Question:
Count the number of players who were born in USA and have bats information 'R'.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM player WHERE birth_country = 'USA' AND bats = 'R'


Question:
What is the average height of the players from the college named 'Yale University'?
Additional table information: table: baseball_1

Answer: SELECT AVG(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University'


Question:
Find the average height of the players who belong to the college called 'Yale University'.
Additional table information: table: baseball_1

Answer: SELECT AVG(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University'


Question:
What is the highest salary among each team? List the team name, id and maximum salary.
Additional table information: table: baseball_1

Answer: SELECT T1.name, T1.team_id, MAX(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id


Question:
For each team, return the team name, id and the maximum salary among the team.
Additional table information: table: baseball_1

Answer: SELECT T1.name, T1.team_id, MAX(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id


Question:
What are the name and id of the team offering the lowest average salary?
Additional table information: table: baseball_1

Answer: SELECT T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY AVG(T2.salary) ASC NULLS FIRST LIMIT 1


Question:
Which team offers the lowest average salary? Give me the name and id of the team.
Additional table information: table: baseball_1

Answer: SELECT T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY AVG(T2.salary) ASC NULLS FIRST LIMIT 1


Question:
Find the players' first name and last name who won award both in 1960 and in 1961.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1961


Question:
Which players won awards in both 1960 and 1961? Return their first names and last names.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1961


Question:
List players' first name and last name who have weight greater than 220 or height shorter than 75.
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75


Question:
What are the first name and last name of the players who have weight above 220 or height below 75?
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75


Question:
List the maximum scores of the team Boston Red Stockings when the team won in postseason?
Additional table information: table: baseball_1

Answer: SELECT MAX(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'


Question:
What are the maximum scores the team Boston Red Stockings got when the team won in postseason?
Additional table information: table: baseball_1

Answer: SELECT MAX(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'


Question:
How many times did Boston Red Stockings lose in 2009 postseason?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009


Question:
Count the number of times the team 'Boston Red Stockings' lost in 2009 postseason.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009


Question:
What are the name and id of the team with the most victories in 2008 postseason?
Additional table information: table: baseball_1

Answer: SELECT T2.name, T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name and id of the team that won the most times in 2008 postseason.
Additional table information: table: baseball_1

Answer: SELECT T2.name, T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the number of wins the team Boston Red Stockings got in the postseasons each year in history?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*), T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year


Question:
For each year, return the year and the number of times the team Boston Red Stockings won in the postseasons.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*), T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year


Question:
What is the total number of postseason games that team Boston Red Stockings participated in?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM (SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings')


Question:
How many times in total did the team Boston Red Stockings participate in postseason games?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM (SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings')


Question:
How many games in 1885 postseason resulted in ties (that is, the value of 'ties' is '1')?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM postseason WHERE YEAR = 1885 AND ties = 1


Question:
Find the number of tied games (the value of 'ties' is '1') in 1885 postseason.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM postseason WHERE YEAR = 1885 AND ties = 1


Question:
What is the total salary paid by team Boston Red Stockings in 2010?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010


Question:
What is the total salary expenses of team Boston Red Stockings in 2010?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010


Question:
How many players were in the team Boston Red Stockings in 2000?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000


Question:
How many players did Boston Red Stockings have in 2000?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000


Question:
List the 3 highest salaries of the players in 2001?
Additional table information: table: baseball_1

Answer: SELECT salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC LIMIT 3


Question:
How much salary did the top 3 well-paid players get in 2001?
Additional table information: table: baseball_1

Answer: SELECT salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC LIMIT 3


Question:
What were all the salary values of players in 2010 and 2001?
Additional table information: table: baseball_1

Answer: SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001


Question:
List all the salary values players received in 2010 and 2001.
Additional table information: table: baseball_1

Answer: SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001


Question:
In which year did the least people enter hall of fame?
Additional table information: table: baseball_1

Answer: SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Find the year in which the least people enter hall of fame.
Additional table information: table: baseball_1

Answer: SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
How many parks are there in Atlanta city?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM park WHERE city = 'Atlanta'


Question:
How many parks does Atlanta city have?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM park WHERE city = 'Atlanta'


Question:
How many games were played in park 'Columbia Park' in 1907?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park'


Question:
Count the number of games taken place in park 'Columbia Park' in 1907.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park'


Question:
How many games were played in city Atlanta in 2000?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta'


Question:
Find the number of games taken place in city Atlanta in 2000.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta'


Question:
What is the total home game attendance of team Boston Red Stockings from 2000 to 2010?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.attendance) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 2000 AND 2010


Question:
How many games in total did team Boston Red Stockings attend from 2000 to 2010?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.attendance) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 2000 AND 2010


Question:
How much did the the player with first name Len and last name Barker earn between 1985 to 1990 in total?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990


Question:
Compute the total salary that the player with first name Len and last name Barker received between 1985 to 1990.
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990


Question:
List players' first name and last name who received salary from team Washington Nationals in both 2005 and 2007.
Additional table information: table: baseball_1

Answer: SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'


Question:
What are the first name and last name of the players who were paid salary by team Washington Nationals in both 2005 and 2007?
Additional table information: table: baseball_1

Answer: SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'


Question:
How many home games did the team Boston Red Stockings play from 1990 to 2000 in total?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000


Question:
Count the total number of games the team Boston Red Stockings attended from 1990 to 2000.
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000


Question:
Which team had the least number of attendances in home games in 1980?
Additional table information: table: baseball_1

Answer: SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC NULLS FIRST LIMIT 1


Question:
Find the team that attended the least number of home games in 1980.
Additional table information: table: baseball_1

Answer: SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC NULLS FIRST LIMIT 1


Question:
List the names of states that have more than 2 parks.
Additional table information: table: baseball_1

Answer: SELECT state FROM park GROUP BY state HAVING COUNT(*) > 2


Question:
Which states have more than 2 parks?
Additional table information: table: baseball_1

Answer: SELECT state FROM park GROUP BY state HAVING COUNT(*) > 2


Question:
How many team franchises are active, with active value 'Y'?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM team_franchise WHERE active = 'Y'


Question:
Find the number of team franchises that are active (have 'Y' as 'active' information).
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM team_franchise WHERE active = 'Y'


Question:
Which cities have 2 to 4 parks?
Additional table information: table: baseball_1

Answer: SELECT city FROM park GROUP BY city HAVING COUNT(*) BETWEEN 2 AND 4


Question:
Find all the cities that have 2 to 4 parks.
Additional table information: table: baseball_1

Answer: SELECT city FROM park GROUP BY city HAVING COUNT(*) BETWEEN 2 AND 4


Question:
Which park had most attendances in 2008?
Additional table information: table: baseball_1

Answer: SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1


Question:
Which park did the most people attend in 2008?
Additional table information: table: baseball_1

Answer: SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1


Question:
How many camera lenses have a focal length longer than 15 mm?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(*) FROM camera_lens WHERE focal_length_mm > 15


Question:
Find the brand and name for each camera lens, and sort in descending order of maximum aperture.
Additional table information: table: mountain_photos

Answer: SELECT brand, name FROM camera_lens ORDER BY max_aperture DESC


Question:
List the id, color scheme, and name for all the photos.
Additional table information: table: mountain_photos

Answer: SELECT id, color, name FROM photos


Question:
What are the maximum and average height of the mountains?
Additional table information: table: mountain_photos

Answer: SELECT MAX(height), AVG(height) FROM mountain


Question:
What are the average prominence of the mountains in country 'Morocco'?
Additional table information: table: mountain_photos

Answer: SELECT AVG(prominence) FROM mountain WHERE country = 'Morocco'


Question:
What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'?
Additional table information: table: mountain_photos

Answer: SELECT name, height, prominence FROM mountain WHERE range <> 'Aberdare Range'


Question:
What are the id and name of the photos for mountains?
Additional table information: table: mountain_photos

Answer: SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000


Question:
What are the id and name of the mountains that have at least 2 photos?
Additional table information: table: mountain_photos

Answer: SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING COUNT(*) >= 2


Question:
What are the names of the cameras that have taken picture of the most mountains?
Additional table information: table: mountain_photos

Answer: SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'?
Additional table information: table: mountain_photos

Answer: SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'


Question:
How many different kinds of lens brands are there?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(DISTINCT brand) FROM camera_lens


Question:
How many camera lenses are not used in taking any photos?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(*) FROM camera_lens WHERE NOT id IN (SELECT camera_lens_id FROM photos)


Question:
How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'


Question:
List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif'
Additional table information: table: mountain_photos

Answer: SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif'


Question:
Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.
Additional table information: table: mountain_photos

Answer: SELECT name, prominence FROM mountain EXCEPT SELECT T1.name, T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'


Question:
List the camera lens names containing substring 'Digital'.
Additional table information: table: mountain_photos

Answer: SELECT name FROM camera_lens WHERE name LIKE '%Digital%'


Question:
What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.
Additional table information: table: mountain_photos

Answer: SELECT T1.name, COUNT(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id ORDER BY COUNT(*) NULLS FIRST


Question:
Find the names of channels that are not owned by CCTV.
Additional table information: table: program_share

Answer: SELECT name FROM channel WHERE OWNER <> 'CCTV'


Question:
Which channels are not owned by CCTV? Give me the channel names.
Additional table information: table: program_share

Answer: SELECT name FROM channel WHERE OWNER <> 'CCTV'


Question:
List all channel names ordered by their rating in percent from big to small.
Additional table information: table: program_share

Answer: SELECT name FROM channel ORDER BY rating_in_percent DESC


Question:
Give me a list of all the channel names sorted by the channel rating in descending order.
Additional table information: table: program_share

Answer: SELECT name FROM channel ORDER BY rating_in_percent DESC


Question:
What is the owner of the channel that has the highest rating ratio?
Additional table information: table: program_share

Answer: SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1


Question:
Show me the owner of the channel with the highest rating.
Additional table information: table: program_share

Answer: SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1


Question:
how many programs are there?
Additional table information: table: program_share

Answer: SELECT COUNT(*) FROM program


Question:
Count the number of programs.
Additional table information: table: program_share

Answer: SELECT COUNT(*) FROM program


Question:
list all the names of programs, ordering by launch time.
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch NULLS FIRST


Question:
What is the list of program names, sorted by the order of launch date?
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch NULLS FIRST


Question:
List the name, origin and owner of each program.
Additional table information: table: program_share

Answer: SELECT name, origin, OWNER FROM program


Question:
What are the name, origin and owner of each program?
Additional table information: table: program_share

Answer: SELECT name, origin, OWNER FROM program


Question:
find the name of the program that was launched most recently.
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch DESC LIMIT 1


Question:
Which program was launched most recently? Return the program name.
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch DESC LIMIT 1


Question:
find the total percentage share of all channels owned by CCTV.
Additional table information: table: program_share

Answer: SELECT SUM(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'


Question:
What is the total share (in percent) of all the channels owned by CCTV?
Additional table information: table: program_share

Answer: SELECT SUM(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'


Question:
Find the names of the channels that are broadcast in the morning.
Additional table information: table: program_share

Answer: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'


Question:
Which channels are broadcast in the morning? Give me the channel names.
Additional table information: table: program_share

Answer: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'


Question:
what are the names of the channels that broadcast in both morning and night?
Additional table information: table: program_share

Answer: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'


Question:
Which channels broadcast both in the morning and at night? Give me the channel names.
Additional table information: table: program_share

Answer: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'


Question:
how many programs are broadcast in each time section of the day?
Additional table information: table: program_share

Answer: SELECT COUNT(*), time_of_day FROM broadcast GROUP BY time_of_day


Question:
Count the number of programs broadcast for each time section of a day.
Additional table information: table: program_share

Answer: SELECT COUNT(*), time_of_day FROM broadcast GROUP BY time_of_day


Question:
find the number of different programs that are broadcast during night time.
Additional table information: table: program_share

Answer: SELECT COUNT(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'


Question:
How many distinct programs are broadcast at 'Night' time?
Additional table information: table: program_share

Answer: SELECT COUNT(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'


Question:
Find the names of programs that are never broadcasted in the morning.
Additional table information: table: program_share

Answer: SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Morning'


Question:
Which programs are never broadcasted in the morning? Give me the names of the programs.
Additional table information: table: program_share

Answer: SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Morning'


Question:
find the program owners that have some programs in both morning and night time.
Additional table information: table: program_share

Answer: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Morning' INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Night'


Question:
Who are the owners of the programs that broadcast both in the morning and at night?
Additional table information: table: program_share

Answer: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Morning' INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Night'


Question:
List all program origins in the alphabetical order.
Additional table information: table: program_share

Answer: SELECT origin FROM program ORDER BY origin NULLS FIRST


Question:
What is the list of program origins ordered alphabetically?
Additional table information: table: program_share

Answer: SELECT origin FROM program ORDER BY origin NULLS FIRST


Question:
what is the number of different channel owners?
Additional table information: table: program_share

Answer: SELECT COUNT(DISTINCT OWNER) FROM channel


Question:
Count the number of distinct channel owners.
Additional table information: table: program_share

Answer: SELECT COUNT(DISTINCT OWNER) FROM channel


Question:
find the names of programs whose origin is not in Beijing.
Additional table information: table: program_share

Answer: SELECT name FROM program WHERE origin <> 'Beijing'


Question:
Which programs' origins are not 'Beijing'? Give me the program names.
Additional table information: table: program_share

Answer: SELECT name FROM program WHERE origin <> 'Beijing'


Question:
What are the names of the channels owned by CCTV or HBS?
Additional table information: table: program_share

Answer: SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'


Question:
List the names of all the channels owned by either CCTV or HBS
Additional table information: table: program_share

Answer: SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'


Question:
Find the total rating ratio for each channel owner.
Additional table information: table: program_share

Answer: SELECT SUM(Rating_in_percent), OWNER FROM channel GROUP BY OWNER


Question:
What is the total rating of channel for each channel owner?
Additional table information: table: program_share

Answer: SELECT SUM(Rating_in_percent), OWNER FROM channel GROUP BY OWNER


Question:
Find the name of the program that is broadcast most frequently.
Additional table information: table: program_share

Answer: SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which program is broadcast most frequently? Give me the program name.
Additional table information: table: program_share

Answer: SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many courses are there in total?
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM COURSES


Question:
Find the total number of courses offered.
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM COURSES


Question:
What are the descriptions of the courses with name 'database'?
Additional table information: table: e_learning

Answer: SELECT course_description FROM COURSES WHERE course_name = 'database'


Question:
Return the description for the courses named 'database'.
Additional table information: table: e_learning

Answer: SELECT course_description FROM COURSES WHERE course_name = 'database'


Question:
What are the addresses of the course authors or tutors with personal name 'Cathrine'
Additional table information: table: e_learning

Answer: SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = 'Cathrine'


Question:
Return the addresses of the course authors or tutors whose personal name is 'Cathrine'.
Additional table information: table: e_learning

Answer: SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = 'Cathrine'


Question:
List the addresses of all the course authors or tutors.
Additional table information: table: e_learning

Answer: SELECT address_line_1 FROM Course_Authors_and_Tutors


Question:
What is the address of each course author or tutor?
Additional table information: table: e_learning

Answer: SELECT address_line_1 FROM Course_Authors_and_Tutors


Question:
List all the login names and family names of course author and tutors.
Additional table information: table: e_learning

Answer: SELECT login_name, family_name FROM Course_Authors_and_Tutors


Question:
What are the login names and family names of course author and tutors?
Additional table information: table: e_learning

Answer: SELECT login_name, family_name FROM Course_Authors_and_Tutors


Question:
List all the dates of enrollment and completion of students.
Additional table information: table: e_learning

Answer: SELECT date_of_enrolment, date_of_completion FROM Student_Course_Enrolment


Question:
What are all the dates of enrollment and completion in record?
Additional table information: table: e_learning

Answer: SELECT date_of_enrolment, date_of_completion FROM Student_Course_Enrolment


Question:
How many distinct students are enrolled in courses?
Additional table information: table: e_learning

Answer: SELECT COUNT(DISTINCT student_id) FROM Student_Course_Enrolment


Question:
Find the number of distinct students enrolled in courses.
Additional table information: table: e_learning

Answer: SELECT COUNT(DISTINCT student_id) FROM Student_Course_Enrolment


Question:
How many distinct courses are enrolled in by students?
Additional table information: table: e_learning

Answer: SELECT COUNT(course_id) FROM Student_Course_Enrolment


Question:
Find the number of distinct courses that have enrolled students.
Additional table information: table: e_learning

Answer: SELECT COUNT(course_id) FROM Student_Course_Enrolment


Question:
Find the dates of the tests taken with result 'Pass'.
Additional table information: table: e_learning

Answer: SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = 'Pass'


Question:
Which tests have 'Pass' results? Return the dates when the tests were taken.
Additional table information: table: e_learning

Answer: SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = 'Pass'


Question:
How many tests have result 'Fail'?
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Student_Tests_Taken WHERE test_result = 'Fail'


Question:
Count the number of tests with 'Fail' result.
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Student_Tests_Taken WHERE test_result = 'Fail'


Question:
What are the login names of the students with family name 'Ward'?
Additional table information: table: e_learning

Answer: SELECT login_name FROM Students WHERE family_name = 'Ward'


Question:
Return the login names of the students whose family name is 'Ward'.
Additional table information: table: e_learning

Answer: SELECT login_name FROM Students WHERE family_name = 'Ward'


Question:
What are the dates of the latest logon of the students with family name 'Jaskolski' or 'Langosh'?
Additional table information: table: e_learning

Answer: SELECT date_of_latest_logon FROM Students WHERE family_name = 'Jaskolski' OR family_name = 'Langosh'


Question:
Find the latest logon date of the students whose family name is 'Jaskolski' or 'Langosh'.
Additional table information: table: e_learning

Answer: SELECT date_of_latest_logon FROM Students WHERE family_name = 'Jaskolski' OR family_name = 'Langosh'


Question:
How many students have personal names that contain the word 'son'?
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Students WHERE personal_name LIKE '%son%'


Question:
Find the number of students who have the word 'son' in their personal names.
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Students WHERE personal_name LIKE '%son%'


Question:
List all the subject names.
Additional table information: table: e_learning

Answer: SELECT subject_name FROM SUBJECTS


Question:
What are the names of all the subjects.
Additional table information: table: e_learning

Answer: SELECT subject_name FROM SUBJECTS


Question:
List all the information about course authors and tutors in alphabetical order of the personal name.
Additional table information: table: e_learning

Answer: SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name NULLS FIRST


Question:
Sort the information about course authors and tutors in alphabetical order of the personal name.
Additional table information: table: e_learning

Answer: SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name NULLS FIRST


Question:
List the personal names and family names of all the students in alphabetical order of family name.
Additional table information: table: e_learning

Answer: SELECT personal_name, family_name FROM Students ORDER BY family_name NULLS FIRST


Question:
What are the personal names and family names of the students? Sort the result in alphabetical order of the family name.
Additional table information: table: e_learning

Answer: SELECT personal_name, family_name FROM Students ORDER BY family_name NULLS FIRST


Question:
List each test result and its count in descending order of count.
Additional table information: table: e_learning

Answer: SELECT test_result, COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC


Question:
For each distinct test result, find the number of students who got the result.
Additional table information: table: e_learning

Answer: SELECT test_result, COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC


Question:
Find the login name of the course author that teaches the course with name 'advanced database'.
Additional table information: table: e_learning

Answer: SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'advanced database'


Question:
Which course author teaches the 'advanced database' course? Give me his or her login name.
Additional table information: table: e_learning

Answer: SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'advanced database'


Question:
Find the addresses of the course authors who teach the course with name 'operating system' or 'data structure'.
Additional table information: table: e_learning

Answer: SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'operating system' OR T2.course_name = 'data structure'


Question:
What are the addresses of the course authors who teach either 'operating system' or 'data structure' course.
Additional table information: table: e_learning

Answer: SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'operating system' OR T2.course_name = 'data structure'


Question:
Find the personal name, family name, and author ID of the course author that teaches the most courses.
Additional table information: table: e_learning

Answer: SELECT T1.personal_name, T1.family_name, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the personal name, family name, and author ID of the course author who teaches the most courses?
Additional table information: table: e_learning

Answer: SELECT T1.personal_name, T1.family_name, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the addresses and author IDs of the course authors that teach at least two courses.
Additional table information: table: e_learning

Answer: SELECT T1.address_line_1, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id HAVING COUNT(*) >= 2


Question:
Which course authors teach two or more courses? Give me their addresses and author IDs.
Additional table information: table: e_learning

Answer: SELECT T1.address_line_1, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id HAVING COUNT(*) >= 2


Question:
Find the names of courses taught by the tutor who has personal name 'Julio'.
Additional table information: table: e_learning

Answer: SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = 'Julio'


Question:
What are the names of the courses taught by the tutor whose personal name is 'Julio'?
Additional table information: table: e_learning

Answer: SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = 'Julio'


Question:
Find the names and descriptions of courses that belong to the subject named 'Computer Science'.
Additional table information: table: e_learning

Answer: SELECT T1.course_name, T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Computer Science'


Question:
What are the names and descriptions of the all courses under the 'Computer Science' subject?
Additional table information: table: e_learning

Answer: SELECT T1.course_name, T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Computer Science'


Question:
Find the subject ID, subject name, and the corresponding number of available courses for each subject.
Additional table information: table: e_learning

Answer: SELECT T1.subject_id, T2.subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id


Question:
What are the subject ID, subject name, and the number of available courses for each subject?
Additional table information: table: e_learning

Answer: SELECT T1.subject_id, T2.subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id


Question:
Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.
Additional table information: table: e_learning

Answer: SELECT T1.subject_id, T2.subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC NULLS FIRST


Question:
List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.
Additional table information: table: e_learning

Answer: SELECT T1.subject_id, T2.subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC NULLS FIRST


Question:
What is the date of enrollment of the course named 'Spanish'?
Additional table information: table: e_learning

Answer: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'Spanish'


Question:
Find the the date of enrollment of the 'Spanish' course.
Additional table information: table: e_learning

Answer: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'Spanish'


Question:
What is the name of the course that has the most student enrollment?
Additional table information: table: e_learning

Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which course is enrolled in by the most students? Give me the course name.
Additional table information: table: e_learning

Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of the courses that have exactly 1 student enrollment?
Additional table information: table: e_learning

Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) = 1


Question:
Find the names of the courses that have just one student enrollment.
Additional table information: table: e_learning

Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) = 1


Question:
What are the descriptions and names of the courses that have student enrollment bigger than 2?
Additional table information: table: e_learning

Answer: SELECT T1.course_description, T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2


Question:
Return the descriptions and names of the courses that have more than two students enrolled in.
Additional table information: table: e_learning

Answer: SELECT T1.course_description, T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2


Question:
What is the name of each course and the corresponding number of student enrollment?
Additional table information: table: e_learning

Answer: SELECT T1.course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name


Question:
List the name and the number of enrolled student for each course.
Additional table information: table: e_learning

Answer: SELECT T1.course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name


Question:
What are the enrollment dates of all the tests that have result 'Pass'?
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Pass'


Question:
Find the enrollment date for all the tests that have 'Pass' result.
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Pass'


Question:
What are the completion dates of all the tests that have result 'Fail'?
Additional table information: table: e_learning

Answer: SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Fail'


Question:
Return the completion date for all the tests that have 'Fail' result.
Additional table information: table: e_learning

Answer: SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Fail'


Question:
List the dates of enrollment and completion of the student with personal name 'Karson'.
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = 'Karson'


Question:
On what dates did the student whose personal name is 'Karson' enroll in and complete the courses?
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = 'Karson'


Question:
List the dates of enrollment and completion of the student with family name 'Zieme' and personal name 'Bernie'.
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = 'Zieme' AND T2.personal_name = 'Bernie'


Question:
On what dates did the student with family name 'Zieme' and personal name 'Bernie' enroll in and complete the courses?
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = 'Zieme' AND T2.personal_name = 'Bernie'


Question:
Find the student ID and login name of the student with the most course enrollments
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the student ID and login name of the student who are enrolled in the most courses?
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the student ID and personal name of the student with at least two enrollments.
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2


Question:
Which student are enrolled in at least two courses? Give me the student ID and personal name.
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2


Question:
Find the student ID and middle name for all the students with at most two enrollments.
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) <= 2


Question:
What are the student IDs and middle names of the students enrolled in at most two courses?
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) <= 2


Question:
Find the personal names of students not enrolled in any course.
Additional table information: table: e_learning

Answer: SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id


Question:
Which students not enrolled in any course? Find their personal names.
Additional table information: table: e_learning

Answer: SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id


Question:
How many students did not have any course enrollment?
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Students WHERE NOT student_id IN (SELECT student_id FROM Student_Course_Enrolment)


Question:
Count the number of students who did not enroll in any course.
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Students WHERE NOT student_id IN (SELECT student_id FROM Student_Course_Enrolment)


Question:
Find the common login name of course authors and students.
Additional table information: table: e_learning

Answer: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students


Question:
What are the login names used both by some course authors and some students?
Additional table information: table: e_learning

Answer: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students


Question:
Find the common personal name of course authors and students.
Additional table information: table: e_learning

Answer: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students


Question:
What are the personal names used both by some course authors and some students?
Additional table information: table: e_learning

Answer: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students


Question:
Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.
Additional table information: table: insurance_policies

Answer: SELECT T1.Date_Claim_Made, T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING COUNT(*) > 2 UNION SELECT T1.Date_Claim_Made, T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = (SELECT MAX(Amount_Claimed) FROM Claims)


Question:
Find the claims that led to more than two settlements or have the maximum claim value. For each of them, return the date the claim was made and the id of the claim.
Additional table information: table: insurance_policies

Answer: SELECT T1.Date_Claim_Made, T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING COUNT(*) > 2 UNION SELECT T1.Date_Claim_Made, T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = (SELECT MAX(Amount_Claimed) FROM Claims)


Question:
Which customer had at least 2 policies but did not file any claims? List the customer details and id.
Additional table information: table: insurance_policies

Answer: SELECT T1.customer_details, T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2 EXCEPT SELECT T1.customer_details, T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id


Question:
Give me the the customer details and id for the customers who had two or more policies but did not file any claims.
Additional table information: table: insurance_policies

Answer: SELECT T1.customer_details, T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2 EXCEPT SELECT T1.customer_details, T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.customer_id JOIN Claims AS T3 ON T2.policy_id = T3.policy_id


Question:
List the method, date and amount of all the payments, in ascending order of date.
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC NULLS FIRST


Question:
What are the method, date and amount of each payment? Sort the list in ascending order of date.
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC NULLS FIRST


Question:
Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.
Additional table information: table: insurance_policies

Answer: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1


Question:
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.
Additional table information: table: insurance_policies

Answer: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1


Question:
Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount.
Additional table information: table: insurance_policies

Answer: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC NULLS FIRST LIMIT 1


Question:
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.
Additional table information: table: insurance_policies

Answer: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC NULLS FIRST LIMIT 1


Question:
Among all the claims, which claims have a claimed amount larger than the average? List the date the claim was made and the date it was settled.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made, Date_Claim_Settled FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims)


Question:
Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made, Date_Claim_Settled FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims)


Question:
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims)


Question:
Return the claim start date for the claims whose claimed amount is no more than the average
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims)


Question:
How many settlements does each claim correspond to? List the claim id and the number of settlements.
Additional table information: table: insurance_policies

Answer: SELECT T1.Claim_id, COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id


Question:
Find the number of settlements each claim corresponds to. Show the number together with the claim id.
Additional table information: table: insurance_policies

Answer: SELECT T1.Claim_id, COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id


Question:
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
Additional table information: table: insurance_policies

Answer: SELECT T1.claim_id, T1.date_claim_made, COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.
Additional table information: table: insurance_policies

Answer: SELECT T1.claim_id, T1.date_claim_made, COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.
Additional table information: table: insurance_policies

Answer: SELECT COUNT(*), T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1


Question:
Find the claim id and the number of settlements made for the claim with the most recent settlement date.
Additional table information: table: insurance_policies

Answer: SELECT COUNT(*), T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1


Question:
Of all the claims, what was the earliest date when any claim was made?
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC NULLS FIRST LIMIT 1


Question:
Tell me the the date when the first claim was made.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC NULLS FIRST LIMIT 1


Question:
What is the total amount of settlement made for all the settlements?
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Settled) FROM Settlements


Question:
Compute the total amount of settlement across all the settlements.
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Settled) FROM Settlements


Question:
Who are the customers that had more than 1 policy? List the customer details and id.
Additional table information: table: insurance_policies

Answer: SELECT T1.customer_details, T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 1


Question:
Find the the customer details and id for the customers who had more than one policy.
Additional table information: table: insurance_policies

Answer: SELECT T1.customer_details, T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id = T2.Customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 1


Question:
What are the claim dates and settlement dates of all the settlements?
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements


Question:
Tell me the the claim date and settlement date for each settlement case.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements


Question:
What is the most popular payment method?
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which payment method is used the most often?
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
With which kind of payment method were the least number of payments processed?
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What is the payment method that were used the least often?
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What is the total amount of payment?
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Payment) FROM Payments


Question:
Compute the total amount of payment processed.
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Payment) FROM Payments


Question:
What are all the distinct details of the customers?
Additional table information: table: insurance_policies

Answer: SELECT DISTINCT customer_details FROM Customers


Question:
Return the distinct customer details.
Additional table information: table: insurance_policies

Answer: SELECT DISTINCT customer_details FROM Customers


Question:
Which kind of policy type was chosen by the most customers?
Additional table information: table: insurance_policies

Answer: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the policy type the most customers choose.
Additional table information: table: insurance_policies

Answer: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many settlements are there in total?
Additional table information: table: insurance_policies

Answer: SELECT COUNT(*) FROM Settlements


Question:
Count the total number of settlements made.
Additional table information: table: insurance_policies

Answer: SELECT COUNT(*) FROM Settlements


Question:
Which Payments were processed with Visa? List the payment Id, the date and the amount.
Additional table information: table: insurance_policies

Answer: SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'


Question:
Give me the payment Id, the date and the amount for all the payments processed with Visa.
Additional table information: table: insurance_policies

Answer: SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'


Question:
List the details of the customers who do not have any policies.
Additional table information: table: insurance_policies

Answer: SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id


Question:
Which customers do not have any policies? Find the details of these customers.
Additional table information: table: insurance_policies

Answer: SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id


Question:
List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.
Additional table information: table: insurance_policies

Answer: SELECT T1.claim_id, T1.date_claim_made, T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.claim_id HAVING COUNT(*) = 1


Question:
Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled.
Additional table information: table: insurance_policies

Answer: SELECT T1.claim_id, T1.date_claim_made, T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.claim_id HAVING COUNT(*) = 1


Question:
Find the total claimed amount of all the claims.
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Claimed) FROM Claims


Question:
What is total amount claimed summed across all the claims?
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Claimed) FROM Claims


Question:
Which department has the largest number of employees?
Additional table information: table: hospital_1

Answer: SELECT name FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) DESC LIMIT 1


Question:
Find the department with the most employees.
Additional table information: table: hospital_1

Answer: SELECT name FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) DESC LIMIT 1


Question:
What is the employee id of the head whose department has the least number of employees?
Additional table information: table: hospital_1

Answer: SELECT head FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
Tell me the employee id of the head of the department with the least employees.
Additional table information: table: hospital_1

Answer: SELECT head FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
what is the name and position of the head whose department has least number of employees?
Additional table information: table: hospital_1

Answer: SELECT T2.name, T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
Find the name and position of the head of the department with the least employees.
Additional table information: table: hospital_1

Answer: SELECT T2.name, T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
What are names of patients who made an appointment?
Additional table information: table: hospital_1

Answer: SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn


Question:
List the names of patients who have made appointments.
Additional table information: table: hospital_1

Answer: SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn


Question:
what are name and phone number of patients who had more than one appointment?
Additional table information: table: hospital_1

Answer: SELECT name, phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING COUNT(*) > 1


Question:
Which patients made more than one appointment? Tell me the name and phone number of these patients.
Additional table information: table: hospital_1

Answer: SELECT name, phone FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn GROUP BY T1.patient HAVING COUNT(*) > 1


Question:
Find the id of the appointment with the most recent start date?
Additional table information: table: hospital_1

Answer: SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1


Question:
What is the id of the appointment that started most recently?
Additional table information: table: hospital_1

Answer: SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1


Question:
List the name of physicians who took some appointment.
Additional table information: table: hospital_1

Answer: SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID


Question:
What are the names of all the physicians who took appointments.
Additional table information: table: hospital_1

Answer: SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID


Question:
List the name of physicians who never took any appointment.
Additional table information: table: hospital_1

Answer: SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID


Question:
Which physicians have never taken any appointment? Find their names.
Additional table information: table: hospital_1

Answer: SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID


Question:
Find the names of all physicians and their primary affiliated departments' names.
Additional table information: table: hospital_1

Answer: SELECT T1.name, T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1


Question:
What are the name and primarily affiliated department name of each physician?
Additional table information: table: hospital_1

Answer: SELECT T1.name, T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1


Question:
What is the name of the patient who made the most recent appointment?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1


Question:
Find the name of the patient who made the appointment with the most recent start date.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1


Question:
How many patients stay in room 112?
Additional table information: table: hospital_1

Answer: SELECT COUNT(patient) FROM stay WHERE room = 112


Question:
Count the number of patients who stayed in room 112.
Additional table information: table: hospital_1

Answer: SELECT COUNT(patient) FROM stay WHERE room = 112


Question:
How many patients' prescriptions are made by physician John Dorian?
Additional table information: table: hospital_1

Answer: SELECT COUNT(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = 'John Dorian'


Question:
Find the number of patients' prescriptions physician John Dorian made.
Additional table information: table: hospital_1

Answer: SELECT COUNT(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = 'John Dorian'


Question:
Find the name of medication used on the patient who stays in room 111?
Additional table information: table: hospital_1

Answer: SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111


Question:
What is the name of the medication used for the patient staying in room 111?
Additional table information: table: hospital_1

Answer: SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111


Question:
Find the patient who most recently stayed in room 111.
Additional table information: table: hospital_1

Answer: SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1


Question:
What is the id of the patient who stayed in room 111 most recently?
Additional table information: table: hospital_1

Answer: SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1


Question:
What is the name of the nurse has the most appointments?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of the nurse who has the largest number of appointments.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many patients do each physician take care of? List their names and number of patients they take care of.
Additional table information: table: hospital_1

Answer: SELECT T1.name, COUNT(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid


Question:
Return the name of each physician and the number of patients he or she treats.
Additional table information: table: hospital_1

Answer: SELECT T1.name, COUNT(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid


Question:
Find the name of physicians who are in charge of more than one patient.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING COUNT(*) > 1


Question:
Which physicians are in charge of more than one patient? Give me their names.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid HAVING COUNT(*) > 1


Question:
Find the number of rooms located on each block floor.
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor


Question:
How many rooms does each block floor have?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor


Question:
Find the number of rooms for different block code?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode


Question:
How many rooms are located for each block code?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.blockcode FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockcode


Question:
What are the unique block codes that have available rooms?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT blockcode FROM room WHERE unavailable = 0


Question:
Tell me the distinct block codes where some rooms are available.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT blockcode FROM room WHERE unavailable = 0


Question:
How many different types of rooms are there?
Additional table information: table: hospital_1

Answer: SELECT COUNT(DISTINCT roomtype) FROM room


Question:
Find the number of distinct room types available.
Additional table information: table: hospital_1

Answer: SELECT COUNT(DISTINCT roomtype) FROM room


Question:
What is the names of the physicians who prescribe medication Thesisin?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = 'Thesisin'


Question:
List the names of all the physicians who prescribe Thesisin as medication.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = 'Thesisin'


Question:
Find the name and position of physicians who prescribe some medication whose brand is X?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T1.name, T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = 'X'


Question:
Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T1.name, T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.Brand = 'X'


Question:
Find the number of medications prescribed for each brand.
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand


Question:
How many medications are prescribed for each brand?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand


Question:
Find the name of physicians whose position title contains the word 'senior'.
Additional table information: table: hospital_1

Answer: SELECT name FROM physician WHERE POSITION LIKE '%senior%'


Question:
What are the names of the physicians who have 'senior' in their titles.
Additional table information: table: hospital_1

Answer: SELECT name FROM physician WHERE POSITION LIKE '%senior%'


Question:
Find the patient who has the most recent undergoing treatment?
Additional table information: table: hospital_1

Answer: SELECT patient FROM undergoes ORDER BY dateundergoes NULLS FIRST LIMIT 1


Question:
Which patient is undergoing the most recent treatment?
Additional table information: table: hospital_1

Answer: SELECT patient FROM undergoes ORDER BY dateundergoes NULLS FIRST LIMIT 1


Question:
Find the names of all patients who have an undergoing treatment and are staying in room 111.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111


Question:
What are the names of patients who are staying in room 111 and have an undergoing treatment?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111


Question:
List the names of all distinct nurses ordered by alphabetical order?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT name FROM nurse ORDER BY name NULLS FIRST


Question:
What is the alphabetically ordered list of all the distinct names of nurses?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT name FROM nurse ORDER BY name NULLS FIRST


Question:
Find the names of nurses who are nursing an undergoing treatment.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID


Question:
Which nurses are in charge of patients undergoing treatments?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID


Question:
List the names of all distinct medications, ordered in an alphabetical order.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT name FROM medication ORDER BY name NULLS FIRST


Question:
What is the alphabetically ordered list of all distinct medications?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT name FROM medication ORDER BY name NULLS FIRST


Question:
What are the names of the physician who prescribed the highest dose?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1


Question:
Find the physician who prescribed the highest dose. What is his or her name?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1


Question:
List the physicians' employee ids together with their primary affiliation departments' ids.
Additional table information: table: hospital_1

Answer: SELECT physician, department FROM affiliated_with WHERE primaryaffiliation = 1


Question:
What are each physician's employee id and department id primarily affiliated.
Additional table information: table: hospital_1

Answer: SELECT physician, department FROM affiliated_with WHERE primaryaffiliation = 1


Question:
List the names of departments where some physicians are primarily affiliated with.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1


Question:
What are the names of departments that have primarily affiliated physicians.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1


Question:
What nurses are on call with block floor 1 and block code 1? Tell me their names.
Additional table information: table: hospital_1

Answer: SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1


Question:
Find the ids of the nurses who are on call in block floor 1 and block code 1.
Additional table information: table: hospital_1

Answer: SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1


Question:
What are the highest cost, lowest cost and average cost of procedures?
Additional table information: table: hospital_1

Answer: SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures


Question:
Tell me the highest, lowest, and average cost of procedures.
Additional table information: table: hospital_1

Answer: SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures


Question:
List the name and cost of all procedures sorted by the cost from the highest to the lowest.
Additional table information: table: hospital_1

Answer: SELECT name, cost FROM procedures ORDER BY cost DESC


Question:
Sort the list of names and costs of all procedures in the descending order of cost.
Additional table information: table: hospital_1

Answer: SELECT name, cost FROM procedures ORDER BY cost DESC


Question:
Find the three most expensive procedures.
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures ORDER BY cost NULLS FIRST LIMIT 3


Question:
What are the three most costly procedures?
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures ORDER BY cost NULLS FIRST LIMIT 3


Question:
Find the physicians who are trained in a procedure that costs more than 5000.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000


Question:
Which physicians are trained in procedures that are more expensive than 5000?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000


Question:
Find the physician who was trained in the most expensive procedure?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1


Question:
Which physician was trained in the procedure that costs the most.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1


Question:
What is the average cost of procedures that physician John Wen was trained in?
Additional table information: table: hospital_1

Answer: SELECT AVG(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Compute the mean price of procedures physician John Wen was trained in.
Additional table information: table: hospital_1

Answer: SELECT AVG(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Find the names of procedures which physician John Wen was trained in.
Additional table information: table: hospital_1

Answer: SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
What are the names of procedures physician John Wen was trained in?
Additional table information: table: hospital_1

Answer: SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Find all procedures which cost more than 1000 or which physician John Wen was trained in.
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
What are the procedures that cost more than 1000 or are specialized in by physician John Wen?
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Find the names of all procedures which cost more than 1000 but which physician John Wen was not trained in?
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Among the procedures that cost more than 1000, which were not specialized in by physician John Wen?
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in.
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
What procedures cost less than 5000 and have John Wen as a trained physician?
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Find the name of physicians who are affiliated with both Surgery and Psychiatry departments.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry'


Question:
Which physicians are affiliated with both Surgery and Psychiatry departments? Tell me their names.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry'


Question:
Find the name of physicians who are affiliated with Surgery or Psychiatry department.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry'


Question:
Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry'


Question:
Find the names of patients who are not using the medication of Procrastin-X.
Additional table information: table: hospital_1

Answer: SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X'


Question:
What are the names of patients who are not taking the medication of Procrastin-X.
Additional table information: table: hospital_1

Answer: SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X'


Question:
Find the number of patients who are not using the medication of Procrastin-X.
Additional table information: table: hospital_1

Answer: SELECT COUNT(*) FROM patient WHERE NOT SSN IN (SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X')


Question:
How many patients are not using Procrastin-X as medication?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*) FROM patient WHERE NOT SSN IN (SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X')


Question:
How many appointments are there?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*) FROM appointment


Question:
Count how many appointments have been made in total.
Additional table information: table: hospital_1

Answer: SELECT COUNT(*) FROM appointment