Question:
What are the first names of every student who has a cat or dog as a pet?
Additional table information: table: pets_1

Answer: SELECT DISTINCT T1.Fname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat' OR T3.pettype = 'dog'


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:
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:
What are the different models wthat are lighter than 3500 but were not built by the Ford Motor Company?
Additional table information: table: car_1

Answer: SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.Model = T2.Model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.Id JOIN CAR_MAKERS AS T4 ON T1.Maker = T4.Id WHERE T3.weight < 3500 AND T4.FullName <> 'Ford Motor Company'


Question:
What are airport names at City 'Aberdeen'?
Additional table information: table: flight_2

Answer: SELECT AirportName FROM AIRPORTS WHERE City = 'Aberdeen'


Question:
How many friends does each student have?
Additional table information: table: network_1

Answer: SELECT student_id, COUNT(*) FROM Friend GROUP BY student_id


Question:
Which city has most number of arriving flights?
Additional table information: table: flight_2

Answer: SELECT T1.City FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport GROUP BY T1.City ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the maximum capacity and the average of all stadiums ?
Additional table information: table: concert_singer

Answer: SELECT MAX(capacity), average FROM stadium


Question:
What position does the player who played for butler cc (ks) play?
Additional table information: table: "canadian_football"."toronto"
columns: player, player_number, nationality, position, years_in_toronto, school_club_team

Answer: SELECT position FROM "canadian_football"."toronto" WHERE school_club_team = 'Butler CC (KS)'


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:
Show the name and theme for all concerts and the number of singers in each concert.
Additional table information: table: concert_singer

Answer: SELECT T2.concert_name, T2.theme, COUNT(*) FROM singer_in_concert AS T1 JOIN concert AS T2 ON T1.concert_id = T2.concert_id GROUP BY T2.concert_id


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:
find the name of employee who was awarded the most times in the evaluation.
Additional table information: table: employee_hire_evaluation

Answer: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY COUNT(*) DESC LIMIT 1


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:
Find the first names of owners living in Virginia and the names of dogs they own.
Additional table information: table: dog_kennels

Answer: SELECT T1.first_name, T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T1.state = 'Virginia'


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 names of conductors, sorted descending by the number of years they have worked?
Additional table information: table: orchestra

Answer: SELECT Name FROM conductor ORDER BY Year_of_Work DESC


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:
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:
How many documents are using the template with type code 'PPT'?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT COUNT(*) FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Template_Type_Code = 'PPT'


Question:
How many templates do we have?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT COUNT(*) FROM Templates


Question:
What are the names of the dogs for which the owner has not spend more than 1000 for treatment ?
Additional table information: table: dog_kennels

Answer: SELECT name FROM dogs WHERE NOT dog_id IN (SELECT dog_id FROM treatments GROUP BY dog_id HAVING SUM(cost_of_treatment) > 1000)


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 names of the teachers whose courses have not been arranged?
Additional table information: table: course_teach

Answer: SELECT Name FROM teacher WHERE NOT Teacher_id IN (SELECT Teacher_id FROM course_arrange)


Question:
Find the first name and age of students who have a pet.
Additional table information: table: pets_1

Answer: SELECT DISTINCT T1.fname, T1.age FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid


Question:
What are  the different countries with singers above age 20?
Additional table information: table: concert_singer

Answer: SELECT DISTINCT country FROM singer WHERE age > 20


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:
Find the type and weight of the youngest pet.
Additional table information: table: pets_1

Answer: SELECT pettype, weight FROM pets ORDER BY pet_age NULLS FIRST LIMIT 1


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:
Which airlines have less than 200 flights?
Additional table information: table: flight_2

Answer: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) < 200


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:
Show me all grades that have at least 4 students.
Additional table information: table: network_1

Answer: SELECT grade FROM Highschooler GROUP BY grade HAVING COUNT(*) >= 4


Question:
Show the names of students who have at least 2 likes.
Additional table information: table: network_1

Answer: SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING COUNT(*) >= 2


Question:
Who are all of the players on the Westchester High School club team?
Additional table information: table: "canadian_football"."players"
columns: player, player_number, nationality, Position, years_in_toronto, school_club_team

Answer: SELECT player FROM "canadian_football"."players" WHERE school_club_team = 'Westchester High School'


Question:
Which are the car makers which produce at least 2 models and more than 3 car makers ? List the id and the maker .
Additional table information: table: car_1

Answer: SELECT t1.id, t1.maker FROM car_makers AS t1 JOIN model_list AS t2 ON t1.id = t2.maker GROUP BY t1.id HAVING COUNT(*) >= 2 INTERSECT SELECT t1.id, t1.maker FROM car_makers AS t1 JOIN model_list AS t2 ON t1.id = t2.maker JOIN car_names AS t3 ON t2.model = t3.model GROUP BY t1.id HAVING COUNT(*) > 3


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:
Show paragraph details for paragraph with text 'Korea ' .
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT other_details FROM paragraphs WHERE paragraph_text LIKE 'korea'


Question:
List the most common hometown of teachers.
Additional table information: table: course_teach

Answer: SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which professionals live in the state of Indiana or have done treatment on more than 2 treatments? List his or her id, last name and cell phone.
Additional table information: table: dog_kennels

Answer: SELECT professional_id, last_name, cell_number FROM Professionals WHERE state = 'Indiana' UNION SELECT T1.professional_id, T1.last_name, T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING COUNT(*) > 2


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:
List the arrival date and the departure date for all the dogs.
Additional table information: table: dog_kennels

Answer: SELECT date_arrived, date_departed FROM Dogs


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

Answer: SELECT AVG(Earnings) FROM poker_player


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 average and maximum age for each pet type?
Additional table information: table: pets_1

Answer: SELECT AVG(pet_age), MAX(pet_age), pettype FROM pets GROUP BY pettype


Question:
What is the name of the high schooler who has the greatest number of likes?
Additional table information: table: network_1

Answer: SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many conductors are there?
Additional table information: table: orchestra

Answer: SELECT COUNT(*) FROM conductor


Question:
What is the number of continents?
Additional table information: table: car_1

Answer: SELECT COUNT(*) FROM CONTINENTS


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:
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:
Return the code of the template type that is most commonly used in documents.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id GROUP BY T1.template_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the names of singers and the total sales of their songs.
Additional table information: table: singer

Answer: SELECT T1.Name, SUM(T2.Sales) FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name


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:
How many paragraphs in total?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT COUNT(*) FROM Paragraphs


Question:
Find the number of dog pets that are raised by female students (with sex F).
Additional table information: table: pets_1

Answer: SELECT COUNT(*) FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T2.petid = T3.petid WHERE T1.sex = 'F' AND T3.pettype = 'dog'


Question:
What are the makers and models?
Additional table information: table: car_1

Answer: SELECT Maker, Model FROM MODEL_LIST


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 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:
Count the number of employees for each city.
Additional table information: table: employee_hire_evaluation

Answer: SELECT COUNT(*), city FROM employee GROUP BY city


Question:
What is the number of makers of care in France?
Additional table information: table: car_1

Answer: SELECT COUNT(*) FROM CAR_MAKERS AS T1 JOIN COUNTRIES AS T2 ON T1.Country = T2.CountryId WHERE T2.CountryName = 'france'


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

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


Question:
Give the number of Jetblue Airways flights.
Additional table information: table: flight_2

Answer: SELECT COUNT(*) FROM FLIGHTS AS T1 JOIN AIRLINES AS T2 ON T1.Airline = T2.uid WHERE T2.Airline = 'JetBlue Airways'


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:
How many pets have a greater weight than 10?
Additional table information: table: pets_1

Answer: SELECT COUNT(*) FROM pets WHERE weight > 10


Question:
What are the type codes and descriptions for all template types?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT template_type_code, template_type_description FROM Ref_template_types


Question:
What is the average and maximum capacities for all stadiums ?
Additional table information: table: concert_singer

Answer: SELECT AVG(capacity), MAX(capacity) FROM stadium


Question:
List the record company shared by the most number of orchestras.
Additional table information: table: orchestra

Answer: SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the stadium name and capacity with most number of concerts in year 2014 or after.
Additional table information: table: concert_singer

Answer: SELECT T2.name, T2.capacity FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.year >= 2014 GROUP BY T2.stadium_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the first name, last name and email of the owners living in a state whose name contains the substring 'North'.
Additional table information: table: dog_kennels

Answer: SELECT first_name, last_name, email_address FROM Owners WHERE state LIKE '%North%'


Question:
What is the name of the different car makers who produced a car in 1970?
Additional table information: table: car_1

Answer: SELECT DISTINCT T1.Maker FROM CAR_MAKERS AS T1 JOIN MODEL_LIST AS T2 ON T1.Id = T2.Maker JOIN CAR_NAMES AS T3 ON T2.model = T3.model JOIN CARS_DATA AS T4 ON T3.MakeId = T4.id WHERE T4.year = '1970'


Question:
What are the ids of documents that have 2 or more paragraphs?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING COUNT(*) >= 2


Question:
Show the name of singers whose birth year is either 1948 or 1949?
Additional table information: table: singer

Answer: SELECT Name FROM singer WHERE Birth_Year = 1948 OR Birth_Year = 1949


Question:
What are the different models for the cards produced after 1980?
Additional table information: table: car_1

Answer: SELECT DISTINCT T1.model FROM MODEL_LIST AS T1 JOIN CAR_NAMES AS T2 ON T1.model = T2.model JOIN CARS_DATA AS T3 ON T2.MakeId = T3.id WHERE T3.year > 1980


Question:
What is the id of the pet owned by the student whose last name is 'Smith'?
Additional table information: table: pets_1

Answer: SELECT T2.petid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid WHERE T1.Lname = 'Smith'


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 are flight numbers of flights arriving at City 'Aberdeen'?
Additional table information: table: flight_2

Answer: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'


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 are the nationality of the players on the Fresno State school/club team?
Additional table information: table: "canadian_football"."players"
columns: player, player_number, nationality, Position, years_in_toronto, school_club_team

Answer: SELECT nationality FROM "canadian_football"."players" WHERE school_club_team = 'Fresno State'


Question:
In 1980, how many cars were made?
Additional table information: table: car_1

Answer: SELECT COUNT(*) FROM CARS_DATA WHERE YEAR = 1980


Question:
Find the first name of students who have cat or dog pet.
Additional table information: table: pets_1

Answer: SELECT DISTINCT T1.Fname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat' OR T3.pettype = 'dog'


Question:
What are the details for the paragraph that includes the text 'Korea ' ?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT other_details FROM paragraphs WHERE paragraph_text LIKE 'korea'


Question:
List all singer names in concerts in year 2014.
Additional table information: table: concert_singer

Answer: SELECT T2.name FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.singer_id = T2.singer_id JOIN concert AS T3 ON T1.concert_id = T3.concert_id WHERE T3.year = 2014


Question:
Count the number of likes for each student id.
Additional table information: table: network_1

Answer: SELECT student_id, COUNT(*) FROM Likes GROUP BY student_id


Question:
What are the ids and names of each document, as well as the number of paragraphs in each?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT T1.document_id, T2.document_name, COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id GROUP BY T1.document_id


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:
How many transcripts are listed?
Additional table information: table: student_transcripts_tracking

Answer: SELECT COUNT(*) FROM Transcripts


Question:
Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .
Additional table information: table: dog_kennels

Answer: SELECT name FROM dogs WHERE NOT dog_id IN (SELECT dog_id FROM treatments GROUP BY dog_id HAVING SUM(cost_of_treatment) > 1000)


Question:
Show names of all high school students who do not have any friends.
Additional table information: table: network_1

Answer: SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id


Question:
What are the students' first names who have both cats and dogs as pets?
Additional table information: table: pets_1

Answer: SELECT T1.Fname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat' INTERSECT SELECT T1.Fname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'dog'


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:
Show all document ids and the number of paragraphs in each document. Order by document id.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT document_id, COUNT(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id NULLS FIRST


Question:
What are the towns from which at least two teachers come from?
Additional table information: table: course_teach

Answer: SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*) >= 2


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:
Find the number of professionals who have ever treated dogs.
Additional table information: table: dog_kennels

Answer: SELECT COUNT(DISTINCT professional_id) FROM Treatments


Question:
What is total bonus given in all evaluations?
Additional table information: table: employee_hire_evaluation

Answer: SELECT SUM(bonus) FROM evaluation


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:
What are the names of the high schoolers and how many friends does each have?
Additional table information: table: network_1

Answer: SELECT T2.name, COUNT(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id


Question:
Return the different descriptions for templates that have been used in a document.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT DISTINCT T1.template_type_description FROM Ref_template_types AS T1 JOIN Templates AS T2 ON T1.template_type_code = T2.template_type_code JOIN Documents AS T3 ON T2.Template_ID = T3.template_ID


Question:
Find the id and weight of all pets whose age is older than 1.
Additional table information: table: pets_1

Answer: SELECT petid, weight FROM pets WHERE pet_age > 1


Question:
What school did player number 21 play for?
Additional table information: table: "canadian_football"."toronto"
columns: player, player_number, nationality, position, years_in_toronto, school_club_team

Answer: SELECT school_club_team FROM "canadian_football"."toronto" WHERE player_number = '21'


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 average grade of students who have friends?
Additional table information: table: network_1

Answer: SELECT AVG(grade) FROM Highschooler WHERE id IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id)


Question:
What are the song titles and singer names?
Additional table information: table: singer

Answer: SELECT T2.Title, T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID


Question:
How many different store locations are there?
Additional table information: table: employee_hire_evaluation

Answer: SELECT COUNT(DISTINCT LOCATION) FROM shop


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 name of the conductor who has conducted the most orchestras?
Additional table information: table: orchestra

Answer: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID ORDER BY COUNT(*) DESC LIMIT 1


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 all the possible breed type and size type combinations?
Additional table information: table: dog_kennels

Answer: SELECT DISTINCT breed_code, size_code FROM dogs


Question:
How many likes correspond to each student id?
Additional table information: table: network_1

Answer: SELECT student_id, COUNT(*) FROM Likes GROUP BY student_id


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

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


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 horsepower of the car with the largest accelerate?
Additional table information: table: car_1

Answer: SELECT T1.horsepower FROM CARS_DATA AS T1 ORDER BY T1.accelerate DESC LIMIT 1


Question:
What are the different years in which there were cars produced that weighed less than 4000 and also cars that weighted more than 3000 ?
Additional table information: table: car_1

Answer: SELECT DISTINCT year FROM cars_data WHERE weight BETWEEN 3000 AND 4000


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:
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:
Show different hometown of teachers and the number of teachers from each hometown.
Additional table information: table: course_teach

Answer: SELECT Hometown, COUNT(*) FROM teacher GROUP BY Hometown


Question:
Show all countries and the number of singers in each country.
Additional table information: table: concert_singer

Answer: SELECT country, COUNT(*) FROM singer GROUP BY country


Question:
Show the years in which orchestras that have given more than one performance are founded.
Additional table information: table: orchestra

Answer: SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1


Question:
What is the description of the treatment type that costs the least money in total?
Additional table information: table: dog_kennels

Answer: SELECT T1.treatment_type_description FROM Treatment_types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code = T2.treatment_type_code GROUP BY T1.treatment_type_code ORDER BY SUM(cost_of_treatment) ASC NULLS FIRST LIMIT 1


Question:
Give the flight numbers of flights leaving from Aberdeen.
Additional table information: table: flight_2

Answer: SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.SourceAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'


Question:
How many airlines do we have?
Additional table information: table: flight_2

Answer: SELECT COUNT(*) FROM AIRLINES


Question:
List all airline names and their abbreviations in 'USA'.
Additional table information: table: flight_2

Answer: SELECT Airline, Abbreviation FROM AIRLINES WHERE Country = 'USA'


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 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:
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:
Show the number of high schoolers for each grade.
Additional table information: table: network_1

Answer: SELECT grade, COUNT(*) FROM Highschooler GROUP BY grade


Question:
Return the number of United Airlines flights leaving from AHD Airport.
Additional table information: table: flight_2

Answer: SELECT COUNT(*) FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.SourceAirport = 'AHD'


Question:
How many 'United Airlines' flights depart from Airport 'AHD'?
Additional table information: table: flight_2

Answer: SELECT COUNT(*) FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.SourceAirport = 'AHD'


Question:
Which cities do more than one employee under age 30 come from?
Additional table information: table: employee_hire_evaluation

Answer: SELECT city FROM employee WHERE age < 30 GROUP BY city HAVING COUNT(*) > 1


Question:
For each singer name, what is the total sales for their songs?
Additional table information: table: singer

Answer: SELECT T1.Name, SUM(T2.Sales) FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name


Question:
What are the ids, version numbers, and type codes for each template?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT template_id, version_number, template_type_code FROM Templates


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:
Which shops run with no employees? Find the shop names
Additional table information: table: employee_hire_evaluation

Answer: SELECT name FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM hiring)


Question:
What is the number of cars with more than 4 cylinders?
Additional table information: table: car_1

Answer: SELECT COUNT(*) FROM CARS_DATA WHERE Cylinders > 4


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

Answer: SELECT COUNT(DISTINCT loser_name) FROM matches


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:
What is the average weight of cars each year?
Additional table information: table: car_1

Answer: SELECT AVG(Weight), YEAR FROM CARS_DATA GROUP BY YEAR


Question:
What is the age of the oldest dog?
Additional table information: table: dog_kennels

Answer: SELECT MAX(age) FROM Dogs


Question:
How many dogs have not gone through any treatment?
Additional table information: table: dog_kennels

Answer: SELECT COUNT(*) FROM Dogs WHERE NOT dog_id IN (SELECT dog_id FROM Treatments)


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:
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:
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:
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:
Find all airlines that have flights from both airports 'APG' and 'CVO'.
Additional table information: table: flight_2

Answer: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'APG' INTERSECT SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'CVO'


Question:
Show the names of all of the high schooler Kyle's friends.
Additional table information: table: network_1

Answer: SELECT T3.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id JOIN Highschooler AS T3 ON T1.friend_id = T3.id WHERE T2.name = 'Kyle'


Question:
What is the total count of teachers?
Additional table information: table: course_teach

Answer: SELECT COUNT(*) FROM teacher


Question:
What are the names of the singers and number of concerts for each person?
Additional table information: table: concert_singer

Answer: SELECT T2.name, COUNT(*) FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.singer_id = T2.singer_id GROUP BY T2.singer_id


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

Answer: SELECT AVG(Earnings) FROM poker_player


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

Answer: SELECT COUNT(*) FROM Courses


Question:
Return the template type description of the template type with the code AD.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT template_type_description FROM Ref_template_types WHERE template_type_code = 'AD'


Question:
What is the template type code of the template used by document with the name 'Data base'?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT T1.template_type_code FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T2.document_name = 'Data base'


Question:
What is the number of car models that are produced by each maker and what is the id and full name of each maker?
Additional table information: table: car_1

Answer: SELECT COUNT(*), T2.FullName, T2.id FROM MODEL_LIST AS T1 JOIN CAR_MAKERS AS T2 ON T1.Maker = T2.Id GROUP BY T2.id


Question:
Please show the record formats of orchestras in ascending order of count.
Additional table information: table: orchestra

Answer: SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC NULLS FIRST


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:
What are all the makers and models?
Additional table information: table: car_1

Answer: SELECT Maker, Model FROM MODEL_LIST


Question:
Find the number of concerts happened in the stadium with the highest capacity .
Additional table information: table: concert_singer

Answer: SELECT COUNT(*) FROM concert WHERE stadium_id = (SELECT stadium_id FROM stadium ORDER BY capacity DESC LIMIT 1)


Question:
Show ids for all templates that are used by more than one document.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT template_id FROM Documents GROUP BY template_id HAVING COUNT(*) > 1


Question:
How many high schoolers are in each grade?
Additional table information: table: network_1

Answer: SELECT grade, COUNT(*) FROM Highschooler GROUP BY grade


Question:
What are the country codes of the different countries, and what are the languages spoken by the greatest percentage of people for each?
Additional table information: table: world_1

Answer: SELECT LANGUAGE, CountryCode, MAX(Percentage) FROM countrylanguage GROUP BY CountryCode


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:
What are the ids of the students who do not own cats as pets?
Additional table information: table: pets_1

Answer: SELECT stuid FROM student EXCEPT SELECT T1.stuid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat'


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:
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:
Find the distinct breed type and size type combinations for dogs.
Additional table information: table: dog_kennels

Answer: SELECT DISTINCT breed_code, size_code FROM dogs


Question:
What is the average, minimum, and maximum age for all French singers?
Additional table information: table: concert_singer

Answer: SELECT AVG(age), MIN(age), MAX(age) FROM singer WHERE country = 'France'


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:
how many countries are in Asia?
Additional table information: table: world_1

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


Question:
Which airlines have a flight with destination airport AHD?
Additional table information: table: flight_2

Answer: SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline WHERE T2.DestAirport = 'AHD'


Question:
What is the average miles per gallon of all the cards with 4 cylinders?
Additional table information: table: car_1

Answer: SELECT AVG(mpg) FROM CARS_DATA WHERE Cylinders = 4


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 is Kyle's id?
Additional table information: table: network_1

Answer: SELECT ID FROM Highschooler WHERE name = 'Kyle'


Question:
Count the number of templates of the type CV.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT COUNT(*) FROM Templates WHERE template_type_code = 'CV'


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

Answer: SELECT COUNT(*) FROM players


Question:
What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?
Additional table information: table: course_teach

Answer: SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name NULLS FIRST


Question:
List the name of singers in ascending order of net worth.
Additional table information: table: singer

Answer: SELECT Name FROM singer ORDER BY Net_Worth_Millions ASC NULLS FIRST


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 the maximum horsepower and the make of the car models with 3 cylinders?
Additional table information: table: car_1

Answer: SELECT T2.horsepower, T1.Make FROM CAR_NAMES AS T1 JOIN CARS_DATA AS T2 ON T1.MakeId = T2.Id WHERE T2.cylinders = 3 ORDER BY T2.horsepower DESC LIMIT 1


Question:
What is the average age for all students who do not own any pets ?
Additional table information: table: pets_1

Answer: SELECT AVG(age) FROM student WHERE NOT stuid IN (SELECT stuid FROM has_pet)


Question:
Show all document names using templates with template type code BK.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT T2.document_name FROM Templates AS T1 JOIN Documents AS T2 ON T1.template_id = T2.template_id WHERE T1.template_type_code = 'BK'


Question:
What is the model of the car with the smallest amount of horsepower?
Additional table information: table: car_1

Answer: SELECT T1.Model FROM CAR_NAMES AS T1 JOIN CARS_DATA AS T2 ON T1.MakeId = T2.Id ORDER BY T2.horsepower ASC NULLS FIRST LIMIT 1


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:
How many different types of pet are there?
Additional table information: table: pets_1

Answer: SELECT COUNT(DISTINCT pettype) FROM pets


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:
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:
What are the cities whose population is between 160000 and 900000?
Additional table information: table: world_1

Answer: SELECT name FROM city WHERE Population BETWEEN 160000 AND 900000


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 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:
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:
How many countries exist?
Additional table information: table: car_1

Answer: SELECT COUNT(*) FROM COUNTRIES


Question:
What grade is Kyle in?
Additional table information: table: network_1

Answer: SELECT grade FROM Highschooler WHERE name = 'Kyle'


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:
What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015?
Additional table information: table: concert_singer

Answer: SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015


Question:
Give the code of the airport with the least flights.
Additional table information: table: flight_2

Answer: SELECT T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Count the number of United Airlines flights that arrive in Aberdeen.
Additional table information: table: flight_2

Answer: SELECT COUNT(*) FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.DestAirport = T2.AirportCode JOIN AIRLINES AS T3 ON T3.uid = T1.Airline WHERE T2.City = 'Aberdeen' AND T3.Airline = 'United Airlines'


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:
For each citizenship, what is the maximum net worth?
Additional table information: table: singer

Answer: SELECT Citizenship, MAX(Net_Worth_Millions) FROM singer GROUP BY Citizenship


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:
What is the template type descriptions for template type code 'AD'.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT template_type_description FROM Ref_template_types WHERE template_type_code = 'AD'


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:
List singer names and number of concerts for each singer.
Additional table information: table: concert_singer

Answer: SELECT T2.name, COUNT(*) FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.singer_id = T2.singer_id GROUP BY T2.singer_id


Question:
What are the names and release years for all the songs of the youngest singer?
Additional table information: table: concert_singer

Answer: SELECT song_name, song_release_year FROM singer ORDER BY age NULLS FIRST LIMIT 1


Question:
What is the first name and gender of the all the students who have more than one pet?
Additional table information: table: pets_1

Answer: SELECT T1.fname, T1.sex FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid GROUP BY T1.stuid HAVING COUNT(*) > 1


Question:
What is the average weight and year for each year?
Additional table information: table: car_1

Answer: SELECT AVG(Weight), YEAR FROM CARS_DATA GROUP BY YEAR


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 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:
Show the ID of the high schooler named Kyle.
Additional table information: table: network_1

Answer: SELECT ID FROM Highschooler WHERE name = 'Kyle'


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 documents do we have?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT COUNT(*) FROM Documents


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:
Return the document id, template id, and description for the document with the name Robbin CV.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT document_id, template_id, Document_Description FROM Documents WHERE document_name = 'Robbin CV'


Question:
Show template ids, version numbers, and template type codes for all templates.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT template_id, version_number, template_type_code FROM Templates


Question:
How many 'United Airlines' flights go to Airport 'ASY'?
Additional table information: table: flight_2

Answer: SELECT COUNT(*) FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.DestAirport = 'ASY'


Question:
Show all the grades of the high schoolers.
Additional table information: table: network_1

Answer: SELECT grade FROM Highschooler


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:
What are the major record formats of orchestras, sorted by their frequency?
Additional table information: table: orchestra

Answer: SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC NULLS FIRST


Question:
How many flights fly from Aberdeen to Ashley?
Additional table information: table: flight_2

Answer: SELECT COUNT(*) FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.DestAirport = T2.AirportCode JOIN AIRPORTS AS T3 ON T1.SourceAirport = T3.AirportCode WHERE T2.City = 'Ashley' AND T3.City = 'Aberdeen'


Question:
How many countries does each continent have? List the continent id, continent name and the number of countries.
Additional table information: table: car_1

Answer: SELECT T1.ContId, T1.Continent, COUNT(*) FROM CONTINENTS AS T1 JOIN COUNTRIES AS T2 ON T1.ContId = T2.Continent GROUP BY T1.ContId


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 owner id and zip code of the owner who spent the most money in total for his or her dogs.
Additional table information: table: dog_kennels

Answer: SELECT T1.owner_id, T1.zip_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id ORDER BY SUM(T3.cost_of_treatment) DESC LIMIT 1


Question:
Sort all the shops by number products in descending order, and return the name, location and district of each shop.
Additional table information: table: employee_hire_evaluation

Answer: SELECT name, LOCATION, district FROM shop ORDER BY number_products DESC


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:
Return the name of the high school student with the most friends.
Additional table information: table: network_1

Answer: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the total amount of bonus given in all the evaluations.
Additional table information: table: employee_hire_evaluation

Answer: SELECT SUM(bonus) FROM evaluation


Question:
What are the ids of students who both have friends and are liked?
Additional table information: table: network_1

Answer: SELECT student_id FROM Friend INTERSECT SELECT liked_id FROM Likes


Question:
How many pets are owned by students that have an age greater than 20?
Additional table information: table: pets_1

Answer: SELECT COUNT(*) FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid WHERE T1.age > 20


Question:
What is the average attendance of shows?
Additional table information: table: orchestra

Answer: SELECT AVG(Attendance) FROM SHOW


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:
Which owner has paid for the most treatments on his or her dogs? List the owner id and last name.
Additional table information: table: dog_kennels

Answer: SELECT T1.owner_id, T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which shop has the most employees? Give me the shop name.
Additional table information: table: employee_hire_evaluation

Answer: SELECT t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t1.shop_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the birth years and citizenships of the singers?
Additional table information: table: singer

Answer: SELECT Birth_Year, Citizenship FROM singer


Question:
List the names of teachers in ascending order of age.
Additional table information: table: course_teach

Answer: SELECT Name FROM teacher ORDER BY Age ASC NULLS FIRST


Question:
Find the average and maximum age for each type of pet.
Additional table information: table: pets_1

Answer: SELECT AVG(pet_age), MAX(pet_age), pettype FROM pets GROUP BY pettype


Question:
Show the stadium name and the number of concerts in each stadium.
Additional table information: table: concert_singer

Answer: SELECT T2.name, COUNT(*) FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id GROUP BY T1.stadium_id


Question:
Show all paragraph ids and texts for the document with name 'Welcome to NY'.
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT T1.paragraph_id, T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id = T2.document_id WHERE T2.Document_Name = 'Welcome to NY'


Question:
How many paragraphs for the document with name 'Summer Show'?
Additional table information: table: cre_Doc_Template_Mgt

Answer: SELECT COUNT(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_ID = T2.document_ID WHERE T2.document_name = 'Summer Show'