target-benchmark/spider-queries huggingface dataset:
Database: address_1 (tables: city, direct_distance)
Question: Show all city names and the average distance to all other cities.
SQL: SELECT T2.city_name ,  avg(distance) FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code  =  T2.city_code GROUP BY T1.city1_code
Database: address_1 (tables: city, direct_distance)
Question: What are the city name and average distances from each city?
SQL: SELECT T2.city_name ,  avg(distance) FROM Direct_distance AS T1 JOIN City AS T2 ON T1.city1_code  =  T2.city_code GROUP BY T1.city1_code
Database: address_1 (tables: student, direct_distance)
Question: How far do Linda (first name) Smith (last name) and Tracy (first name) Kim (last name) live?
SQL: SELECT distance FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code  =  T2.city_code JOIN Student AS T3 ON T1.city2_code  =  T3.city_code WHERE T2.Fname  =  "Linda" AND T2.Lname  =  "Smith" AND T3.Fname  =  "Tracy" AND T3.Lname  =  "Kim"
Database: address_1 (tables: student, direct_distance)
Question: What is the distance between the cities where Linda Smith and Tracy Kim live?
SQL: SELECT distance FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code  =  T2.city_code JOIN Student AS T3 ON T1.city2_code  =  T3.city_code WHERE T2.Fname  =  "Linda" AND T2.Lname  =  "Smith" AND T3.Fname  =  "Tracy" AND T3.Lname  =  "Kim"
Database: address_1 (tables: student, direct_distance)
Question: What is the first name and last name of the student living furthest to Linda Smith?
SQL: SELECT T3.Fname ,  T3.Lname FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code  =  T2.city_code JOIN Student AS T3 ON T1.city2_code  =  T3.city_code WHERE T2.Fname  =  "Linda" AND T2.Lname  =  "Smith" ORDER BY distance DESC LIMIT 1
Database: address_1 (tables: student, direct_distance)
Question: What is the full name of the student who lives furthest from Linda Smith?
SQL: SELECT T3.Fname ,  T3.Lname FROM Direct_distance AS T1 JOIN Student AS T2 ON T1.city1_code  =  T2.city_code JOIN Student AS T3 ON T1.city2_code  =  T3.city_code WHERE T2.Fname  =  "Linda" AND T2.Lname  =  "Smith" ORDER BY distance DESC LIMIT 1
Database: address_1 (tables: city, student)
Question: Which state does the student whose first name is Linda live in?
SQL: SELECT state FROM Student AS T1 JOIN City AS T2 ON T1.city_code  =  T2.city_code WHERE T1.Fname  =  "Linda"
Database: address_1 (tables: city, student)
Question: Give the state that the student with first name Linda lives in.
SQL: SELECT state FROM Student AS T1 JOIN City AS T2 ON T1.city_code  =  T2.city_code WHERE T1.Fname  =  "Linda"
Database: boat_1 (tables: sailors)
Question: Return all details of sailors who are older than 30.
SQL: SELECT * FROM Sailors WHERE age  >  30
Database: boat_1 (tables: sailors)
Question: What can you tell me about sailors who are older than age 30?
SQL: SELECT * FROM Sailors WHERE age  >  30
Database: boat_1 (tables: sailors)
Question: Return name and age for sailors who are younger than 30.
SQL: SELECT name ,  age FROM Sailors WHERE age  <  30
Database: boat_1 (tables: sailors)
Question: What is the name and age of every sailor who is younger than age 30?
SQL: SELECT name ,  age FROM Sailors WHERE age  <  30
Database: boat_1 (tables: reserves)
Question: Find boats reserved by Sailor with id 1.
SQL: SELECT DISTINCT bid FROM Reserves WHERE sid = 1
Database: boat_1 (tables: reserves)
Question: What are the different boat ids reserved by the sailor whose id is 1?
SQL: SELECT DISTINCT bid FROM Reserves WHERE sid = 1
Database: boat_1 (tables: reserves, sailors)
Question: Who reserved boat 102?
SQL: SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid WHERE T2.bid  =  102
Database: boat_1 (tables: reserves, sailors)
Question: What is the name of the sailor who reserved boat 102?
SQL: SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid WHERE T2.bid  =  102
Database: boat_1 (tables: reserves)
Question: Return the unique boat ids (bid) of all reserved boats.
SQL: SELECT DISTINCT bid FROM Reserves
Database: boat_1 (tables: reserves)
Question: What are the ids of all boats that are reserved by someone?
SQL: SELECT DISTINCT bid FROM Reserves
Database: boat_1 (tables: sailors)
Question: What is the name of sailors whose names contain letter e?
SQL: SELECT name FROM Sailors WHERE name LIKE '%e%'
Database: boat_1 (tables: sailors)
Question: What is the name of every sailor whose name contains the letter e?
SQL: SELECT name FROM Sailors WHERE name LIKE '%e%'
Database: boat_1 (tables: sailors)
Question: return the unique ids of sailors who are older than any sailors.
SQL: SELECT DISTINCT sid FROM Sailors WHERE age  >  (SELECT min(age) FROM Sailors);
Database: boat_1 (tables: sailors)
Question: What is the different id of every sailor who is not the youngest?
SQL: SELECT DISTINCT sid FROM Sailors WHERE age  >  (SELECT min(age) FROM Sailors);
Database: boat_1 (tables: sailors)
Question: Return the unique names of sailors who are older than any sailors whose rating is larger than 7.
SQL: SELECT DISTINCT name FROM Sailors WHERE age  >  (SELECT min(age) FROM Sailors WHERE rating  >  7);
Database: boat_1 (tables: sailors)
Question: What are the different names of sailors who are older than some other sailor with a rating larger than 7?
SQL: SELECT DISTINCT name FROM Sailors WHERE age  >  (SELECT min(age) FROM Sailors WHERE rating  >  7);
Database: boat_1 (tables: reserves, sailors)
Question: Find the name and id of the sailors who reserved at least one boat?
SQL: SELECT DISTINCT T1.name ,  T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid
Database: boat_1 (tables: reserves, sailors)
Question: What is the name and id of every sailor who reserved one or more boats?
SQL: SELECT DISTINCT T1.name ,  T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid
Database: boat_1 (tables: reserves, sailors)
Question: Find the id and name of the sailors who reserved more than one boat.
SQL: SELECT DISTINCT T1.name ,  T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid GROUP BY T2.sid HAVING COUNT(*)  >  1
Database: boat_1 (tables: sailors, reserves)
Question: What are the different names of sailors who reserved two or more boats ?
SQL: select distinct t1.name ,  t1.sid from sailors as t1 join reserves as t2 on t1.sid  =  t2.sid group by t2.sid having count(*)  >=  2
Database: boat_1 (tables: reserves, boats)
Question: Find the id of Sailors (sid) that reserved red or blue boat.
SQL: SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid WHERE T1.color  =  'red' OR T1.color  =  "blue"
Database: boat_1 (tables: reserves, boats)
Question: What are the sids for sailors who reserved red or blue boats?
SQL: SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid WHERE T1.color  =  'red' OR T1.color  =  "blue"
Database: boat_1 (tables: reserves, sailors, boats)
Question: Find the name and id of Sailors (sid) that reserved red or blue boat.
SQL: SELECT DISTINCT T2.sid ,  T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid JOIN Sailors AS T3 ON T2.sid  =  T3.sid WHERE T1.color  =  'red' OR T1.color  =  "blue"
Database: boat_1 (tables: reserves, sailors, boats)
Question: What are the names and ids of sailors who reserved red or blue boats?
SQL: SELECT DISTINCT T2.sid ,  T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid JOIN Sailors AS T3 ON T2.sid  =  T3.sid WHERE T1.color  =  'red' OR T1.color  =  "blue"
Database: boat_1 (tables: reserves, boats)
Question: Find the id of Sailors (sid) that reserved red and blue boat.
SQL: SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid WHERE T1.color  =  'red' INTERSECT SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid WHERE T1.color  =  "blue"
Database: boat_1 (tables: reserves, boats)
Question: What are the ids of sailors who reserved red and blue boats?
SQL: SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid WHERE T1.color  =  'red' INTERSECT SELECT DISTINCT T2.sid FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid WHERE T1.color  =  "blue"
Database: boat_1 (tables: reserves, sailors, boats)
Question: Find the name and id of Sailors (sid) that reserved red and blue boat.
SQL: SELECT DISTINCT T2.sid ,  T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid JOIN Sailors AS T3 ON T2.sid  =  T3.sid WHERE T1.color  =  'red' INTERSECT SELECT DISTINCT T2.sid ,  T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid JOIN Sailors AS T3 ON T2.sid  =  T3.sid WHERE T1.color  =  "blue"
Database: boat_1 (tables: reserves, sailors, boats)
Question: What are the names and ids of sailors who reserved red and blue boats?
SQL: SELECT DISTINCT T2.sid ,  T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid JOIN Sailors AS T3 ON T2.sid  =  T3.sid WHERE T1.color  =  'red' INTERSECT SELECT DISTINCT T2.sid ,  T3.name FROM Boats AS T1 JOIN Reserves AS T2 ON  T1.bid  =  T2.bid JOIN Sailors AS T3 ON T2.sid  =  T3.sid WHERE T1.color  =  "blue"
Database: boat_1 (tables: reserves, sailors)
Question: What is the ids of sailors that haven’t reserved a boat?
SQL: SELECT sid FROM Sailors EXCEPT SELECT sid FROM Reserves
Database: boat_1 (tables: reserves, sailors)
Question: What are the ids of sailors who have not reserved a boat?
SQL: SELECT sid FROM Sailors EXCEPT SELECT sid FROM Reserves
Database: boat_1 (tables: reserves, sailors)
Question: what is the name and id of sailors who do not have a reservation of a boat?
SQL: SELECT sid ,  name FROM Sailors EXCEPT SELECT T1.sid ,  T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid
Database: boat_1 (tables: reserves, sailors)
Question: What are the names and ids of all sailors who do not have boat reservations?
SQL: SELECT sid ,  name FROM Sailors EXCEPT SELECT T1.sid ,  T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid
Database: boat_1 (tables: reserves, sailors)
Question: Find id for the sailors who do not have a reservation of a boat?
SQL: SELECT sid FROM Sailors EXCEPT SELECT T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid
Database: boat_1 (tables: reserves, sailors)
Question: What is id about sailors who do not have boat reservations?
SQL: SELECT sid FROM Sailors EXCEPT SELECT T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid
Database: boat_1 (tables: reserves, sailors)
Question: What is the name of the sailors who reserved boat with id 103?
SQL: SELECT DISTINCT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid WHERE  T2.bid  =  103
Database: boat_1 (tables: reserves, sailors)
Question: Find the name of the sailors who reserved boat with id 103.
SQL: SELECT DISTINCT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid WHERE  T2.bid  =  103
Database: boat_1 (tables: sailors)
Question: What is the name of all sailors whose rating is higher than any sailor named Luis?
SQL: SELECT name FROM Sailors WHERE rating  >  (SELECT min(rating) FROM Sailors WHERE name  =  'Luis')
Database: boat_1 (tables: sailors)
Question: What are the sailors' names, the ones whose rating is higher than any sailor named Luis?
SQL: SELECT name FROM Sailors WHERE rating  >  (SELECT min(rating) FROM Sailors WHERE name  =  'Luis')
Database: boat_1 (tables: sailors)
Question: What is the name of all sailors whose rating is higher than all sailors named Luis?
SQL: SELECT name FROM Sailors WHERE rating  >  (SELECT max(rating) FROM Sailors WHERE name  =  'Luis')
Database: boat_1 (tables: sailors)
Question: What are the names of all sailors with a higher rating than every sailor named Luis?
SQL: SELECT name FROM Sailors WHERE rating  >  (SELECT max(rating) FROM Sailors WHERE name  =  'Luis')
Database: boat_1 (tables: reserves, sailors)
Question: what is the name and id of every sailor who has a rating greater than 2 and reserved a boat.
SQL: SELECT DISTINCT T1.name ,  T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid WHERE  T1.rating  >  2
Database: boat_1 (tables: reserves, sailors)
Question: What are the names and ids of all sailors who have a rating of at least 3 and reserved a boat?
SQL: SELECT DISTINCT T1.name ,  T1.sid FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid WHERE  T1.rating  >  2
Database: boat_1 (tables: sailors)
Question: Find the name and age of the oldest sailor.
SQL: SELECT name ,  age FROM Sailors WHERE age  =  ( SELECT max(age) FROM Sailors )
Database: boat_1 (tables: sailors)
Question: What is the name and age of the sailor with maximum age?
SQL: SELECT name ,  age FROM Sailors WHERE age  =  ( SELECT max(age) FROM Sailors )
Database: boat_1 (tables: sailors)
Question: how many sailors in total?
SQL: SELECT COUNT(*) FROM Sailors
Database: boat_1 (tables: sailors)
Question: How many sailors exist?
SQL: SELECT COUNT(*) FROM Sailors
Database: boat_1 (tables: sailors)
Question: What is the average age of sailors whose rating is 7?
SQL: SELECT AVG(age) FROM Sailors WHERE rating  =  7
Database: boat_1 (tables: sailors)
Question: What is average age of all sailors who have a rating of 7?
SQL: SELECT AVG(age) FROM Sailors WHERE rating  =  7
Database: boat_1 (tables: sailors)
Question: How many sailors whose name starts with letter D exist ?
SQL: select count(*) from sailors where name like 'd%'
Database: boat_1 (tables: sailors)
Question: What is the count of the sailors whose name starts with letter D ?
SQL: select count(*) from sailors where name like 'd%'
Database: boat_1 (tables: sailors)
Question: What are the average rating and max age of all sailors?
SQL: SELECT AVG(rating) ,  MAX(age) FROM Sailors
Database: boat_1 (tables: sailors)
Question: Find the average rating and largest age for the sailors
SQL: SELECT AVG(rating) ,  MAX(age) FROM Sailors
Database: boat_1 (tables: reserves)
Question: Find the number of reservations for each boat.
SQL: SELECT bid ,  count(*) FROM Reserves GROUP BY bid
Database: boat_1 (tables: reserves)
Question: How many reservations exist for each boat?
SQL: SELECT bid ,  count(*) FROM Reserves GROUP BY bid
Database: boat_1 (tables: reserves)
Question: Find the number of reservations for each boat with id greater than 50.
SQL: SELECT bid ,  count(*) FROM Reserves GROUP BY bid HAVING bid  >  50
Database: boat_1 (tables: reserves)
Question: How many reservations exist for each boat with an id greater than 50?
SQL: SELECT bid ,  count(*) FROM Reserves GROUP BY bid HAVING bid  >  50
Database: boat_1 (tables: reserves)
Question: Find the number of reservations for each boat with more than 1 reservation.
SQL: SELECT bid ,  count(*) FROM Reserves GROUP BY bid HAVING count(*)  >  1
Database: boat_1 (tables: reserves)
Question: How many reservations exist for each boat that has more than 1 reservation already?
SQL: SELECT bid ,  count(*) FROM Reserves GROUP BY bid HAVING count(*)  >  1
Database: boat_1 (tables: reserves)
Question: Find the number of reservations by sailors with id greater than 1 for each boat.
SQL: SELECT bid ,  count(*) FROM Reserves WHERE sid  >  1 GROUP BY bid
Database: boat_1 (tables: reserves)
Question: How many reservations for each boat did the sailors with an id greater than 1 make?
SQL: SELECT bid ,  count(*) FROM Reserves WHERE sid  >  1 GROUP BY bid
Database: boat_1 (tables: reserves, sailors, boats)
Question: What is the rating and average age for sailors who have reserved red boat grouped by rating?
SQL: SELECT T1.rating ,  avg(T1.age) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T3.color  =  'red' GROUP BY T1.rating
Database: boat_1 (tables: reserves, sailors, boats)
Question: What are the rating and average age for sailors who reserved red boats for each rating?
SQL: SELECT T1.rating ,  avg(T1.age) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T3.color  =  'red' GROUP BY T1.rating
Database: boat_1 (tables: sailors)
Question: Find the name, rating and age of all sailors ordered by rating and age.
SQL: SELECT name ,  rating ,  age FROM Sailors ORDER BY rating ,  age
Database: boat_1 (tables: sailors)
Question: What is the name, rating, and age for every sailor? And order them by rating and age.
SQL: SELECT name ,  rating ,  age FROM Sailors ORDER BY rating ,  age
Database: boat_1 (tables: boats)
Question: Find the total number of boats.
SQL: SELECT count(*) FROM Boats
Database: boat_1 (tables: boats)
Question: How many boats are there?
SQL: SELECT count(*) FROM Boats
Database: boat_1 (tables: boats)
Question: How many boats are red?
SQL: SELECT count(*) FROM Boats WHERE color  =  'red'
Database: boat_1 (tables: boats)
Question: How many red boats exist?
SQL: SELECT count(*) FROM Boats WHERE color  =  'red'
Database: boat_1 (tables: reserves, sailors, boats)
Question: Find the names of boats booked by sailors whose age is between 20 and 30.
SQL: SELECT T3.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T1.age BETWEEN 20 AND 30
Database: boat_1 (tables: reserves, sailors, boats)
Question: What are the names of the boats booked by people between age 20 and 30?
SQL: SELECT T3.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T1.age BETWEEN 20 AND 30
Database: boat_1 (tables: reserves, sailors, boats)
Question: Find the names of sailors whose rating is larger than the rating of all sailors who booked a red boat.
SQL: SELECT name FROM Sailors WHERE rating  >  (SELECT max(T1.rating) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T3.color  =  'red')
Database: boat_1 (tables: reserves, sailors, boats)
Question: What are the names of the sailors whose rating is larger than the rating of all sailors who booked a red boat?
SQL: SELECT name FROM Sailors WHERE rating  >  (SELECT max(T1.rating) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T3.color  =  'red')
Database: boat_1 (tables: sailors)
Question: What is highest rating between sailors?
SQL: SELECT max(rating) FROM Sailors
Database: boat_1 (tables: sailors)
Question: What is the maximum rating for sailors?
SQL: SELECT max(rating) FROM Sailors
Database: boat_1 (tables: reserves, sailors, boats)
Question: Find the names of sailors who reserved boat with the name Melon.
SQL: SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T3.name  =  'Melon'
Database: boat_1 (tables: reserves, sailors, boats)
Question: What are the names of sailors who reserved a boat with the name Melon?
SQL: SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid  =  T2.sid JOIN Boats AS T3 ON T3.bid  =  T2.bid WHERE T3.name  =  'Melon'
Database: boat_1 (tables: sailors)
Question: List the names and ages of all sailors sorted by rating in descending order.
SQL: SELECT name ,  age FROM Sailors ORDER BY rating DESC
Database: boat_1 (tables: sailors)
Question: What are the names and ages of all sailors sorted by decreasing rating?
SQL: SELECT name ,  age FROM Sailors ORDER BY rating DESC
Database: headphone_store (tables: headphone)
Question: Find the model of the most expensive headphone.
SQL: SELECT model FROM headphone ORDER BY price DESC LIMIT 1
Database: headphone_store (tables: headphone)
Question: Which headphone model has the highest price?
SQL: SELECT model FROM headphone ORDER BY price DESC LIMIT 1
Database: headphone_store (tables: headphone)
Question: List all different headphone models in the alphabetical order.
SQL: SELECT DISTINCT model FROM headphone ORDER BY model
Database: headphone_store (tables: headphone)
Question: Return the list of distinct headphone models ordered alphabetically.
SQL: SELECT DISTINCT model FROM headphone ORDER BY model
Database: headphone_store (tables: headphone)
Question: Which headphone class is the most common one?
SQL: SELECT CLASS FROM headphone GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
Database: headphone_store (tables: headphone)
Question: Which headphone class contains the most headphones?
SQL: SELECT CLASS FROM headphone GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
Database: headphone_store (tables: headphone)
Question: Which headphone class does have more than two headphones?
SQL: SELECT CLASS FROM headphone GROUP BY CLASS HAVING count(*)  >  2
Database: headphone_store (tables: headphone)
Question: Find the headphone class that does not contain more than two headphones.
SQL: SELECT CLASS FROM headphone GROUP BY CLASS HAVING count(*)  >  2
Database: headphone_store (tables: headphone)
Question: Find the number of headphones with a price higher than 200 for each class.
SQL: SELECT count(*) ,  CLASS FROM headphone WHERE price  >  200 GROUP BY CLASS
Database: headphone_store (tables: headphone)
Question: How many headphones cost more than 200 for each headphone class?
SQL: SELECT count(*) ,  CLASS FROM headphone WHERE price  >  200 GROUP BY CLASS
Database: headphone_store (tables: headphone)
Question: how many different earpads are there?
SQL: SELECT count(DISTINCT earpads) FROM headphone
Database: headphone_store (tables: headphone)
Question: Count the number of different earpads.
SQL: SELECT count(DISTINCT earpads) FROM headphone
Database: headphone_store (tables: headphone)
Question: Find the top 2 earpads that are mostly used.
SQL: SELECT earpads FROM headphone GROUP BY earpads ORDER BY count(*) DESC LIMIT 2
Database: headphone_store (tables: headphone)
Question: What are the top 2 earpads in terms of the number of headphones using them?
SQL: SELECT earpads FROM headphone GROUP BY earpads ORDER BY count(*) DESC LIMIT 2
Database: headphone_store (tables: headphone)
Question: What are the model, class, and construction of the cheapest headphone?
SQL: SELECT model ,  CLASS ,  construction FROM headphone ORDER BY price LIMIT 1
Database: headphone_store (tables: headphone)
Question: Find the model, class, and construction of the headphone with the lowest price.
SQL: SELECT model ,  CLASS ,  construction FROM headphone ORDER BY price LIMIT 1
Database: headphone_store (tables: headphone)
Question: Find the average price for each headphone construction.
SQL: SELECT construction ,  avg(price) FROM headphone GROUP BY construction
Database: headphone_store (tables: headphone)
Question: How much does headphones cost on average for each headphone construction?
SQL: SELECT construction ,  avg(price) FROM headphone GROUP BY construction
Database: headphone_store (tables: headphone)
Question: Which headphone classes have both headphones with "Bowls" and headphones with "Comfort Pads" earpads?
SQL: SELECT CLASS FROM headphone WHERE earpads  =  'Bowls' INTERSECT SELECT CLASS FROM headphone WHERE earpads  =  'Comfort Pads'
Database: headphone_store (tables: headphone)
Question: Find the headphone classes that contain both headphones using "Bowls" earpads and headphones using "Comfort Pads" earpads.
SQL: SELECT CLASS FROM headphone WHERE earpads  =  'Bowls' INTERSECT SELECT CLASS FROM headphone WHERE earpads  =  'Comfort Pads'
Database: headphone_store (tables: headphone)
Question: Which earpads never use plastic construction?
SQL: SELECT earpads FROM headphone EXCEPT SELECT earpads FROM headphone WHERE construction  =  'Plastic'
Database: headphone_store (tables: headphone)
Question: Find all earpads that do not use plastic construction.
SQL: SELECT earpads FROM headphone EXCEPT SELECT earpads FROM headphone WHERE construction  =  'Plastic'
Database: headphone_store (tables: headphone)
Question: Find the headphone models whose price is below the average price.
SQL: SELECT model FROM headphone WHERE price  <  (SELECT avg(price) FROM headphone)
Database: headphone_store (tables: headphone)
Question: What are the headphone models that cost less than the average price?
SQL: SELECT model FROM headphone WHERE price  <  (SELECT avg(price) FROM headphone)
Database: headphone_store (tables: store)
Question: Sort all store names by store open date.
SQL: SELECT name FROM store ORDER BY date_opened
Database: headphone_store (tables: store)
Question: Give me a list of store names, sorted by store open date.
SQL: SELECT name FROM store ORDER BY date_opened