target-benchmark/spider-queries huggingface dataset:
Database: world_1 (tables: country)
Question: What are the names of the countries that are in the continent of Europe and have a population of 80000?
SQL: SELECT Name FROM country WHERE continent  =  "Europe" AND Population  =  "80000"
Database: world_1 (tables: country)
Question: Give the names of countries that are in Europe and have a population equal to 80000.
SQL: SELECT Name FROM country WHERE continent  =  "Europe" AND Population  =  "80000"
Database: world_1 (tables: country)
Question: What is the total population and average area of countries in the continent of North America whose area is bigger than 3000 ?
SQL: select sum(population) ,  avg(surfacearea) from country where continent  =  "north america" and surfacearea  >  3000
Database: world_1 (tables: country)
Question: Give the total population and average surface area corresponding to countries in North America that have a surface area greater than 3000 .
SQL: select sum(population) ,  avg(surfacearea) from country where continent  =  "north america" and surfacearea  >  3000
Database: world_1 (tables: city)
Question: What are the cities whose population is between 160000 and 900000?
SQL: SELECT name FROM city WHERE Population BETWEEN 160000 AND 900000
Database: world_1 (tables: city)
Question: Return the names of cities that have a population between 160000 and 900000 .
SQL: select name from city where population between 160000 and 900000
Database: world_1 (tables: countrylanguage)
Question: Which language is spoken by the largest number of countries?
SQL: SELECT LANGUAGE FROM countrylanguage GROUP BY LANGUAGE ORDER BY count(*) DESC LIMIT 1
Database: world_1 (tables: countrylanguage)
Question: Give the language that is spoken in the most countries.
SQL: SELECT LANGUAGE FROM countrylanguage GROUP BY LANGUAGE ORDER BY count(*) DESC LIMIT 1
Database: world_1 (tables: countrylanguage)
Question: What is the language spoken by the largest percentage of people in each country?
SQL: SELECT LANGUAGE ,  CountryCode ,  max(Percentage) FROM countrylanguage GROUP BY CountryCode
Database: world_1 (tables: countrylanguage)
Question: What are the country codes of the different countries, and what are the languages spoken by the greatest percentage of people for each?
SQL: SELECT LANGUAGE ,  CountryCode ,  max(Percentage) FROM countrylanguage GROUP BY CountryCode
Database: world_1 (tables: countrylanguage)
Question: What is the total number of countries where Spanish is spoken by the largest percentage of people?
SQL: SELECT count(*) ,   max(Percentage) FROM countrylanguage WHERE LANGUAGE  =  "Spanish" GROUP BY CountryCode
Database: world_1 (tables: countrylanguage)
Question: Count the number of countries for which Spanish is the predominantly spoken language.
SQL: SELECT count(*) ,   max(Percentage) FROM countrylanguage WHERE LANGUAGE  =  "Spanish" GROUP BY CountryCode
Database: world_1 (tables: countrylanguage)
Question: What are the codes of countries where Spanish is spoken by the largest percentage of people?
SQL: SELECT CountryCode ,  max(Percentage) FROM countrylanguage WHERE LANGUAGE  =  "Spanish" GROUP BY CountryCode
Database: world_1 (tables: countrylanguage)
Question: Return the codes of countries for which Spanish is the predominantly spoken language.
SQL: SELECT CountryCode ,  max(Percentage) FROM countrylanguage WHERE LANGUAGE  =  "Spanish" GROUP BY CountryCode
Database: orchestra (tables: conductor)
Question: How many conductors are there?
SQL: SELECT count(*) FROM conductor
Database: orchestra (tables: conductor)
Question: Count the number of conductors.
SQL: SELECT count(*) FROM conductor
Database: orchestra (tables: conductor)
Question: List the names of conductors in ascending order of age.
SQL: SELECT Name FROM conductor ORDER BY Age ASC
Database: orchestra (tables: conductor)
Question: What are the names of conductors, ordered by age?
SQL: SELECT Name FROM conductor ORDER BY Age ASC
Database: orchestra (tables: conductor)
Question: What are the names of conductors whose nationalities are not "USA"?
SQL: SELECT Name FROM conductor WHERE Nationality != 'USA'
Database: orchestra (tables: conductor)
Question: Return the names of conductors that do not have the nationality "USA".
SQL: SELECT Name FROM conductor WHERE Nationality != 'USA'
Database: orchestra (tables: orchestra)
Question: What are the record companies of orchestras in descending order of years in which they were founded?
SQL: SELECT Record_Company FROM orchestra ORDER BY Year_of_Founded DESC
Database: orchestra (tables: orchestra)
Question: Return the record companies of orchestras, sorted descending by the years in which they were founded.
SQL: SELECT Record_Company FROM orchestra ORDER BY Year_of_Founded DESC
Database: orchestra (tables: show)
Question: What is the average attendance of shows?
SQL: SELECT avg(Attendance) FROM SHOW
Database: orchestra (tables: show)
Question: Return the average attendance across all shows.
SQL: SELECT avg(Attendance) FROM SHOW
Database: orchestra (tables: performance)
Question: What are the maximum and minimum share of performances whose type is not "Live final".
SQL: SELECT max(SHARE) ,  min(SHARE) FROM performance WHERE TYPE != "Live final"
Database: orchestra (tables: performance)
Question: Return the maximum and minimum shares for performances that do not have the type "Live final".
SQL: SELECT max(SHARE) ,  min(SHARE) FROM performance WHERE TYPE != "Live final"
Database: orchestra (tables: conductor)
Question: How many different nationalities do conductors have?
SQL: SELECT count(DISTINCT Nationality) FROM conductor
Database: orchestra (tables: conductor)
Question: Count the number of different nationalities of conductors.
SQL: SELECT count(DISTINCT Nationality) FROM conductor
Database: orchestra (tables: conductor)
Question: List names of conductors in descending order of years of work.
SQL: SELECT Name FROM conductor ORDER BY Year_of_Work DESC
Database: orchestra (tables: conductor)
Question: What are the names of conductors, sorted descending by the number of years they have worked?
SQL: SELECT Name FROM conductor ORDER BY Year_of_Work DESC
Database: orchestra (tables: conductor)
Question: List the name of the conductor with the most years of work.
SQL: SELECT Name FROM conductor ORDER BY Year_of_Work DESC LIMIT 1
Database: orchestra (tables: conductor)
Question: What is the name of the conductor who has worked the greatest number of years?
SQL: SELECT Name FROM conductor ORDER BY Year_of_Work DESC LIMIT 1
Database: orchestra (tables: conductor, orchestra)
Question: Show the names of conductors and the orchestras they have conducted.
SQL: SELECT T1.Name ,  T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID  =  T2.Conductor_ID
Database: orchestra (tables: conductor, orchestra)
Question: What are the names of conductors as well as the corresonding orchestras that they have conducted?
SQL: SELECT T1.Name ,  T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID  =  T2.Conductor_ID
Database: orchestra (tables: conductor, orchestra)
Question: Show the names of conductors that have conducted more than one orchestras.
SQL: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID  =  T2.Conductor_ID GROUP BY T2.Conductor_ID HAVING COUNT(*)  >  1
Database: orchestra (tables: conductor, orchestra)
Question: What are the names of conductors who have conducted at more than one orchestra?
SQL: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID  =  T2.Conductor_ID GROUP BY T2.Conductor_ID HAVING COUNT(*)  >  1
Database: orchestra (tables: conductor, orchestra)
Question: Show the name of the conductor that has conducted the most number of orchestras.
SQL: 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
Database: orchestra (tables: conductor, orchestra)
Question: What is the name of the conductor who has conducted the most orchestras?
SQL: 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
Database: orchestra (tables: conductor, orchestra)
Question: Please show the name of the conductor that has conducted orchestras founded after 2008.
SQL: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID  =  T2.Conductor_ID WHERE Year_of_Founded  >  2008
Database: orchestra (tables: conductor, orchestra)
Question: What are the names of conductors who have conducted orchestras founded after the year 2008?
SQL: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID  =  T2.Conductor_ID WHERE Year_of_Founded  >  2008
Database: orchestra (tables: orchestra)
Question: Please show the different record companies and the corresponding number of orchestras.
SQL: SELECT Record_Company ,  COUNT(*) FROM orchestra GROUP BY Record_Company
Database: orchestra (tables: orchestra)
Question: How many orchestras does each record company manage?
SQL: SELECT Record_Company ,  COUNT(*) FROM orchestra GROUP BY Record_Company
Database: orchestra (tables: orchestra)
Question: Please show the record formats of orchestras in ascending order of count.
SQL: SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC
Database: orchestra (tables: orchestra)
Question: What are the major record formats of orchestras, sorted by their frequency?
SQL: SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC
Database: orchestra (tables: orchestra)
Question: List the record company shared by the most number of orchestras.
SQL: SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1
Database: orchestra (tables: orchestra)
Question: What is the record company used by the greatest number of orchestras?
SQL: SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1
Database: orchestra (tables: orchestra, performance)
Question: List the names of orchestras that have no performance.
SQL: SELECT Orchestra FROM orchestra WHERE Orchestra_ID NOT IN (SELECT Orchestra_ID FROM performance)
Database: orchestra (tables: orchestra, performance)
Question: What are the orchestras that do not have any performances?
SQL: SELECT Orchestra FROM orchestra WHERE Orchestra_ID NOT IN (SELECT Orchestra_ID FROM performance)
Database: orchestra (tables: orchestra)
Question: Show the record companies shared by orchestras founded before 2003 and after 2003.
SQL: SELECT Record_Company FROM orchestra WHERE Year_of_Founded  <  2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded  >  2003
Database: orchestra (tables: orchestra)
Question: What are the record companies that are used by both orchestras founded before 2003 and those founded after 2003?
SQL: SELECT Record_Company FROM orchestra WHERE Year_of_Founded  <  2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded  >  2003
Database: orchestra (tables: orchestra)
Question: Find the number of orchestras whose record format is "CD" or "DVD".
SQL: SELECT COUNT(*) FROM orchestra WHERE Major_Record_Format  =  "CD" OR Major_Record_Format  =  "DVD"
Database: orchestra (tables: orchestra)
Question: Count the number of orchestras that have CD or DVD as their record format.
SQL: SELECT COUNT(*) FROM orchestra WHERE Major_Record_Format  =  "CD" OR Major_Record_Format  =  "DVD"
Database: orchestra (tables: orchestra, performance)
Question: Show the years in which orchestras that have given more than one performance are founded.
SQL: 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
Database: orchestra (tables: orchestra, performance)
Question: What are years of founding for orchestras that have had more than a single performance?
SQL: 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
Database: network_1 (tables: highschooler)
Question: How many high schoolers are there?
SQL: SELECT count(*) FROM Highschooler
Database: network_1 (tables: highschooler)
Question: Count the number of high schoolers.
SQL: SELECT count(*) FROM Highschooler
Database: network_1 (tables: highschooler)
Question: Show the names and grades of each high schooler.
SQL: SELECT name ,  grade FROM Highschooler
Database: network_1 (tables: highschooler)
Question: What are the names and grades for each high schooler?
SQL: SELECT name ,  grade FROM Highschooler
Database: network_1 (tables: highschooler)
Question: Show all the grades of the high schoolers.
SQL: SELECT grade FROM Highschooler
Database: network_1 (tables: highschooler)
Question: What is the grade of each high schooler?
SQL: SELECT grade FROM Highschooler
Database: network_1 (tables: highschooler)
Question: What grade is Kyle in?
SQL: SELECT grade FROM Highschooler WHERE name  =  "Kyle"
Database: network_1 (tables: highschooler)
Question: Return the grade for the high schooler named Kyle.
SQL: SELECT grade FROM Highschooler WHERE name  =  "Kyle"
Database: network_1 (tables: highschooler)
Question: Show the names of all high schoolers in grade 10.
SQL: SELECT name FROM Highschooler WHERE grade  =  10
Database: network_1 (tables: highschooler)
Question: What are the names of all high schoolers in grade 10?
SQL: SELECT name FROM Highschooler WHERE grade  =  10
Database: network_1 (tables: highschooler)
Question: Show the ID of the high schooler named Kyle.
SQL: SELECT ID FROM Highschooler WHERE name  =  "Kyle"
Database: network_1 (tables: highschooler)
Question: What is Kyle's id?
SQL: SELECT ID FROM Highschooler WHERE name  =  "Kyle"
Database: network_1 (tables: highschooler)
Question: How many high schoolers are there in grade 9 or 10?
SQL: SELECT count(*) FROM Highschooler WHERE grade  =  9 OR grade  =  10
Database: network_1 (tables: highschooler)
Question: Count the number of high schoolers in grades 9 or 10.
SQL: SELECT count(*) FROM Highschooler WHERE grade  =  9 OR grade  =  10
Database: network_1 (tables: highschooler)
Question: Show the number of high schoolers for each grade.
SQL: SELECT grade ,  count(*) FROM Highschooler GROUP BY grade
Database: network_1 (tables: highschooler)
Question: How many high schoolers are in each grade?
SQL: SELECT grade ,  count(*) FROM Highschooler GROUP BY grade
Database: network_1 (tables: highschooler)
Question: Which grade has the most high schoolers?
SQL: SELECT grade FROM Highschooler GROUP BY grade ORDER BY count(*) DESC LIMIT 1
Database: network_1 (tables: highschooler)
Question: Return the grade that has the greatest number of high schoolers.
SQL: SELECT grade FROM Highschooler GROUP BY grade ORDER BY count(*) DESC LIMIT 1
Database: network_1 (tables: highschooler)
Question: Show me all grades that have at least 4 students.
SQL: SELECT grade FROM Highschooler GROUP BY grade HAVING count(*)  >=  4
Database: network_1 (tables: highschooler)
Question: Which grades have 4 or more high schoolers?
SQL: SELECT grade FROM Highschooler GROUP BY grade HAVING count(*)  >=  4
Database: network_1 (tables: friend)
Question: Show the student IDs and numbers of friends corresponding to each.
SQL: SELECT student_id ,  count(*) FROM Friend GROUP BY student_id
Database: network_1 (tables: friend)
Question: How many friends does each student have?
SQL: SELECT student_id ,  count(*) FROM Friend GROUP BY student_id
Database: network_1 (tables: friend, highschooler)
Question: Show the names of high school students and their corresponding number of friends.
SQL: SELECT T2.name ,  count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id GROUP BY T1.student_id
Database: network_1 (tables: friend, highschooler)
Question: What are the names of the high schoolers and how many friends does each have?
SQL: SELECT T2.name ,  count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id GROUP BY T1.student_id
Database: network_1 (tables: friend, highschooler)
Question: What is the name of the high schooler who has the greatest number of friends?
SQL: 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
Database: network_1 (tables: friend, highschooler)
Question: Return the name of the high school student with the most friends.
SQL: 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
Database: network_1 (tables: friend, highschooler)
Question: Show the names of high schoolers who have at least 3 friends.
SQL: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id GROUP BY T1.student_id HAVING count(*)  >=  3
Database: network_1 (tables: friend, highschooler)
Question: What are the names of high schoolers who have 3 or more friends?
SQL: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id GROUP BY T1.student_id HAVING count(*)  >=  3
Database: network_1 (tables: friend, highschooler)
Question: Show the names of all of the high schooler Kyle's friends.
SQL: 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"
Database: network_1 (tables: friend, highschooler)
Question: Return the names of friends of the high school student Kyle.
SQL: 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"
Database: network_1 (tables: friend, highschooler)
Question: How many friends does the high school student Kyle have?
SQL: SELECT count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id WHERE T2.name  =  "Kyle"
Database: network_1 (tables: friend, highschooler)
Question: Count the number of friends Kyle has.
SQL: SELECT count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id WHERE T2.name  =  "Kyle"
Database: network_1 (tables: friend, highschooler)
Question: Show ids of all students who do not have any friends.
SQL: SELECT id FROM Highschooler EXCEPT SELECT student_id FROM Friend
Database: network_1 (tables: friend, highschooler)
Question: What are the ids of high school students who do not have friends?
SQL: SELECT id FROM Highschooler EXCEPT SELECT student_id FROM Friend
Database: network_1 (tables: friend, highschooler)
Question: Show names of all high school students who do not have any friends.
SQL: SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id
Database: network_1 (tables: friend, highschooler)
Question: What are the names of students who have no friends?
SQL: SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id
Database: network_1 (tables: likes, friend)
Question: Show the ids of high schoolers who have friends and are also liked by someone else.
SQL: SELECT student_id FROM Friend INTERSECT SELECT liked_id FROM Likes
Database: network_1 (tables: likes, friend)
Question: What are the ids of students who both have friends and are liked?
SQL: SELECT student_id FROM Friend INTERSECT SELECT liked_id FROM Likes
Database: network_1 (tables: likes, friend, highschooler)
Question: Show name of all students who have some friends and also are liked by someone else.
SQL: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id INTERSECT SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.liked_id  =  T2.id
Database: network_1 (tables: likes, friend, highschooler)
Question: What are the names of high schoolers who both have friends and are liked?
SQL: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id INTERSECT SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.liked_id  =  T2.id
Database: network_1 (tables: likes)
Question: Count the number of likes for each student id.
SQL: SELECT student_id ,  count(*) FROM Likes GROUP BY student_id
Database: network_1 (tables: likes)
Question: How many likes correspond to each student id?
SQL: SELECT student_id ,  count(*) FROM Likes GROUP BY student_id
Database: network_1 (tables: likes, highschooler)
Question: Show the names of high schoolers who have likes, and numbers of likes for each.
SQL: SELECT T2.name ,  count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id GROUP BY T1.student_id
Database: network_1 (tables: likes, highschooler)
Question: What are the names of high schoolers who have likes, and how many likes does each have?
SQL: SELECT T2.name ,  count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id GROUP BY T1.student_id
Database: network_1 (tables: likes, highschooler)
Question: What is the name of the high schooler who has the greatest number of likes?
SQL: 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
Database: network_1 (tables: likes, highschooler)
Question: Give the name of the student with the most likes.
SQL: 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
Database: network_1 (tables: likes, highschooler)
Question: Show the names of students who have at least 2 likes.
SQL: 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
Database: network_1 (tables: likes, highschooler)
Question: What are the names of students who have 2 or more likes?
SQL: 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
Database: network_1 (tables: friend, highschooler)
Question: Show the names of students who have a grade higher than 5 and have at least 2 friends.
SQL: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id WHERE T2.grade  >  5 GROUP BY T1.student_id HAVING count(*)  >=  2
Database: network_1 (tables: friend, highschooler)
Question: What are the names of high schoolers who have a grade of over 5 and have 2 or more friends?
SQL: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id WHERE T2.grade  >  5 GROUP BY T1.student_id HAVING count(*)  >=  2
Database: network_1 (tables: likes, highschooler)
Question: How many likes does Kyle have?
SQL: SELECT count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id WHERE T2.name  =  "Kyle"
Database: network_1 (tables: likes, highschooler)
Question: Return the number of likes that the high schooler named Kyle has.
SQL: SELECT count(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id WHERE T2.name  =  "Kyle"
Database: network_1 (tables: friend, highschooler)
Question: Find the average grade of all students who have some friends.
SQL: 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)
Database: network_1 (tables: friend, highschooler)
Question: What is the average grade of students who have friends?
SQL: 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)
Database: network_1 (tables: friend, highschooler)
Question: Find the minimum grade of students who have no friends.
SQL: SELECT min(grade) FROM Highschooler WHERE id NOT IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id)
Database: network_1 (tables: friend, highschooler)
Question: What is the lowest grade of students who do not have any friends?
SQL: SELECT min(grade) FROM Highschooler WHERE id NOT IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id  =  T2.id)
Database: dog_kennels (tables: owners, professionals)
Question: Which states have both owners and professionals living there?
SQL: SELECT state FROM Owners INTERSECT SELECT state FROM Professionals