Question:
Find the names of the visitors whose membership level is higher than 4, and order the results by the level from high to low.
Additional table information: table: museum_visit

Answer: SELECT name FROM visitor WHERE Level_of_membership > 4 ORDER BY Level_of_membership DESC


Question:
What is the average age of the visitors whose membership level is not higher than 4?
Additional table information: table: museum_visit

Answer: SELECT AVG(age) FROM visitor WHERE Level_of_membership <= 4


Question:
Find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young.
Additional table information: table: museum_visit

Answer: SELECT name, Level_of_membership FROM visitor WHERE Level_of_membership > 4 ORDER BY age DESC


Question:
Find the id and name of the museum that has the most staff members?
Additional table information: table: museum_visit

Answer: SELECT museum_id, name FROM museum ORDER BY num_of_staff DESC LIMIT 1


Question:
Find the average number of staff working for the museums that were open before 2009.
Additional table information: table: museum_visit

Answer: SELECT AVG(num_of_staff) FROM museum WHERE open_year < 2009


Question:
What are the opening year and staff number of the museum named Plaza Museum?
Additional table information: table: museum_visit

Answer: SELECT Num_of_Staff, Open_Year FROM museum WHERE name = 'Plaza Museum'


Question:
find the names of museums which have more staff than the minimum staff number of all museums opened after 2010.
Additional table information: table: museum_visit

Answer: SELECT name FROM museum WHERE num_of_staff > (SELECT MIN(num_of_staff) FROM museum WHERE open_year > 2010)


Question:
find the id, name and age for visitors who visited some museums more than once.
Additional table information: table: museum_visit

Answer: SELECT t1.id, t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t1.id HAVING COUNT(*) > 1


Question:
What are the id, name and membership level of visitors who have spent the largest amount of money in total in all museum tickets?
Additional table information: table: museum_visit

Answer: SELECT t2.visitor_id, t1.name, t1.Level_of_membership FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t2.visitor_id ORDER BY SUM(t2.Total_spent) DESC LIMIT 1


Question:
What are the id and name of the museum visited most times?
Additional table information: table: museum_visit

Answer: SELECT t2.Museum_ID, t1.name FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID GROUP BY t2.Museum_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the museum that had no visitor yet?
Additional table information: table: museum_visit

Answer: SELECT name FROM museum WHERE NOT Museum_ID IN (SELECT museum_id FROM visit)


Question:
Find the name and age of the visitor who bought the most tickets at once.
Additional table information: table: museum_visit

Answer: SELECT t1.name, t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id ORDER BY t2.num_of_ticket DESC LIMIT 1


Question:
What are the average and maximum number of tickets bought in all visits?
Additional table information: table: museum_visit

Answer: SELECT AVG(num_of_ticket), MAX(num_of_ticket) FROM visit


Question:
What is the total ticket expense of the visitors whose membership level is 1?
Additional table information: table: museum_visit

Answer: SELECT SUM(t2.Total_spent) FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id WHERE t1.Level_of_membership = 1


Question:
What is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011?
Additional table information: table: museum_visit

Answer: SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year < 2009 INTERSECT SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year > 2011


Question:
Find the number of visitors who did not visit any museum opened after 2010.
Additional table information: table: museum_visit

Answer: SELECT COUNT(*) FROM visitor WHERE NOT id IN (SELECT t2.visitor_id FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID WHERE t1.open_year > 2010)


Question:
How many museums were opened after 2013 or before 2008?
Additional table information: table: museum_visit

Answer: SELECT COUNT(*) FROM museum WHERE open_year > 2013 OR open_year < 2008


Question:
Find the total number of players.
Additional table information: table: wta_1

Answer: SELECT COUNT(*) FROM players


Question:
How many players are there?
Additional table information: table: wta_1

Answer: SELECT COUNT(*) FROM players


Question:
Find the total number of matches.
Additional table information: table: wta_1

Answer: SELECT COUNT(*) FROM matches


Question:
Count the number of matches.
Additional table information: table: wta_1

Answer: SELECT COUNT(*) FROM matches


Question:
List the first name and birth date of all players from the country with code USA.
Additional table information: table: wta_1

Answer: SELECT first_name, birth_date FROM players WHERE country_code = 'USA'


Question:
What are the first names and birth dates of players from the USA?
Additional table information: table: wta_1

Answer: SELECT first_name, birth_date FROM players WHERE country_code = 'USA'


Question:
Find the average age of losers and winners of all matches.
Additional table information: table: wta_1

Answer: SELECT AVG(loser_age), AVG(winner_age) FROM matches


Question:
What are the average ages of losers and winners across matches?
Additional table information: table: wta_1

Answer: SELECT AVG(loser_age), AVG(winner_age) FROM matches


Question:
Find the average rank of winners in all matches.
Additional table information: table: wta_1

Answer: SELECT AVG(winner_rank) FROM matches


Question:
What is the average rank for winners in all matches?
Additional table information: table: wta_1

Answer: SELECT AVG(winner_rank) FROM matches


Question:
Find the highest rank of losers in all matches.
Additional table information: table: wta_1

Answer: SELECT MIN(loser_rank) FROM matches


Question:
What is the best rank of losers across all matches?
Additional table information: table: wta_1

Answer: SELECT MIN(loser_rank) FROM matches


Question:
find the number of distinct country codes of all players.
Additional table information: table: wta_1

Answer: SELECT COUNT(DISTINCT country_code) FROM players


Question:
How many distinct countries do players come from?
Additional table information: table: wta_1

Answer: SELECT COUNT(DISTINCT country_code) FROM players


Question:
Find the number of distinct name of losers.
Additional table information: table: wta_1

Answer: SELECT COUNT(DISTINCT loser_name) FROM matches


Question:
How many different loser names are there?
Additional table information: table: wta_1

Answer: SELECT COUNT(DISTINCT loser_name) FROM matches


Question:
Find the name of tourney that has more than 10 matches.
Additional table information: table: wta_1

Answer: SELECT tourney_name FROM matches GROUP BY tourney_name HAVING COUNT(*) > 10


Question:
What are the names of tournaments that have more than 10 matches?
Additional table information: table: wta_1

Answer: SELECT tourney_name FROM matches GROUP BY tourney_name HAVING COUNT(*) > 10


Question:
List the names of all winners who played in both 2013 and 2016.
Additional table information: table: wta_1

Answer: SELECT winner_name FROM matches WHERE YEAR = 2013 INTERSECT SELECT winner_name FROM matches WHERE YEAR = 2016


Question:
What are the names of players who won in both 2013 and 2016?
Additional table information: table: wta_1

Answer: SELECT winner_name FROM matches WHERE YEAR = 2013 INTERSECT SELECT winner_name FROM matches WHERE YEAR = 2016


Question:
List the number of all matches who played in years of 2013 or 2016.
Additional table information: table: wta_1

Answer: SELECT COUNT(*) FROM matches WHERE YEAR = 2013 OR YEAR = 2016


Question:
How many matches were played in 2013 or 2016?
Additional table information: table: wta_1

Answer: SELECT COUNT(*) FROM matches WHERE YEAR = 2013 OR YEAR = 2016


Question:
What are the country code and first name of the players who won in both tourney WTA Championships and Australian Open?
Additional table information: table: wta_1

Answer: SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'WTA Championships' INTERSECT SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'Australian Open'


Question:
What are the first names and country codes for players who won both the WTA Championships and the Australian Open?
Additional table information: table: wta_1

Answer: SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'WTA Championships' INTERSECT SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'Australian Open'


Question:
Find the first name and country code of the oldest player.
Additional table information: table: wta_1

Answer: SELECT first_name, country_code FROM players ORDER BY birth_date NULLS FIRST LIMIT 1


Question:
What is the first name and country code of the oldest player?
Additional table information: table: wta_1

Answer: SELECT first_name, country_code FROM players ORDER BY birth_date NULLS FIRST LIMIT 1


Question:
List the first and last name of all players in the order of birth date.
Additional table information: table: wta_1

Answer: SELECT first_name, last_name FROM players ORDER BY birth_date NULLS FIRST


Question:
What are the full names of all players, sorted by birth date?
Additional table information: table: wta_1

Answer: SELECT first_name, last_name FROM players ORDER BY birth_date NULLS FIRST


Question:
List the first and last name of all players who are left / L hand in the order of birth date.
Additional table information: table: wta_1

Answer: SELECT first_name, last_name FROM players WHERE hand = 'L' ORDER BY birth_date NULLS FIRST


Question:
What are the full names of all left handed players, in order of birth date?
Additional table information: table: wta_1

Answer: SELECT first_name, last_name FROM players WHERE hand = 'L' ORDER BY birth_date NULLS FIRST


Question:
Find the first name and country code of the player who did the most number of tours.
Additional table information: table: wta_1

Answer: SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id ORDER BY T2.tours DESC LIMIT 1


Question:
What is the first name and country code of the player with the most tours?
Additional table information: table: wta_1

Answer: SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id ORDER BY T2.tours DESC LIMIT 1


Question:
Find the year that has the most number of matches.
Additional table information: table: wta_1

Answer: SELECT YEAR FROM matches GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which year had the most matches?
Additional table information: table: wta_1

Answer: SELECT YEAR FROM matches GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name and rank points of the winner who won the most times.
Additional table information: table: wta_1

Answer: SELECT winner_name, winner_rank_points FROM matches GROUP BY winner_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the winner who has won the most matches, and how many rank points does this player have?
Additional table information: table: wta_1

Answer: SELECT winner_name, winner_rank_points FROM matches GROUP BY winner_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of the winner who has the highest rank points and participated in the Australian Open tourney.
Additional table information: table: wta_1

Answer: SELECT winner_name FROM matches WHERE tourney_name = 'Australian Open' ORDER BY winner_rank_points DESC LIMIT 1


Question:
What is the name of the winner with the most rank points who participated in the Australian Open tournament?
Additional table information: table: wta_1

Answer: SELECT winner_name FROM matches WHERE tourney_name = 'Australian Open' ORDER BY winner_rank_points DESC LIMIT 1


Question:
find the names of loser and winner who played in the match with greatest number of minutes.
Additional table information: table: wta_1

Answer: SELECT winner_name, loser_name FROM matches ORDER BY minutes DESC LIMIT 1


Question:
What are the names of the winner and loser who played in the longest match?
Additional table information: table: wta_1

Answer: SELECT winner_name, loser_name FROM matches ORDER BY minutes DESC LIMIT 1


Question:
Find the average ranking for each player and their first name.
Additional table information: table: wta_1

Answer: SELECT AVG(ranking), T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name


Question:
What are the first names of all players, and their average rankings?
Additional table information: table: wta_1

Answer: SELECT AVG(ranking), T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name


Question:
Find the total ranking points for each player and their first name.
Additional table information: table: wta_1

Answer: SELECT SUM(ranking_points), T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name


Question:
What are the first names of all players, and their total ranking points?
Additional table information: table: wta_1

Answer: SELECT SUM(ranking_points), T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name


Question:
find the number of players for each country.
Additional table information: table: wta_1

Answer: SELECT COUNT(*), country_code FROM players GROUP BY country_code


Question:
How many players are from each country?
Additional table information: table: wta_1

Answer: SELECT COUNT(*), country_code FROM players GROUP BY country_code


Question:
find the code of the country where has the greatest number of players.
Additional table information: table: wta_1

Answer: SELECT country_code FROM players GROUP BY country_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the code of the country with the most players?
Additional table information: table: wta_1

Answer: SELECT country_code FROM players GROUP BY country_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the codes of countries that have more than 50 players.
Additional table information: table: wta_1

Answer: SELECT country_code FROM players GROUP BY country_code HAVING COUNT(*) > 50


Question:
What are the codes of countries with more than 50 players?
Additional table information: table: wta_1

Answer: SELECT country_code FROM players GROUP BY country_code HAVING COUNT(*) > 50


Question:
Find the total number of tours for each ranking date.
Additional table information: table: wta_1

Answer: SELECT SUM(tours), ranking_date FROM rankings GROUP BY ranking_date


Question:
How many total tours were there for each ranking date?
Additional table information: table: wta_1

Answer: SELECT SUM(tours), ranking_date FROM rankings GROUP BY ranking_date


Question:
Find the number of matches happened in each year.
Additional table information: table: wta_1

Answer: SELECT COUNT(*), YEAR FROM matches GROUP BY YEAR


Question:
How many matches were played in each year?
Additional table information: table: wta_1

Answer: SELECT COUNT(*), YEAR FROM matches GROUP BY YEAR


Question:
Find the name and rank of the 3 youngest winners across all matches.
Additional table information: table: wta_1

Answer: SELECT DISTINCT winner_name, winner_rank FROM matches ORDER BY winner_age NULLS FIRST LIMIT 3


Question:
What are the names and ranks of the three youngest winners across all matches?
Additional table information: table: wta_1

Answer: SELECT DISTINCT winner_name, winner_rank FROM matches ORDER BY winner_age NULLS FIRST LIMIT 3


Question:
How many different winners both participated in the WTA Championships and were left handed?
Additional table information: table: wta_1

Answer: SELECT COUNT(DISTINCT winner_name) FROM matches WHERE tourney_name = 'WTA Championships' AND winner_hand = 'L'


Question:
Find the number of left handed winners who participated in the WTA Championships.
Additional table information: table: wta_1

Answer: SELECT COUNT(DISTINCT winner_name) FROM matches WHERE tourney_name = 'WTA Championships' AND winner_hand = 'L'


Question:
Find the first name, country code and birth date of the winner who has the highest rank points in all matches.
Additional table information: table: wta_1

Answer: SELECT T1.first_name, T1.country_code, T1.birth_date FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id ORDER BY T2.winner_rank_points DESC LIMIT 1


Question:
What is the first name, country code, and birth date of the player with the most winner rank points across all matches?
Additional table information: table: wta_1

Answer: SELECT T1.first_name, T1.country_code, T1.birth_date FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id ORDER BY T2.winner_rank_points DESC LIMIT 1


Question:
Find the number of players for each hand type.
Additional table information: table: wta_1

Answer: SELECT COUNT(*), hand FROM players GROUP BY hand


Question:
How many players are there for each hand type?
Additional table information: table: wta_1

Answer: SELECT COUNT(*), hand FROM players GROUP BY hand


Question:
How many ships ended up being 'Captured'?
Additional table information: table: battle_death

Answer: SELECT COUNT(*) FROM ship WHERE disposition_of_ship = 'Captured'


Question:
List the name and tonnage ordered by in descending alphaetical order for the names.
Additional table information: table: battle_death

Answer: SELECT name, tonnage FROM ship ORDER BY name DESC


Question:
List the name, date and result of each battle.
Additional table information: table: battle_death

Answer: SELECT name, date FROM battle


Question:
What is maximum and minimum death toll caused each time?
Additional table information: table: battle_death

Answer: SELECT MAX(killed), MIN(killed) FROM death


Question:
What is the average number of injuries caused each time?
Additional table information: table: battle_death

Answer: SELECT AVG(injured) FROM death


Question:
What are the death and injury situations caused by the ship with tonnage 't'?
Additional table information: table: battle_death

Answer: SELECT T1.killed, T1.injured FROM death AS T1 JOIN ship AS t2 ON T1.caused_by_ship_id = T2.id WHERE T2.tonnage = 't'


Question:
What are the name and results of the battles when the bulgarian commander is not 'Boril'
Additional table information: table: battle_death

Answer: SELECT name, RESULT FROM battle WHERE bulgarian_commander <> 'Boril'


Question:
What are the different ids and names of the battles that lost any 'Brig' type shipes?
Additional table information: table: battle_death

Answer: SELECT DISTINCT T1.id, T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'


Question:
What are the ids and names of the battles that led to more than 10 people killed in total.
Additional table information: table: battle_death

Answer: SELECT T1.id, T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle JOIN death AS T3 ON T2.id = T3.caused_by_ship_id GROUP BY T1.id HAVING SUM(T3.killed) > 10


Question:
What is the ship id and name that caused most total injuries?
Additional table information: table: battle_death

Answer: SELECT T2.id, T2.name FROM death AS T1 JOIN ship AS t2 ON T1.caused_by_ship_id = T2.id GROUP BY T2.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the distinct battle names which are between bulgarian commander 'Kaloyan' and latin commander 'Baldwin I'?
Additional table information: table: battle_death

Answer: SELECT name FROM battle WHERE bulgarian_commander = 'Kaloyan' AND latin_commander = 'Baldwin I'


Question:
How many different results are there for the battles?
Additional table information: table: battle_death

Answer: SELECT COUNT(DISTINCT RESULT) FROM battle


Question:
How many battles did not lose any ship with tonnage '225'?
Additional table information: table: battle_death

Answer: SELECT COUNT(*) FROM battle WHERE NOT id IN (SELECT lost_in_battle FROM ship WHERE tonnage = '225')


Question:
List the name and date the battle that has lost the ship named 'Lettice' and the ship named 'HMS Atalanta'
Additional table information: table: battle_death

Answer: SELECT T1.name, T1.date FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.name = 'Lettice' INTERSECT SELECT T1.name, T1.date FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.name = 'HMS Atalanta'


Question:
Show names, results and bulgarian commanders of the battles with no ships lost in the 'English Channel'.
Additional table information: table: battle_death

Answer: SELECT name, RESULT, bulgarian_commander FROM battle EXCEPT SELECT T1.name, T1.result, T1.bulgarian_commander FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.location = 'English Channel'


Question:
What are the notes of the death events which has substring 'East'?
Additional table information: table: battle_death

Answer: SELECT note FROM death WHERE note LIKE '%East%'


Question:
what are all the addresses including line 1 and line 2?
Additional table information: table: student_transcripts_tracking

Answer: SELECT line_1, line_2 FROM addresses


Question:
What is the first and second line for all addresses?
Additional table information: table: student_transcripts_tracking

Answer: SELECT line_1, line_2 FROM addresses


Question:
How many courses in total are listed?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*) FROM Courses


Question:
How many courses are there?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*) FROM Courses


Question:
How is the math course described?
Additional table information: table: student_transcripts_tracking

Answer: SELECT course_description FROM Courses WHERE course_name = 'math'


Question:
What are the descriptions for all the math courses?
Additional table information: table: student_transcripts_tracking

Answer: SELECT course_description FROM Courses WHERE course_name = 'math'


Question:
What is the zip code of the address in the city Port Chelsea?
Additional table information: table: student_transcripts_tracking

Answer: SELECT zip_postcode FROM Addresses WHERE city = 'Port Chelsea'


Question:
What is the zip code for Port Chelsea?
Additional table information: table: student_transcripts_tracking

Answer: SELECT zip_postcode FROM Addresses WHERE city = 'Port Chelsea'


Question:
Which department offers the most number of degrees? List department name and id.
Additional table information: table: student_transcripts_tracking

Answer: SELECT T2.department_name, T1.department_id FROM Degree_Programs AS T1 JOIN Departments AS T2 ON T1.department_id = T2.department_id GROUP BY T1.department_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name and id of the department with the most number of degrees ?
Additional table information: table: student_transcripts_tracking

Answer: SELECT t2.department_name, t1.department_id FROM degree_programs AS t1 JOIN departments AS t2 ON t1.department_id = t2.department_id GROUP BY t1.department_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many departments offer any degree?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(DISTINCT department_id) FROM Degree_Programs


Question:
How many different departments offer degrees?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(DISTINCT department_id) FROM Degree_Programs


Question:
How many different degree names are offered?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(DISTINCT degree_summary_name) FROM Degree_Programs


Question:
How many different degrees are offered?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(DISTINCT degree_summary_name) FROM Degree_Programs


Question:
How many degrees does the engineering department offer?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*) FROM Departments AS T1 JOIN Degree_Programs AS T2 ON T1.department_id = T2.department_id WHERE T1.department_name = 'engineer'


Question:
How many degrees does the engineering department have?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*) FROM Departments AS T1 JOIN Degree_Programs AS T2 ON T1.department_id = T2.department_id WHERE T1.department_name = 'engineer'


Question:
What are the names and descriptions of all the sections?
Additional table information: table: student_transcripts_tracking

Answer: SELECT section_name, section_description FROM Sections


Question:
What are the names and descriptions for all the sections?
Additional table information: table: student_transcripts_tracking

Answer: SELECT section_name, section_description FROM Sections


Question:
What are the names and id of courses having at most 2 sections?
Additional table information: table: student_transcripts_tracking

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


Question:
What are the names and ids of every course with less than 2 sections?
Additional table information: table: student_transcripts_tracking

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


Question:
List the section_name in reversed lexicographical order.
Additional table information: table: student_transcripts_tracking

Answer: SELECT section_name FROM Sections ORDER BY section_name DESC


Question:
What are the names of the sections in reverse alphabetical order?
Additional table information: table: student_transcripts_tracking

Answer: SELECT section_name FROM Sections ORDER BY section_name DESC


Question:
What is the semester which most student registered in? Show both the name and the id.
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.semester_name, T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each semester, what is the name and id of the one with the most students registered?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.semester_name, T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the description of the department whose name has the substring the computer?
Additional table information: table: student_transcripts_tracking

Answer: SELECT department_description FROM Departments WHERE department_name LIKE '%computer%'


Question:
What is the department description for the one whose name has the word computer?
Additional table information: table: student_transcripts_tracking

Answer: SELECT department_description FROM Departments WHERE department_name LIKE '%computer%'


Question:
Who are enrolled in 2 degree programs in one semester? List the first name, middle name and last name and the id.
Additional table information: table: student_transcripts_tracking

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


Question:
What are the first, middle, and last names, along with the ids, of all students who enrolled in 2 degree programs in one semester?
Additional table information: table: student_transcripts_tracking

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


Question:
Who is enrolled in a Bachelor degree program? List the first name, middle name, last name.
Additional table information: table: student_transcripts_tracking

Answer: SELECT DISTINCT T1.first_name, T1.middle_name, T1.last_name FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id JOIN Degree_Programs AS T3 ON T2.degree_program_id = T3.degree_program_id WHERE T3.degree_summary_name = 'Bachelor'


Question:
What are the first, middle, and last names for everybody enrolled in a Bachelors program?
Additional table information: table: student_transcripts_tracking

Answer: SELECT DISTINCT T1.first_name, T1.middle_name, T1.last_name FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id JOIN Degree_Programs AS T3 ON T2.degree_program_id = T3.degree_program_id WHERE T3.degree_summary_name = 'Bachelor'


Question:
Find the kind of program which most number of students are enrolled in?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.degree_summary_name FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id GROUP BY T1.degree_summary_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the degree summary name that has the most number of students enrolled?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.degree_summary_name FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id GROUP BY T1.degree_summary_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the program which most number of students are enrolled in. List both the id and the summary.
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.degree_program_id, T1.degree_summary_name FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id GROUP BY T1.degree_program_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the program id and the summary of the degree that has the most students enrolled?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.degree_program_id, T1.degree_summary_name FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id GROUP BY T1.degree_program_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which student has enrolled for the most times in any program? List the id, first name, middle name, last name, the number of enrollments and student id.
Additional table information: table: student_transcripts_tracking

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


Question:
What is the first, middle, and last name, along with the id and number of enrollments, for the student who enrolled the most in any program?
Additional table information: table: student_transcripts_tracking

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


Question:
Which semesters do not have any student enrolled? List the semester name.
Additional table information: table: student_transcripts_tracking

Answer: SELECT semester_name FROM Semesters WHERE NOT semester_id IN (SELECT semester_id FROM Student_Enrolment)


Question:
What is the name of the semester with no students enrolled?
Additional table information: table: student_transcripts_tracking

Answer: SELECT semester_name FROM Semesters WHERE NOT semester_id IN (SELECT semester_id FROM Student_Enrolment)


Question:
What are all the course names of the courses which ever have students enrolled in?
Additional table information: table: student_transcripts_tracking

Answer: SELECT DISTINCT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id


Question:
What are the names of all courses that have some students enrolled?
Additional table information: table: student_transcripts_tracking

Answer: SELECT DISTINCT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id


Question:
What's the name of the course with most number of enrollments?
Additional table information: table: student_transcripts_tracking

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


Question:
What is the name of the course with the most students enrolled?
Additional table information: table: student_transcripts_tracking

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


Question:
Find the last name of the students who currently live in the state of North Carolina but have not registered in any degree program.
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.last_name FROM Students AS T1 JOIN Addresses AS T2 ON T1.current_address_id = T2.address_id WHERE T2.state_province_county = 'NorthCarolina' EXCEPT SELECT DISTINCT T3.last_name FROM Students AS T3 JOIN Student_Enrolment AS T4 ON T3.student_id = T4.student_id


Question:
What are the last name of the students who live in North Carolina but have not registered in any degree programs?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.last_name FROM Students AS T1 JOIN Addresses AS T2 ON T1.current_address_id = T2.address_id WHERE T2.state_province_county = 'NorthCarolina' EXCEPT SELECT DISTINCT T3.last_name FROM Students AS T3 JOIN Student_Enrolment AS T4 ON T3.student_id = T4.student_id


Question:
Show the date and id of the transcript with at least 2 course results.
Additional table information: table: student_transcripts_tracking

Answer: SELECT T2.transcript_date, T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id = T2.transcript_id GROUP BY T1.transcript_id HAVING COUNT(*) >= 2


Question:
What is the date and id of the transcript with at least 2 courses listed?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T2.transcript_date, T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id = T2.transcript_id GROUP BY T1.transcript_id HAVING COUNT(*) >= 2


Question:
What is the phone number of the man with the first name Timmothy and the last name Ward?
Additional table information: table: student_transcripts_tracking

Answer: SELECT cell_mobile_number FROM Students WHERE first_name = 'Timmothy' AND last_name = 'Ward'


Question:
What is the mobile phone number of the student named Timmothy Ward ?
Additional table information: table: student_transcripts_tracking

Answer: SELECT cell_mobile_number FROM students WHERE first_name = 'timmothy' AND last_name = 'ward'


Question:
Who is the first student to register? List the first name, middle name and last name.
Additional table information: table: student_transcripts_tracking

Answer: SELECT first_name, middle_name, last_name FROM Students ORDER BY date_first_registered ASC NULLS FIRST LIMIT 1


Question:
What is the first, middle, and last name of the first student to register?
Additional table information: table: student_transcripts_tracking

Answer: SELECT first_name, middle_name, last_name FROM Students ORDER BY date_first_registered ASC NULLS FIRST LIMIT 1


Question:
Who is the earliest graduate of the school? List the first name, middle name and last name.
Additional table information: table: student_transcripts_tracking

Answer: SELECT first_name, middle_name, last_name FROM Students ORDER BY date_left ASC NULLS FIRST LIMIT 1


Question:
What is the first, middle, and last name of the earliest school graduate?
Additional table information: table: student_transcripts_tracking

Answer: SELECT first_name, middle_name, last_name FROM Students ORDER BY date_left ASC NULLS FIRST LIMIT 1


Question:
Whose permanent address is different from his or her current address? List his or her first name.
Additional table information: table: student_transcripts_tracking

Answer: SELECT first_name FROM Students WHERE current_address_id <> permanent_address_id


Question:
What is the first name of the student whose permanent address is different from his or her current one?
Additional table information: table: student_transcripts_tracking

Answer: SELECT first_name FROM Students WHERE current_address_id <> permanent_address_id


Question:
Which address holds the most number of students currently? List the address id and all lines.
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.address_id, T1.line_1, T1.line_2 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.current_address_id GROUP BY T1.address_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the id, line 1, and line 2 of the address with the most students?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T1.address_id, T1.line_1, T1.line_2 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.current_address_id GROUP BY T1.address_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
On average, when were the transcripts printed?
Additional table information: table: student_transcripts_tracking

Answer: SELECT AVG(transcript_date) FROM Transcripts


Question:
What is the average transcript date?
Additional table information: table: student_transcripts_tracking

Answer: SELECT AVG(transcript_date) FROM Transcripts


Question:
When is the first transcript released? List the date and details.
Additional table information: table: student_transcripts_tracking

Answer: SELECT transcript_date, other_details FROM Transcripts ORDER BY transcript_date ASC NULLS FIRST LIMIT 1


Question:
What is the earliest date of a transcript release, and what details can you tell me?
Additional table information: table: student_transcripts_tracking

Answer: SELECT transcript_date, other_details FROM Transcripts ORDER BY transcript_date ASC NULLS FIRST LIMIT 1


Question:
How many transcripts are released?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*) FROM Transcripts


Question:
How many transcripts are listed?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*) FROM Transcripts


Question:
What is the last transcript release date?
Additional table information: table: student_transcripts_tracking

Answer: SELECT transcript_date FROM Transcripts ORDER BY transcript_date DESC LIMIT 1


Question:
When was the last transcript released?
Additional table information: table: student_transcripts_tracking

Answer: SELECT transcript_date FROM Transcripts ORDER BY transcript_date DESC LIMIT 1


Question:
How many times at most can a course enrollment result show in different transcripts? Also show the course enrollment id.
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*), student_course_id FROM Transcript_Contents GROUP BY student_course_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the maximum number of times that a course shows up in different transcripts and what is that course's enrollment id?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*), student_course_id FROM Transcript_Contents GROUP BY student_course_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the date of the transcript which shows the least number of results, also list the id.
Additional table information: table: student_transcripts_tracking

Answer: SELECT T2.transcript_date, T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id = T2.transcript_id GROUP BY T1.transcript_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What is the date and id of the transcript with the least number of results?
Additional table information: table: student_transcripts_tracking

Answer: SELECT T2.transcript_date, T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id = T2.transcript_id GROUP BY T1.transcript_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Find the semester when both Master students and Bachelor students got enrolled in.
Additional table information: table: student_transcripts_tracking

Answer: SELECT DISTINCT T2.semester_id FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id WHERE degree_summary_name = 'Master' INTERSECT SELECT DISTINCT T2.semester_id FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id WHERE degree_summary_name = 'Bachelor'


Question:
What is the id of the semester that had both Masters and Bachelors students enrolled?
Additional table information: table: student_transcripts_tracking

Answer: SELECT DISTINCT T2.semester_id FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id WHERE degree_summary_name = 'Master' INTERSECT SELECT DISTINCT T2.semester_id FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id WHERE degree_summary_name = 'Bachelor'


Question:
How many different addresses do the students currently live?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(DISTINCT current_address_id) FROM Students


Question:
What are the different addresses that have students living there?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(DISTINCT current_address_id) FROM Students


Question:
List all the student details in reversed lexicographical order.
Additional table information: table: student_transcripts_tracking

Answer: SELECT other_student_details FROM Students ORDER BY other_student_details DESC


Question:
What other details can you tell me about students in reverse alphabetical order?
Additional table information: table: student_transcripts_tracking

Answer: SELECT other_student_details FROM Students ORDER BY other_student_details DESC


Question:
Describe the section h.
Additional table information: table: student_transcripts_tracking

Answer: SELECT section_description FROM Sections WHERE section_name = 'h'


Question:
What is the description for the section named h?
Additional table information: table: student_transcripts_tracking

Answer: SELECT section_description FROM Sections WHERE section_name = 'h'


Question:
Find the first name of the students who permanently live in the country Haiti or have the cell phone number 09700166582 .
Additional table information: table: student_transcripts_tracking

Answer: SELECT t1.first_name FROM students AS t1 JOIN addresses AS t2 ON t1.permanent_address_id = t2.address_id WHERE t2.country = 'haiti' OR t1.cell_mobile_number = '09700166582'


Question:
What are the first names of the students who live in Haiti permanently or have the cell phone number 09700166582 ?
Additional table information: table: student_transcripts_tracking

Answer: SELECT t1.first_name FROM students AS t1 JOIN addresses AS t2 ON t1.permanent_address_id = t2.address_id WHERE t2.country = 'haiti' OR t1.cell_mobile_number = '09700166582'


Question:
List the title of all cartoons in alphabetical order.
Additional table information: table: tvshow

Answer: SELECT Title FROM Cartoon ORDER BY title NULLS FIRST


Question:
What are the titles of the cartoons sorted alphabetically?
Additional table information: table: tvshow

Answer: SELECT Title FROM Cartoon ORDER BY title NULLS FIRST


Question:
List all cartoon directed by 'Ben Jones'.
Additional table information: table: tvshow

Answer: SELECT Title FROM Cartoon WHERE Directed_by = 'Ben Jones'


Question:
What are the names of all cartoons directed by Ben Jones?
Additional table information: table: tvshow

Answer: SELECT Title FROM Cartoon WHERE Directed_by = 'Ben Jones'


Question:
How many cartoons were written by 'Joseph Kuhr'?
Additional table information: table: tvshow

Answer: SELECT COUNT(*) FROM Cartoon WHERE Written_by = 'Joseph Kuhr'


Question:
What is the number of cartoones written by Joseph Kuhr?
Additional table information: table: tvshow

Answer: SELECT COUNT(*) FROM Cartoon WHERE Written_by = 'Joseph Kuhr'


Question:
list all cartoon titles and their directors ordered by their air date
Additional table information: table: tvshow

Answer: SELECT title, Directed_by FROM Cartoon ORDER BY Original_air_date NULLS FIRST


Question:
What is the name and directors of all the cartoons that are ordered by air date?
Additional table information: table: tvshow

Answer: SELECT title, Directed_by FROM Cartoon ORDER BY Original_air_date NULLS FIRST


Question:
List the title of all cartoon directed by 'Ben Jones' or 'Brandon Vietti'.
Additional table information: table: tvshow

Answer: SELECT Title FROM Cartoon WHERE Directed_by = 'Ben Jones' OR Directed_by = 'Brandon Vietti'


Question:
What are the titles of all cartoons directed by Ben Jones or Brandon Vietti?
Additional table information: table: tvshow

Answer: SELECT Title FROM Cartoon WHERE Directed_by = 'Ben Jones' OR Directed_by = 'Brandon Vietti'


Question:
Which country has the most of TV Channels? List the country and number of TV Channels it has.
Additional table information: table: tvshow

Answer: SELECT Country, COUNT(*) FROM TV_Channel GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the country with the most number of TV Channels and how many does it have?
Additional table information: table: tvshow

Answer: SELECT Country, COUNT(*) FROM TV_Channel GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the number of different series names and contents in the TV Channel table.
Additional table information: table: tvshow

Answer: SELECT COUNT(DISTINCT series_name), COUNT(DISTINCT content) FROM TV_Channel


Question:
How many different series and contents are listed in the TV Channel table?
Additional table information: table: tvshow

Answer: SELECT COUNT(DISTINCT series_name), COUNT(DISTINCT content) FROM TV_Channel


Question:
What is the content of TV Channel with serial name 'Sky Radio'?
Additional table information: table: tvshow

Answer: SELECT Content FROM TV_Channel WHERE series_name = 'Sky Radio'


Question:
What is the content of the series Sky Radio?
Additional table information: table: tvshow

Answer: SELECT Content FROM TV_Channel WHERE series_name = 'Sky Radio'


Question:
What is the Package Option of TV Channel with serial name 'Sky Radio'?
Additional table information: table: tvshow

Answer: SELECT Package_Option FROM TV_Channel WHERE series_name = 'Sky Radio'


Question:
What are the Package Options of the TV Channels whose series names are Sky Radio?
Additional table information: table: tvshow

Answer: SELECT Package_Option FROM TV_Channel WHERE series_name = 'Sky Radio'


Question:
How many TV Channel using language English?
Additional table information: table: tvshow

Answer: SELECT COUNT(*) FROM TV_Channel WHERE LANGUAGE = 'English'


Question:
How many TV Channels use the English language?
Additional table information: table: tvshow

Answer: SELECT COUNT(*) FROM TV_Channel WHERE LANGUAGE = 'English'


Question:
List the language used least number of TV Channel. List language and number of TV Channel.
Additional table information: table: tvshow

Answer: SELECT LANGUAGE, COUNT(*) FROM TV_Channel GROUP BY LANGUAGE ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What are the languages used by the least number of TV Channels and how many channels use it?
Additional table information: table: tvshow

Answer: SELECT LANGUAGE, COUNT(*) FROM TV_Channel GROUP BY LANGUAGE ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
List each language and the number of TV Channels using it.
Additional table information: table: tvshow

Answer: SELECT LANGUAGE, COUNT(*) FROM TV_Channel GROUP BY LANGUAGE


Question:
For each language, list the number of TV Channels that use it.
Additional table information: table: tvshow

Answer: SELECT LANGUAGE, COUNT(*) FROM TV_Channel GROUP BY LANGUAGE


Question:
What is the TV Channel that shows the cartoon 'The Rise of the Blue Beetle!'? List the TV Channel's series name.
Additional table information: table: tvshow

Answer: SELECT T1.series_name FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Title = 'The Rise of the Blue Beetle!'


Question:
What is the series name of the TV Channel that shows the cartoon 'The Rise of the Blue Beetle'?
Additional table information: table: tvshow

Answer: SELECT T1.series_name FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Title = 'The Rise of the Blue Beetle!'


Question:
List the title of all  Cartoons showed on TV Channel with series name 'Sky Radio'.
Additional table information: table: tvshow

Answer: SELECT T2.Title FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T1.series_name = 'Sky Radio'


Question:
What is the title of all the cartools that are on the TV Channel with the series name 'Sky Radio'?
Additional table information: table: tvshow

Answer: SELECT T2.Title FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T1.series_name = 'Sky Radio'


Question:
List the Episode of all TV series sorted by rating.
Additional table information: table: tvshow

Answer: SELECT Episode FROM TV_series ORDER BY rating NULLS FIRST


Question:
What are all of the episodes ordered by ratings?
Additional table information: table: tvshow

Answer: SELECT Episode FROM TV_series ORDER BY rating NULLS FIRST


Question:
List top 3 highest Rating  TV series. List the TV series's Episode and Rating.
Additional table information: table: tvshow

Answer: SELECT Episode, Rating FROM TV_series ORDER BY Rating DESC LIMIT 3


Question:
What are 3 most highly rated episodes in the TV series table and what were those ratings?
Additional table information: table: tvshow

Answer: SELECT Episode, Rating FROM TV_series ORDER BY Rating DESC LIMIT 3


Question:
What is minimum and maximum share of TV series?
Additional table information: table: tvshow

Answer: SELECT MAX(SHARE), MIN(SHARE) FROM TV_series


Question:
What is the maximum and minimum share for the TV series?
Additional table information: table: tvshow

Answer: SELECT MAX(SHARE), MIN(SHARE) FROM TV_series


Question:
What is the air date of TV series with Episode 'A Love of a Lifetime'?
Additional table information: table: tvshow

Answer: SELECT Air_Date FROM TV_series WHERE Episode = 'A Love of a Lifetime'


Question:
When did the episode 'A Love of a Lifetime' air?
Additional table information: table: tvshow

Answer: SELECT Air_Date FROM TV_series WHERE Episode = 'A Love of a Lifetime'


Question:
What is Weekly Rank of TV series with Episode 'A Love of a Lifetime'?
Additional table information: table: tvshow

Answer: SELECT Weekly_Rank FROM TV_series WHERE Episode = 'A Love of a Lifetime'


Question:
What is the weekly rank for the episode 'A Love of a Lifetime'?
Additional table information: table: tvshow

Answer: SELECT Weekly_Rank FROM TV_series WHERE Episode = 'A Love of a Lifetime'


Question:
What is the TV Channel of TV series with Episode 'A Love of a Lifetime'? List the TV Channel's series name.
Additional table information: table: tvshow

Answer: SELECT T1.series_name FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T1.id = T2.Channel WHERE T2.Episode = 'A Love of a Lifetime'


Question:
What is the name of the series that has the episode 'A Love of a Lifetime'?
Additional table information: table: tvshow

Answer: SELECT T1.series_name FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T1.id = T2.Channel WHERE T2.Episode = 'A Love of a Lifetime'


Question:
List the Episode of all  TV series showed on TV Channel with series name 'Sky Radio'.
Additional table information: table: tvshow

Answer: SELECT T2.Episode FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T1.id = T2.Channel WHERE T1.series_name = 'Sky Radio'


Question:
What is the episode for the TV series named 'Sky Radio'?
Additional table information: table: tvshow

Answer: SELECT T2.Episode FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T1.id = T2.Channel WHERE T1.series_name = 'Sky Radio'


Question:
Find the number of cartoons directed by each of the listed directors.
Additional table information: table: tvshow

Answer: SELECT COUNT(*), Directed_by FROM cartoon GROUP BY Directed_by


Question:
How many cartoons did each director create?
Additional table information: table: tvshow

Answer: SELECT COUNT(*), Directed_by FROM cartoon GROUP BY Directed_by


Question:
Find the production code and channel of the most recently aired cartoon .
Additional table information: table: tvshow

Answer: SELECT production_code, channel FROM cartoon ORDER BY original_air_date DESC LIMIT 1


Question:
What is the produdction code and channel of the most recent cartoon ?
Additional table information: table: tvshow

Answer: SELECT production_code, channel FROM cartoon ORDER BY original_air_date DESC LIMIT 1


Question:
Find the package choice and series name of the TV channel that has high definition TV.
Additional table information: table: tvshow

Answer: SELECT package_option, series_name FROM TV_Channel WHERE hight_definition_TV = 'yes'


Question:
What are the package options and the name of the series for the TV Channel that supports high definition TV?
Additional table information: table: tvshow

Answer: SELECT package_option, series_name FROM TV_Channel WHERE hight_definition_TV = 'yes'


Question:
which countries' tv channels are playing some cartoon written by Todd Casey?
Additional table information: table: tvshow

Answer: SELECT T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.written_by = 'Todd Casey'


Question:
What are the countries that have cartoons on TV that were written by Todd Casey?
Additional table information: table: tvshow

Answer: SELECT T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.written_by = 'Todd Casey'


Question:
which countries' tv channels are not playing any cartoon written by Todd Casey?
Additional table information: table: tvshow

Answer: SELECT country FROM TV_Channel EXCEPT SELECT T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.written_by = 'Todd Casey'


Question:
What are the countries that are not playing cartoons written by Todd Casey?
Additional table information: table: tvshow

Answer: SELECT country FROM TV_Channel EXCEPT SELECT T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.written_by = 'Todd Casey'


Question:
Find the series name and country of the tv channel that is playing some cartoons directed by Ben Jones and Michael Chang?
Additional table information: table: tvshow

Answer: SELECT T1.series_name, T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Michael Chang' INTERSECT SELECT T1.series_name, T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Ben Jones'


Question:
What is the series name and country of all TV channels that are playing cartoons directed by Ben Jones and cartoons directed by Michael Chang?
Additional table information: table: tvshow

Answer: SELECT T1.series_name, T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Michael Chang' INTERSECT SELECT T1.series_name, T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Ben Jones'


Question:
find the pixel aspect ratio and nation of the tv channels that do not use English.
Additional table information: table: tvshow

Answer: SELECT Pixel_aspect_ratio_PAR, country FROM tv_channel WHERE LANGUAGE <> 'English'


Question:
What is the pixel aspect ratio and country of origin for all TV channels that do not use English?
Additional table information: table: tvshow

Answer: SELECT Pixel_aspect_ratio_PAR, country FROM tv_channel WHERE LANGUAGE <> 'English'


Question:
find id of the tv channels that from the countries where have more than two tv channels.
Additional table information: table: tvshow

Answer: SELECT id FROM tv_channel GROUP BY country HAVING COUNT(*) > 2


Question:
What are the ids of all tv channels that have more than 2 TV channels?
Additional table information: table: tvshow

Answer: SELECT id FROM tv_channel GROUP BY country HAVING COUNT(*) > 2


Question:
find the id of tv channels that do not play any cartoon directed by Ben Jones.
Additional table information: table: tvshow

Answer: SELECT id FROM TV_Channel EXCEPT SELECT channel FROM cartoon WHERE directed_by = 'Ben Jones'


Question:
What are the ids of the TV channels that do not have any cartoons directed by Ben Jones?
Additional table information: table: tvshow

Answer: SELECT id FROM TV_Channel EXCEPT SELECT channel FROM cartoon WHERE directed_by = 'Ben Jones'


Question:
find the package option of the tv channel that do not have any cartoon directed by Ben Jones.
Additional table information: table: tvshow

Answer: SELECT package_option FROM TV_Channel WHERE NOT id IN (SELECT channel FROM cartoon WHERE directed_by = 'Ben Jones')


Question:
What are the package options of all tv channels that are not playing any cartoons directed by Ben Jones?
Additional table information: table: tvshow

Answer: SELECT package_option FROM TV_Channel WHERE NOT id IN (SELECT channel FROM cartoon WHERE directed_by = 'Ben Jones')


Question:
How many poker players are there?
Additional table information: table: poker_player

Answer: SELECT COUNT(*) FROM poker_player


Question:
Count the number of poker players.
Additional table information: table: poker_player

Answer: SELECT COUNT(*) FROM poker_player


Question:
List the earnings of poker players in descending order.
Additional table information: table: poker_player

Answer: SELECT Earnings FROM poker_player ORDER BY Earnings DESC


Question:
What are the earnings of poker players, ordered descending by value?
Additional table information: table: poker_player

Answer: SELECT Earnings FROM poker_player ORDER BY Earnings DESC


Question:
List the final tables made and the best finishes of poker players.
Additional table information: table: poker_player

Answer: SELECT Final_Table_Made, Best_Finish FROM poker_player


Question:
What are the final tables made and best finishes for all poker players?
Additional table information: table: poker_player

Answer: SELECT Final_Table_Made, Best_Finish FROM poker_player


Question:
What is the average earnings of poker players?
Additional table information: table: poker_player

Answer: SELECT AVG(Earnings) FROM poker_player


Question:
Return the average earnings across all poker players.
Additional table information: table: poker_player

Answer: SELECT AVG(Earnings) FROM poker_player


Question:
What is the money rank of the poker player with the highest earnings?
Additional table information: table: poker_player

Answer: SELECT Money_Rank FROM poker_player ORDER BY Earnings DESC LIMIT 1


Question:
Return the money rank of the player with the greatest earnings.
Additional table information: table: poker_player

Answer: SELECT Money_Rank FROM poker_player ORDER BY Earnings DESC LIMIT 1


Question:
What is the maximum number of final tables made among poker players with earnings less than 200000?
Additional table information: table: poker_player

Answer: SELECT MAX(Final_Table_Made) FROM poker_player WHERE Earnings < 200000


Question:
Return the maximum final tables made across all poker players who have earnings below 200000.
Additional table information: table: poker_player

Answer: SELECT MAX(Final_Table_Made) FROM poker_player WHERE Earnings < 200000


Question:
What are the names of poker players?
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID


Question:
Return the names of all the poker players.
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID


Question:
What are the names of poker players whose earnings is higher than 300000?
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Earnings > 300000


Question:
Give the names of poker players who have earnings above 300000.
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Earnings > 300000


Question:
List the names of poker players ordered by the final tables made in ascending order.
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Final_Table_Made NULLS FIRST


Question:
What are the names of poker players, ordered ascending by the number of final tables they have made?
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Final_Table_Made NULLS FIRST


Question:
What is the birth date of the poker player with the lowest earnings?
Additional table information: table: poker_player

Answer: SELECT T1.Birth_Date FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Earnings ASC NULLS FIRST LIMIT 1


Question:
Return the birth date of the poker player with the lowest earnings.
Additional table information: table: poker_player

Answer: SELECT T1.Birth_Date FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Earnings ASC NULLS FIRST LIMIT 1


Question:
What is the money rank of the tallest poker player?
Additional table information: table: poker_player

Answer: SELECT T2.Money_Rank FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1


Question:
Return the money rank of the poker player with the greatest height.
Additional table information: table: poker_player

Answer: SELECT T2.Money_Rank FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1


Question:
What is the average earnings of poker players with height higher than 200?
Additional table information: table: poker_player

Answer: SELECT AVG(T2.Earnings) FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 200


Question:
Give average earnings of poker players who are taller than 200.
Additional table information: table: poker_player

Answer: SELECT AVG(T2.Earnings) FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 200


Question:
What are the names of poker players in descending order of earnings?
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Earnings DESC


Question:
Return the names of poker players sorted by their earnings descending.
Additional table information: table: poker_player

Answer: SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Earnings DESC


Question:
What are different nationalities of people and the corresponding number of people from each nation?
Additional table information: table: poker_player

Answer: SELECT Nationality, COUNT(*) FROM people GROUP BY Nationality


Question:
How many people are there of each nationality?
Additional table information: table: poker_player

Answer: SELECT Nationality, COUNT(*) FROM people GROUP BY Nationality


Question:
What is the most common nationality of people?
Additional table information: table: poker_player

Answer: SELECT Nationality FROM people GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the nationality that is most common across all people.
Additional table information: table: poker_player

Answer: SELECT Nationality FROM people GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the nationalities that are shared by at least two people?
Additional table information: table: poker_player

Answer: SELECT Nationality FROM people GROUP BY Nationality HAVING COUNT(*) >= 2


Question:
Return the nationalities for which there are two or more people.
Additional table information: table: poker_player

Answer: SELECT Nationality FROM people GROUP BY Nationality HAVING COUNT(*) >= 2


Question:
List the names and birth dates of people in ascending alphabetical order of name.
Additional table information: table: poker_player

Answer: SELECT Name, Birth_Date FROM people ORDER BY Name ASC NULLS FIRST


Question:
What are the names and birth dates of people, ordered by their names in alphabetical order?
Additional table information: table: poker_player

Answer: SELECT Name, Birth_Date FROM people ORDER BY Name ASC NULLS FIRST


Question:
Show names of people whose nationality is not 'Russia'.
Additional table information: table: poker_player

Answer: SELECT Name FROM people WHERE Nationality <> 'Russia'


Question:
What are the names of people who are not from Russia?
Additional table information: table: poker_player

Answer: SELECT Name FROM people WHERE Nationality <> 'Russia'


Question:
List the names of people that are not poker players.
Additional table information: table: poker_player

Answer: SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM poker_player)


Question:
What are the names of people who do not play poker?
Additional table information: table: poker_player

Answer: SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM poker_player)


Question:
How many distinct nationalities are there?
Additional table information: table: poker_player

Answer: SELECT COUNT(DISTINCT Nationality) FROM people


Question:
Count the number of different nationalities.
Additional table information: table: poker_player

Answer: SELECT COUNT(DISTINCT Nationality) FROM people


Question:
How many states are there?
Additional table information: table: voter_1

Answer: SELECT COUNT(*) FROM area_code_state


Question:
List the contestant numbers and names, ordered by contestant name descending.
Additional table information: table: voter_1

Answer: SELECT contestant_number, contestant_name FROM contestants ORDER BY contestant_name DESC


Question:
List the vote ids, phone numbers and states of all votes.
Additional table information: table: voter_1

Answer: SELECT vote_id, phone_number, state FROM votes


Question:
What are the maximum and minimum values of area codes?
Additional table information: table: voter_1

Answer: SELECT MAX(area_code), MIN(area_code) FROM area_code_state


Question:
What is last date created of votes from the state 'CA'?
Additional table information: table: voter_1

Answer: SELECT MAX(created) FROM votes WHERE state = 'CA'


Question:
What are the names of the contestants whose names are not 'Jessie Alloway'
Additional table information: table: voter_1

Answer: SELECT contestant_name FROM contestants WHERE contestant_name <> 'Jessie Alloway'


Question:
What are the distinct states and create time of all votes?
Additional table information: table: voter_1

Answer: SELECT DISTINCT state, created FROM votes


Question:
What are the contestant numbers and names of the contestants who had at least two votes?
Additional table information: table: voter_1

Answer: SELECT T1.contestant_number, T1.contestant_name FROM contestants AS T1 JOIN votes AS T2 ON T1.contestant_number = T2.contestant_number GROUP BY T1.contestant_number HAVING COUNT(*) >= 2


Question:
Of all the contestants who got voted, what is the contestant number and name of the contestant who got least votes?
Additional table information: table: voter_1

Answer: SELECT T1.contestant_number, T1.contestant_name FROM contestants AS T1 JOIN votes AS T2 ON T1.contestant_number = T2.contestant_number GROUP BY T1.contestant_number ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What are the number of votes from state 'NY' or 'CA'?
Additional table information: table: voter_1

Answer: SELECT COUNT(*) FROM votes WHERE state = 'NY' OR state = 'CA'


Question:
How many contestants did not get voted?
Additional table information: table: voter_1

Answer: SELECT COUNT(*) FROM contestants WHERE NOT contestant_number IN (SELECT contestant_number FROM votes)


Question:
What is the area code in which the most voters voted?
Additional table information: table: voter_1

Answer: SELECT T1.area_code FROM area_code_state AS T1 JOIN votes AS T2 ON T1.state = T2.state GROUP BY T1.area_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the create dates, states, and phone numbers of the votes that were for the contestant named 'Tabatha Gehling'?
Additional table information: table: voter_1

Answer: SELECT T2.created, T2.state, T2.phone_number FROM contestants AS T1 JOIN votes AS T2 ON T1.contestant_number = T2.contestant_number WHERE T1.contestant_name = 'Tabatha Gehling'


Question:
List the area codes in which voters voted both for the contestant 'Tabatha Gehling' and the contestant 'Kelly Clauss'.
Additional table information: table: voter_1

Answer: SELECT T3.area_code FROM contestants AS T1 JOIN votes AS T2 ON T1.contestant_number = T2.contestant_number JOIN area_code_state AS T3 ON T2.state = T3.state WHERE T1.contestant_name = 'Tabatha Gehling' INTERSECT SELECT T3.area_code FROM contestants AS T1 JOIN votes AS T2 ON T1.contestant_number = T2.contestant_number JOIN area_code_state AS T3 ON T2.state = T3.state WHERE T1.contestant_name = 'Kelly Clauss'


Question:
Return the names of the contestants whose names contain the substring 'Al' .
Additional table information: table: voter_1

Answer: SELECT contestant_name FROM contestants WHERE contestant_name LIKE '%al%'


Question:
What are the names of all the countries that became independent after 1950?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE IndepYear > 1950


Question:
Give the names of the nations that were founded after 1950.
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE IndepYear > 1950


Question:
How many countries have a republic as their form of government?
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM country WHERE GovernmentForm = 'Republic'


Question:
How many countries have governments that are republics?
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM country WHERE GovernmentForm = 'Republic'


Question:
What is the total surface area of the countries in the Caribbean region?
Additional table information: table: world_1

Answer: SELECT SUM(SurfaceArea) FROM country WHERE Region = 'Caribbean'


Question:
How much surface area do the countires in the Carribean cover together?
Additional table information: table: world_1

Answer: SELECT SUM(SurfaceArea) FROM country WHERE Region = 'Caribbean'


Question:
Which continent is Anguilla in?
Additional table information: table: world_1

Answer: SELECT Continent FROM country WHERE Name = 'Anguilla'


Question:
What is the continent name which Anguilla belongs to?
Additional table information: table: world_1

Answer: SELECT Continent FROM country WHERE Name = 'Anguilla'


Question:
Which region is the city Kabul located in?
Additional table information: table: world_1

Answer: SELECT Region FROM country AS T1 JOIN city AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Kabul'


Question:
What region is Kabul in?
Additional table information: table: world_1

Answer: SELECT Region FROM country AS T1 JOIN city AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Kabul'


Question:
Which language is the most popular in Aruba?
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Aruba' ORDER BY Percentage DESC LIMIT 1


Question:
What language is predominantly spoken in Aruba?
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Aruba' ORDER BY Percentage DESC LIMIT 1


Question:
What are the population and life expectancies in Brazil?
Additional table information: table: world_1

Answer: SELECT Population, LifeExpectancy FROM country WHERE Name = 'Brazil'


Question:
Give me Brazil’s population and life expectancies.
Additional table information: table: world_1

Answer: SELECT Population, LifeExpectancy FROM country WHERE Name = 'Brazil'


Question:
What are the region and population of Angola?
Additional table information: table: world_1

Answer: SELECT Population, Region FROM country WHERE Name = 'Angola'


Question:
What region does Angola belong to and what is its population?
Additional table information: table: world_1

Answer: SELECT Population, Region FROM country WHERE Name = 'Angola'


Question:
What is the average expected life expectancy for countries in the region of Central Africa?
Additional table information: table: world_1

Answer: SELECT AVG(LifeExpectancy) FROM country WHERE Region = 'Central Africa'


Question:
How long is the people’s average life expectancy in Central Africa?
Additional table information: table: world_1

Answer: SELECT AVG(LifeExpectancy) FROM country WHERE Region = 'Central Africa'


Question:
What is the name of country that has the shortest life expectancy in Asia?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE Continent = 'Asia' ORDER BY LifeExpectancy NULLS FIRST LIMIT 1


Question:
Give the name of the country in Asia with the lowest life expectancy.
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE Continent = 'Asia' ORDER BY LifeExpectancy NULLS FIRST LIMIT 1


Question:
What is the total population and maximum GNP in Asia?
Additional table information: table: world_1

Answer: SELECT SUM(Population), MAX(GNP) FROM country WHERE Continent = 'Asia'


Question:
How many people live in Asia, and what is the largest GNP among them?
Additional table information: table: world_1

Answer: SELECT SUM(Population), MAX(GNP) FROM country WHERE Continent = 'Asia'


Question:
What is the average life expectancy in African countries that are republics?
Additional table information: table: world_1

Answer: SELECT AVG(LifeExpectancy) FROM country WHERE Continent = 'Africa' AND GovernmentForm = 'Republic'


Question:
Give the average life expectancy for countries in Africa which are republics?
Additional table information: table: world_1

Answer: SELECT AVG(LifeExpectancy) FROM country WHERE Continent = 'Africa' AND GovernmentForm = 'Republic'


Question:
What is the total surface area of the continents Asia and Europe?
Additional table information: table: world_1

Answer: SELECT SUM(SurfaceArea) FROM country WHERE Continent = 'Asia' OR Continent = 'Europe'


Question:
Give the total surface area covered by countries in Asia or Europe.
Additional table information: table: world_1

Answer: SELECT SUM(SurfaceArea) FROM country WHERE Continent = 'Asia' OR Continent = 'Europe'


Question:
How many people live in Gelderland district?
Additional table information: table: world_1

Answer: SELECT SUM(Population) FROM city WHERE District = 'Gelderland'


Question:
What is the total population of Gelderland district?
Additional table information: table: world_1

Answer: SELECT SUM(Population) FROM city WHERE District = 'Gelderland'


Question:
What is the average GNP and total population in all nations whose government is US territory?
Additional table information: table: world_1

Answer: SELECT AVG(GNP), SUM(population) FROM country WHERE GovernmentForm = 'US Territory'


Question:
Give the mean GNP and total population of nations which are considered US territory.
Additional table information: table: world_1

Answer: SELECT AVG(GNP), SUM(population) FROM country WHERE GovernmentForm = 'US Territory'


Question:
How many unique languages are spoken in the world?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT LANGUAGE) FROM countrylanguage


Question:
What is the number of distinct languages used around the world?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT LANGUAGE) FROM countrylanguage


Question:
How many type of governments are in Africa?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT GovernmentForm) FROM country WHERE Continent = 'Africa'


Question:
How many different forms of governments are there in Africa?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT GovernmentForm) FROM country WHERE Continent = 'Africa'


Question:
What is the total number of languages used in Aruba?
Additional table information: table: world_1

Answer: SELECT COUNT(T2.Language) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Aruba'


Question:
How many languages are spoken in Aruba?
Additional table information: table: world_1

Answer: SELECT COUNT(T2.Language) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Aruba'


Question:
How many official languages does Afghanistan have?
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Afghanistan' AND IsOfficial = 'T'


Question:
How many official languages are spoken in Afghanistan?
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Afghanistan' AND IsOfficial = 'T'


Question:
What is name of the country that speaks the largest number of languages?
Additional table information: table: world_1

Answer: SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the name of the nation that uses the greatest amount of languages.
Additional table information: table: world_1

Answer: SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which continent has the most diverse languages?
Additional table information: table: world_1

Answer: SELECT T1.Continent FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Continent ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which continent speaks the most languages?
Additional table information: table: world_1

Answer: SELECT T1.Continent FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Continent ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many countries speak both English and Dutch?
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' INTERSECT SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Dutch')


Question:
What is the number of nations that use English and Dutch?
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' INTERSECT SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Dutch')


Question:
What are the names of nations speak both English and French?
Additional table information: table: world_1

Answer: SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' INTERSECT SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'French'


Question:
Give the names of nations that speak both English and French.
Additional table information: table: world_1

Answer: SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' INTERSECT SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'French'


Question:
What are the names of nations where both English and French are official languages?
Additional table information: table: world_1

Answer: SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' INTERSECT SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'French' AND T2.IsOfficial = 'T'


Question:
Give the names of countries with English and French as official languages.
Additional table information: table: world_1

Answer: SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' INTERSECT SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'French' AND T2.IsOfficial = 'T'


Question:
What is the number of distinct continents where Chinese is spoken?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT Continent) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Chinese'


Question:
How many continents speak Chinese?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT Continent) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Chinese'


Question:
What are the regions that use English or Dutch?
Additional table information: table: world_1

Answer: SELECT DISTINCT T1.Region FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' OR T2.Language = 'Dutch'


Question:
Which regions speak Dutch or English?
Additional table information: table: world_1

Answer: SELECT DISTINCT T1.Region FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' OR T2.Language = 'Dutch'


Question:
What are the countries where either English or Dutch is the official language ?
Additional table information: table: world_1

Answer: SELECT t1.name FROM country AS t1 JOIN countrylanguage AS t2 ON t1.code = t2.countrycode WHERE t2.language = 'english' AND isofficial = 't' UNION SELECT t1.name FROM country AS t1 JOIN countrylanguage AS t2 ON t1.code = t2.countrycode WHERE t2.language = 'dutch' AND isofficial = 't'


Question:
Which countries have either English or Dutch as an official language?
Additional table information: table: world_1

Answer: SELECT * FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND IsOfficial = 'T' UNION SELECT * FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Dutch' AND IsOfficial = 'T'


Question:
Which language is the most popular on the Asian continent?
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Asia' GROUP BY T2.Language ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the language that is used by the largest number of Asian nations?
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Asia' GROUP BY T2.Language ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which languages are spoken by only one country in republic governments?
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.GovernmentForm = 'Republic' GROUP BY T2.Language HAVING COUNT(*) = 1


Question:
What languages are only used by a single country with a republic government?
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.GovernmentForm = 'Republic' GROUP BY T2.Language HAVING COUNT(*) = 1


Question:
Find the city with the largest population that uses English.
Additional table information: table: world_1

Answer: SELECT T1.Name, T1.Population FROM city AS T1 JOIN countrylanguage AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Language = 'English' ORDER BY T1.Population DESC LIMIT 1


Question:
What is the most populace city that speaks English?
Additional table information: table: world_1

Answer: SELECT T1.Name, T1.Population FROM city AS T1 JOIN countrylanguage AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Language = 'English' ORDER BY T1.Population DESC LIMIT 1


Question:
Find the name, population and expected life length of asian country with the largest area?
Additional table information: table: world_1

Answer: SELECT Name, Population, LifeExpectancy FROM country WHERE Continent = 'Asia' ORDER BY SurfaceArea DESC LIMIT 1


Question:
What are the name, population, and life expectancy of the largest Asian country by land?
Additional table information: table: world_1

Answer: SELECT Name, Population, LifeExpectancy FROM country WHERE Continent = 'Asia' ORDER BY SurfaceArea DESC LIMIT 1


Question:
What is average life expectancy in the countries where English is not the official language?
Additional table information: table: world_1

Answer: SELECT AVG(LifeExpectancy) FROM country WHERE NOT Name IN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T')


Question:
Give the mean life expectancy of countries in which English is not the official language.
Additional table information: table: world_1

Answer: SELECT AVG(LifeExpectancy) FROM country WHERE NOT Name IN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T')


Question:
What is the total number of people living in the nations that do not use English?
Additional table information: table: world_1

Answer: SELECT SUM(Population) FROM country WHERE NOT Name IN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English')


Question:
How many people live in countries that do not speak English?
Additional table information: table: world_1

Answer: SELECT SUM(Population) FROM country WHERE NOT Name IN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English')


Question:
What is the official language spoken in the country whose head of state is Beatrix?
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.HeadOfState = 'Beatrix' AND T2.IsOfficial = 'T'


Question:
What is the official language used in the country the name of whose head of state is Beatrix.
Additional table information: table: world_1

Answer: SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.HeadOfState = 'Beatrix' AND T2.IsOfficial = 'T'


Question:
What is the total number of unique official languages spoken in the countries that are founded before 1930?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT T2.Language) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE IndepYear < 1930 AND T2.IsOfficial = 'T'


Question:
For the countries founded before 1930, what is the total number of distinct official languages?
Additional table information: table: world_1

Answer: SELECT COUNT(DISTINCT T2.Language) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE IndepYear < 1930 AND T2.IsOfficial = 'T'


Question:
What are the countries that have greater surface area than any country in Europe?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE SurfaceArea > (SELECT MIN(SurfaceArea) FROM country WHERE Continent = 'Europe')


Question:
Which countries have greater area than that of any country in Europe?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE SurfaceArea > (SELECT MIN(SurfaceArea) FROM country WHERE Continent = 'Europe')


Question:
What are the African countries that have a  population less than any country in Asia?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE Continent = 'Africa' AND population < (SELECT MAX(population) FROM country WHERE Continent = 'Asia')


Question:
Which African countries have a smaller population than that of any country in Asia?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE Continent = 'Africa' AND population < (SELECT MIN(population) FROM country WHERE Continent = 'Asia')


Question:
Which Asian countries have a population that is larger than any country in Africa?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE Continent = 'Asia' AND population > (SELECT MAX(population) FROM country WHERE Continent = 'Africa')


Question:
What are the Asian countries which have a population larger than that of any country in Africa?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE Continent = 'Asia' AND population > (SELECT MIN(population) FROM country WHERE Continent = 'Africa')


Question:
What are the country codes for countries that do not speak English?
Additional table information: table: world_1

Answer: SELECT CountryCode FROM countrylanguage EXCEPT SELECT CountryCode FROM countrylanguage WHERE LANGUAGE = 'English'


Question:
Return the country codes for countries that do not speak English.
Additional table information: table: world_1

Answer: SELECT CountryCode FROM countrylanguage EXCEPT SELECT CountryCode FROM countrylanguage WHERE LANGUAGE = 'English'


Question:
What are the country codes of countries where people use languages other than English?
Additional table information: table: world_1

Answer: SELECT DISTINCT CountryCode FROM countrylanguage WHERE LANGUAGE <> 'English'


Question:
Give the country codes for countries in which people speak langauges that are not English.
Additional table information: table: world_1

Answer: SELECT DISTINCT CountryCode FROM countrylanguage WHERE LANGUAGE <> 'English'


Question:
What are the codes of the countries that do not speak English and whose government forms are not Republic?
Additional table information: table: world_1

Answer: SELECT Code FROM country WHERE GovernmentForm <> 'Republic' EXCEPT SELECT CountryCode FROM countrylanguage WHERE LANGUAGE = 'English'


Question:
Return the codes of countries that do not speak English and do not have Republics for governments.
Additional table information: table: world_1

Answer: SELECT Code FROM country WHERE GovernmentForm <> 'Republic' EXCEPT SELECT CountryCode FROM countrylanguage WHERE LANGUAGE = 'English'


Question:
Which cities are in European countries where English is not the official language?
Additional table information: table: world_1

Answer: SELECT DISTINCT T2.Name FROM country AS T1 JOIN city AS T2 ON T2.CountryCode = T1.Code WHERE T1.Continent = 'Europe' AND NOT T1.Name IN (SELECT T3.Name FROM country AS T3 JOIN countrylanguage AS T4 ON T3.Code = T4.CountryCode WHERE T4.IsOfficial = 'T' AND T4.Language = 'English')


Question:
What are the names of cities in Europe for which English is not the official language?
Additional table information: table: world_1

Answer: SELECT DISTINCT T2.Name FROM country AS T1 JOIN city AS T2 ON T2.CountryCode = T1.Code WHERE T1.Continent = 'Europe' AND NOT T1.Name IN (SELECT T3.Name FROM country AS T3 JOIN countrylanguage AS T4 ON T3.Code = T4.CountryCode WHERE T4.IsOfficial = 'T' AND T4.Language = 'English')


Question:
Which unique cities are in Asian countries where Chinese is the official language ?
Additional table information: table: world_1

Answer: SELECT DISTINCT t3.name FROM country AS t1 JOIN countrylanguage AS t2 ON t1.code = t2.countrycode JOIN city AS t3 ON t1.code = t3.countrycode WHERE t2.isofficial = 't' AND t2.language = 'chinese' AND t1.continent = 'asia'


Question:
Return the different names of cities that are in Asia and for which Chinese is the official language.
Additional table information: table: world_1

Answer: SELECT DISTINCT T3.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode JOIN city AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' AND T2.Language = 'Chinese' AND T1.Continent = 'Asia'


Question:
What are the name, independence year, and surface area of the country with the smallest population?
Additional table information: table: world_1

Answer: SELECT Name, SurfaceArea, IndepYear FROM country ORDER BY Population NULLS FIRST LIMIT 1


Question:
Give the name, year of independence, and surface area of the country that has the lowest population.
Additional table information: table: world_1

Answer: SELECT Name, SurfaceArea, IndepYear FROM country ORDER BY Population NULLS FIRST LIMIT 1


Question:
What are the population, name and leader of the country with the largest area?
Additional table information: table: world_1

Answer: SELECT Name, population, HeadOfState FROM country ORDER BY SurfaceArea DESC LIMIT 1


Question:
Give the name, population, and head of state for the country that has the largest area.
Additional table information: table: world_1

Answer: SELECT Name, population, HeadOfState FROM country ORDER BY SurfaceArea DESC LIMIT 1


Question:
Return the country name and the numbers of languages spoken for each country that speaks at least 3 languages.
Additional table information: table: world_1

Answer: SELECT COUNT(T2.Language), T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name HAVING COUNT(*) > 2


Question:
What are the names of countries that speak more than 2 languages, as well as how many languages they speak?
Additional table information: table: world_1

Answer: SELECT COUNT(T2.Language), T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name HAVING COUNT(*) > 2


Question:
Find the number of cities in each district whose population is greater than the average population of cities?
Additional table information: table: world_1

Answer: SELECT COUNT(*), District FROM city WHERE Population > (SELECT AVG(Population) FROM city) GROUP BY District


Question:
How many cities in each district have a population that is above the average population across all cities?
Additional table information: table: world_1

Answer: SELECT COUNT(*), District FROM city WHERE Population > (SELECT AVG(Population) FROM city) GROUP BY District


Question:
Find the government form name and total population for each government form whose average life expectancy is longer than 72.
Additional table information: table: world_1

Answer: SELECT SUM(Population), GovernmentForm FROM country GROUP BY GovernmentForm HAVING AVG(LifeExpectancy) > 72


Question:
What are the different government forms and what is the total population of each for government forms that have an average life expectancy greater than 72?
Additional table information: table: world_1

Answer: SELECT SUM(Population), GovernmentForm FROM country GROUP BY GovernmentForm HAVING AVG(LifeExpectancy) > 72


Question:
Find the average life expectancy and total population for each continent where the average life expectancy is shorter than 72?
Additional table information: table: world_1

Answer: SELECT SUM(Population), AVG(LifeExpectancy), Continent FROM country GROUP BY Continent HAVING AVG(LifeExpectancy) < 72


Question:
What are the different continents and the total popuation and average life expectancy corresponding to each, for continents that have an average life expectancy less than 72?
Additional table information: table: world_1

Answer: SELECT SUM(Population), AVG(LifeExpectancy), Continent FROM country GROUP BY Continent HAVING AVG(LifeExpectancy) < 72


Question:
What are the names and areas of countries with the top 5 largest area?
Additional table information: table: world_1

Answer: SELECT Name, SurfaceArea FROM country ORDER BY SurfaceArea DESC LIMIT 5


Question:
Return the names and surface areas of the 5 largest countries.
Additional table information: table: world_1

Answer: SELECT Name, SurfaceArea FROM country ORDER BY SurfaceArea DESC LIMIT 5


Question:
What are names of countries with the top 3 largest population?
Additional table information: table: world_1

Answer: SELECT Name FROM country ORDER BY Population DESC LIMIT 3


Question:
Return the names of the 3 most populated countries.
Additional table information: table: world_1

Answer: SELECT Name FROM country ORDER BY Population DESC LIMIT 3


Question:
What are the names of the nations with the 3 lowest populations?
Additional table information: table: world_1

Answer: SELECT Name FROM country ORDER BY Population ASC NULLS FIRST LIMIT 3


Question:
Return the names of the 3 countries with the fewest people.
Additional table information: table: world_1

Answer: SELECT Name FROM country ORDER BY Population ASC NULLS FIRST LIMIT 3


Question:
how many countries are in Asia?
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM country WHERE continent = 'Asia'


Question:
Count the number of countries in Asia.
Additional table information: table: world_1

Answer: SELECT COUNT(*) FROM country WHERE continent = 'Asia'


Question:
What are the names of the countries that are in the continent of Europe and have a population of 80000?
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE continent = 'Europe' AND Population = '80000'


Question:
Give the names of countries that are in Europe and have a population equal to 80000.
Additional table information: table: world_1

Answer: SELECT Name FROM country WHERE continent = 'Europe' AND Population = '80000'