Question:
How many heads of the departments are older than 56 ?
Additional table information: table: department_management

Answer: SELECT COUNT(*) FROM head WHERE age > 56


Question:
List the name, born state and age of the heads of departments ordered by age.
Additional table information: table: department_management

Answer: SELECT name, born_state, age FROM head ORDER BY age NULLS FIRST


Question:
List the creation year, name and budget of each department.
Additional table information: table: department_management

Answer: SELECT creation, name, budget_in_billions FROM department


Question:
What are the maximum and minimum budget of the departments?
Additional table information: table: department_management

Answer: SELECT MAX(budget_in_billions), MIN(budget_in_billions) FROM department


Question:
What is the average number of employees of the departments whose rank is between 10 and 15?
Additional table information: table: department_management

Answer: SELECT AVG(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15


Question:
What are the names of the heads who are born outside the California state?
Additional table information: table: department_management

Answer: SELECT name FROM head WHERE born_state <> 'California'


Question:
What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'?
Additional table information: table: department_management

Answer: SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama'


Question:
What are the names of the states where at least 3 heads were born?
Additional table information: table: department_management

Answer: SELECT born_state FROM head GROUP BY born_state HAVING COUNT(*) >= 3


Question:
In which year were most departments established?
Additional table information: table: department_management

Answer: SELECT creation FROM department GROUP BY creation ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?
Additional table information: table: department_management

Answer: SELECT T1.name, T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes'


Question:
How many acting statuses are there?
Additional table information: table: department_management

Answer: SELECT COUNT(DISTINCT temporary_acting) FROM management


Question:
How many departments are led by heads who are not mentioned?
Additional table information: table: department_management

Answer: SELECT COUNT(*) FROM department WHERE NOT department_id IN (SELECT department_id FROM management)


Question:
What are the distinct ages of the heads who are acting?
Additional table information: table: department_management

Answer: SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'


Question:
List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born.
Additional table information: table: department_management

Answer: SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Homeland Security'


Question:
Which department has more than 1 head at a time? List the id, name and the number of heads.
Additional table information: table: department_management

Answer: SELECT T1.department_id, T1.name, COUNT(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING COUNT(*) > 1


Question:
Which head's name has the substring 'Ha'? List the id and name.
Additional table information: table: department_management

Answer: SELECT head_id, name FROM head WHERE name LIKE '%Ha%'


Question:
How many farms are there?
Additional table information: table: farm

Answer: SELECT COUNT(*) FROM farm


Question:
Count the number of farms.
Additional table information: table: farm

Answer: SELECT COUNT(*) FROM farm


Question:
List the total number of horses on farms in ascending order.
Additional table information: table: farm

Answer: SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC NULLS FIRST


Question:
What is the total horses record for each farm, sorted ascending?
Additional table information: table: farm

Answer: SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC NULLS FIRST


Question:
What are the hosts of competitions whose theme is not 'Aliens'?
Additional table information: table: farm

Answer: SELECT Hosts FROM farm_competition WHERE Theme <> 'Aliens'


Question:
Return the hosts of competitions for which the theme is not Aliens?
Additional table information: table: farm

Answer: SELECT Hosts FROM farm_competition WHERE Theme <> 'Aliens'


Question:
What are the themes of farm competitions sorted by year in ascending order?
Additional table information: table: farm

Answer: SELECT Theme FROM farm_competition ORDER BY YEAR ASC NULLS FIRST


Question:
Return the themes of farm competitions, sorted by year ascending.
Additional table information: table: farm

Answer: SELECT Theme FROM farm_competition ORDER BY YEAR ASC NULLS FIRST


Question:
What is the average number of working horses of farms with more than 5000 total number of horses?
Additional table information: table: farm

Answer: SELECT AVG(Working_Horses) FROM farm WHERE Total_Horses > 5000


Question:
Give the average number of working horses on farms with more than 5000 total horses.
Additional table information: table: farm

Answer: SELECT AVG(Working_Horses) FROM farm WHERE Total_Horses > 5000


Question:
What are the maximum and minimum number of cows across all farms.
Additional table information: table: farm

Answer: SELECT MAX(Cows), MIN(Cows) FROM farm


Question:
Return the maximum and minimum number of cows across all farms.
Additional table information: table: farm

Answer: SELECT MAX(Cows), MIN(Cows) FROM farm


Question:
How many different statuses do cities have?
Additional table information: table: farm

Answer: SELECT COUNT(DISTINCT Status) FROM city


Question:
Count the number of different statuses.
Additional table information: table: farm

Answer: SELECT COUNT(DISTINCT Status) FROM city


Question:
List official names of cities in descending order of population.
Additional table information: table: farm

Answer: SELECT Official_Name FROM city ORDER BY Population DESC


Question:
What are the official names of cities, ordered descending by population?
Additional table information: table: farm

Answer: SELECT Official_Name FROM city ORDER BY Population DESC


Question:
List the official name and status of the city with the largest population.
Additional table information: table: farm

Answer: SELECT Official_Name, Status FROM city ORDER BY Population DESC LIMIT 1


Question:
What is the official name and status of the city with the most residents?
Additional table information: table: farm

Answer: SELECT Official_Name, Status FROM city ORDER BY Population DESC LIMIT 1


Question:
Show the years and the official names of the host cities of competitions.
Additional table information: table: farm

Answer: SELECT T2.Year, T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID


Question:
Give the years and official names of the cities of each competition.
Additional table information: table: farm

Answer: SELECT T2.Year, T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID


Question:
Show the official names of the cities that have hosted more than one competition.
Additional table information: table: farm

Answer: SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1


Question:
What are the official names of cities that have hosted more than one competition?
Additional table information: table: farm

Answer: SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1


Question:
Show the status of the city that has hosted the greatest number of competitions.
Additional table information: table: farm

Answer: SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the status of the city that has hosted the most competitions?
Additional table information: table: farm

Answer: SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Please show the themes of competitions with host cities having populations larger than 1000.
Additional table information: table: farm

Answer: SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000


Question:
What are the themes of competitions that have corresponding host cities with more than 1000 residents?
Additional table information: table: farm

Answer: SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000


Question:
Please show the different statuses of cities and the average population of cities with each status.
Additional table information: table: farm

Answer: SELECT Status, AVG(Population) FROM city GROUP BY Status


Question:
What are the statuses and average populations of each city?
Additional table information: table: farm

Answer: SELECT Status, AVG(Population) FROM city GROUP BY Status


Question:
Please show the different statuses, ordered by the number of cities that have each.
Additional table information: table: farm

Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC NULLS FIRST


Question:
Return the different statuses of cities, ascending by frequency.
Additional table information: table: farm

Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC NULLS FIRST


Question:
List the most common type of Status across cities.
Additional table information: table: farm

Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the most common status across all cities?
Additional table information: table: farm

Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the official names of cities that have not held any competition.
Additional table information: table: farm

Answer: SELECT Official_Name FROM city WHERE NOT City_ID IN (SELECT Host_city_ID FROM farm_competition)


Question:
What are the official names of cities that have not hosted a farm competition?
Additional table information: table: farm

Answer: SELECT Official_Name FROM city WHERE NOT City_ID IN (SELECT Host_city_ID FROM farm_competition)


Question:
Show the status shared by cities with population bigger than 1500 and smaller than 500.
Additional table information: table: farm

Answer: SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500


Question:
Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500?
Additional table information: table: farm

Answer: SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500


Question:
Find the official names of cities with population bigger than 1500 or smaller than 500.
Additional table information: table: farm

Answer: SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500


Question:
What are the official names of cities that have population over 1500 or less than 500?
Additional table information: table: farm

Answer: SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500


Question:
Show the census ranking of cities whose status are not 'Village'.
Additional table information: table: farm

Answer: SELECT Census_Ranking FROM city WHERE Status <> 'Village'


Question:
What are the census rankings of cities that do not have the status 'Village'?
Additional table information: table: farm

Answer: SELECT Census_Ranking FROM city WHERE Status <> 'Village'


Question:
which course has most number of registered students?
Additional table information: table: student_assessment

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


Question:
What is the name of the course with the most registered students?
Additional table information: table: student_assessment

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


Question:
what is id of students who registered some courses but the least number of courses in these students?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the ids of the students who registered for some courses but had the least number of courses for all students?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
what are the first name and last name of all candidates?
Additional table information: table: student_assessment

Answer: SELECT T2.first_name, T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id


Question:
What are the first and last names of all the candidates?
Additional table information: table: student_assessment

Answer: SELECT T2.first_name, T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id


Question:
List the id of students who never attends courses?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM students WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)


Question:
What are the  ids of every student who has never attended a course?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM students WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)


Question:
List the id of students who attended some courses?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance


Question:
What are the ids of all students who have attended at least one course?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance


Question:
What are the ids of all students for courses and what are the names of those courses?
Additional table information: table: student_assessment

Answer: SELECT T1.student_id, T2.course_name FROM student_course_registrations AS T1 JOIN courses AS T2 ON T1.course_id = T2.course_id


Question:
What is detail of the student who most recently registered course?
Additional table information: table: student_assessment

Answer: SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1


Question:
What details do we have on the students who registered for courses most recently?
Additional table information: table: student_assessment

Answer: SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1


Question:
How many students attend course English?
Additional table information: table: student_assessment

Answer: SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'English'


Question:
How many students are attending English courses?
Additional table information: table: student_assessment

Answer: SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'English'


Question:
How many courses do the student whose id is 171 attend?
Additional table information: table: student_assessment

Answer: SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171


Question:
How many courses does the student with id 171 actually attend?
Additional table information: table: student_assessment

Answer: SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171


Question:
Find id of the candidate whose email is stanley.monahan@example.org?
Additional table information: table: student_assessment

Answer: SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = 'stanley.monahan@example.org'


Question:
What is the id of the candidate whose email is stanley.monahan@example.org?
Additional table information: table: student_assessment

Answer: SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = 'stanley.monahan@example.org'


Question:
Find id of the candidate who most recently accessed the course?
Additional table information: table: student_assessment

Answer: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1


Question:
What is the id of the candidate who most recently accessed the course?
Additional table information: table: student_assessment

Answer: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1


Question:
What is detail of the student who registered the most number of courses?
Additional table information: table: student_assessment

Answer: SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the details of the student who registered for the most number of courses?
Additional table information: table: student_assessment

Answer: SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the id of students who registered some courses and the number of their registered courses?
Additional table information: table: student_assessment

Answer: SELECT T1.student_id, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id


Question:
For every student who is registered for some course, how many courses are they registered for?
Additional table information: table: student_assessment

Answer: SELECT T1.student_id, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id


Question:
How many registed students do each course have? List course name and the number of their registered students?
Additional table information: table: student_assessment

Answer: SELECT T3.course_name, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id


Question:
For each course id, how many students are registered and what are the course names?
Additional table information: table: student_assessment

Answer: SELECT T3.course_name, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id


Question:
Find id of candidates whose assessment code is 'Pass'?
Additional table information: table: student_assessment

Answer: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = 'Pass'


Question:
What are the ids of the candidates that have an outcome code of Pass?
Additional table information: table: student_assessment

Answer: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = 'Pass'


Question:
Find the cell mobile number of the candidates whose assessment code is 'Fail'?
Additional table information: table: student_assessment

Answer: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = 'Fail'


Question:
What are the cell phone numbers of the candidates that received an assessment code of 'Fail'?
Additional table information: table: student_assessment

Answer: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = 'Fail'


Question:
What are the id of students who registered course 301?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301


Question:
What are the ids of the students who registered for course 301?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301


Question:
What is the id of the student who most recently registered course 301?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1


Question:
What are the ids of the students who registered for course 301 most recently?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1


Question:
Find distinct cities of addresses of people?
Additional table information: table: student_assessment

Answer: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id


Question:
What are the different cities where people live?
Additional table information: table: student_assessment

Answer: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id


Question:
Find distinct cities of address of students?
Additional table information: table: student_assessment

Answer: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id


Question:
What are the different cities where students live?
Additional table information: table: student_assessment

Answer: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id


Question:
List the names of courses in alphabetical order?
Additional table information: table: student_assessment

Answer: SELECT course_name FROM courses ORDER BY course_name NULLS FIRST


Question:
What are the names of the courses in alphabetical order?
Additional table information: table: student_assessment

Answer: SELECT course_name FROM courses ORDER BY course_name NULLS FIRST


Question:
List the first names of people in alphabetical order?
Additional table information: table: student_assessment

Answer: SELECT first_name FROM people ORDER BY first_name NULLS FIRST


Question:
What are the first names of the people in alphabetical order?
Additional table information: table: student_assessment

Answer: SELECT first_name FROM people ORDER BY first_name NULLS FIRST


Question:
What are the id of students who registered courses or attended courses?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance


Question:
What are the ids of the students who either registered or attended a course?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance


Question:
Find the id of courses which are registered or attended by student whose id is 121?
Additional table information: table: student_assessment

Answer: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121


Question:
What are the ids of the courses that are registered or attended by the student whose id is 121?
Additional table information: table: student_assessment

Answer: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121


Question:
What are all info of students who registered courses but not attended courses?
Additional table information: table: student_assessment

Answer: SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)


Question:
What are all details of the students who registered but did not attend any course?
Additional table information: table: student_assessment

Answer: SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)


Question:
List the id of students who registered course statistics in the order of registration date.
Additional table information: table: student_assessment

Answer: SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'statistics' ORDER BY T2.registration_date NULLS FIRST


Question:
What are the ids of the students who registered course statistics by order of registration date?
Additional table information: table: student_assessment

Answer: SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'statistics' ORDER BY T2.registration_date NULLS FIRST


Question:
List the id of students who attended  statistics courses in the order of attendance date.
Additional table information: table: student_assessment

Answer: SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'statistics' ORDER BY T2.date_of_attendance NULLS FIRST


Question:
What are the ids of the students who attended courses in the statistics department in order of attendance date.
Additional table information: table: student_assessment

Answer: SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'statistics' ORDER BY T2.date_of_attendance NULLS FIRST


Question:
Give me the dates when the max temperature was higher than 85.
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE max_temperature_f > 85


Question:
What are the dates with a maximum temperature higher than 85?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE max_temperature_f > 85


Question:
What are the names of stations that have latitude lower than 37.5?
Additional table information: table: bike_1

Answer: SELECT name FROM station WHERE lat < 37.5


Question:
What are the names of all stations with a latitude smaller than 37.5?
Additional table information: table: bike_1

Answer: SELECT name FROM station WHERE lat < 37.5


Question:
For each city, return the highest latitude among its stations.
Additional table information: table: bike_1

Answer: SELECT city, MAX(lat) FROM station GROUP BY city


Question:
For each city, what is the highest latitude for its stations?
Additional table information: table: bike_1

Answer: SELECT city, MAX(lat) FROM station GROUP BY city


Question:
Give me the start station and end station for the trips with the three oldest id.
Additional table information: table: bike_1

Answer: SELECT start_station_name, end_station_name FROM trip ORDER BY id NULLS FIRST LIMIT 3


Question:
What is the station station and end station for the trips with the three smallest ids?
Additional table information: table: bike_1

Answer: SELECT start_station_name, end_station_name FROM trip ORDER BY id NULLS FIRST LIMIT 3


Question:
What is the average latitude and longitude of stations located in San Jose city?
Additional table information: table: bike_1

Answer: SELECT AVG(lat), AVG(long) FROM station WHERE city = 'San Jose'


Question:
What is the average latitude and longitude in San Jose?
Additional table information: table: bike_1

Answer: SELECT AVG(lat), AVG(long) FROM station WHERE city = 'San Jose'


Question:
What is the id of the trip that has the shortest duration?
Additional table information: table: bike_1

Answer: SELECT id FROM trip ORDER BY duration NULLS FIRST LIMIT 1


Question:
What is the id of the shortest trip?
Additional table information: table: bike_1

Answer: SELECT id FROM trip ORDER BY duration NULLS FIRST LIMIT 1


Question:
What is the total and maximum duration of trips with bike id 636?
Additional table information: table: bike_1

Answer: SELECT SUM(duration), MAX(duration) FROM trip WHERE bike_id = 636


Question:
What is the total and maximum duration for all trips with the bike id 636?
Additional table information: table: bike_1

Answer: SELECT SUM(duration), MAX(duration) FROM trip WHERE bike_id = 636


Question:
For each zip code, return the average mean temperature of August there.
Additional table information: table: bike_1

Answer: SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE '8/%' GROUP BY zip_code


Question:
For each zip code, what is the average mean temperature for all dates that start with '8'?
Additional table information: table: bike_1

Answer: SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE '8/%' GROUP BY zip_code


Question:
From the trip record, find the number of unique bikes.
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT bike_id) FROM trip


Question:
How many different bike ids are there?
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT bike_id) FROM trip


Question:
What is the number of distinct cities the stations are located at?
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT city) FROM station


Question:
How many different cities have these stations?
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT city) FROM station


Question:
How many stations does Mountain View city has?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM station WHERE city = 'Mountain View'


Question:
How many stations are in Mountain View?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM station WHERE city = 'Mountain View'


Question:
Return the unique name for stations that have ever had 7 bikes available.
Additional table information: table: bike_1

Answer: SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7


Question:
What are the different names for each station that has ever had 7 bikes available?
Additional table information: table: bike_1

Answer: SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7


Question:
Which start station had the most trips starting from August? Give me the name and id of the station.
Additional table information: table: bike_1

Answer: SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE '8/%' GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the start station's name and id for the one that had the most start trips in August?
Additional table information: table: bike_1

Answer: SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE '8/%' GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which bike traveled the most often in zip code 94002?
Additional table information: table: bike_1

Answer: SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the id of the bike that traveled the most in 94002?
Additional table information: table: bike_1

Answer: SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many days had both mean humidity above 50 and mean visibility above 8?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8


Question:
What is the number of days that had an average humity above 50 and an average visibility above 8?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8


Question:
What is the latitude, longitude, city of the station from which the shortest trip started?
Additional table information: table: bike_1

Answer: SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration NULLS FIRST LIMIT 1


Question:
What is the latitude, longitude, and city of the station from which the trip with smallest duration started?
Additional table information: table: bike_1

Answer: SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration NULLS FIRST LIMIT 1


Question:
What are the ids of stations that are located in San Francisco and have average bike availability above 10.
Additional table information: table: bike_1

Answer: SELECT id FROM station WHERE city = 'San Francisco' INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING AVG(bikes_available) > 10


Question:
What are the ids of the stations in San Francisco that normally have more than 10 bikes available?
Additional table information: table: bike_1

Answer: SELECT id FROM station WHERE city = 'San Francisco' INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING AVG(bikes_available) > 10


Question:
What are the names and ids of stations that had more than 14 bikes available on average or were installed in December?
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(T2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE '12/%'


Question:
What are the names and ids of all stations that have more than 14 bikes available on average or had bikes installed in December?
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(T2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE '12/%'


Question:
What is the 3 most common cloud cover rates in the region of zip code 94107?
Additional table information: table: bike_1

Answer: SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3


Question:
What are the 3 most common cloud covers in the zip code of 94107?
Additional table information: table: bike_1

Answer: SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3


Question:
What is the zip code in which the average mean sea level pressure is the lowest?
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) NULLS FIRST LIMIT 1


Question:
What is the zip code that has the lowest average mean sea level pressure?
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) NULLS FIRST LIMIT 1


Question:
What is the average bike availability in stations that are not located in Palo Alto?
Additional table information: table: bike_1

Answer: SELECT AVG(bikes_available) FROM status WHERE NOT station_id IN (SELECT id FROM station WHERE city = 'Palo Alto')


Question:
What is the average bike availablility for stations not in Palo Alto?
Additional table information: table: bike_1

Answer: SELECT AVG(bikes_available) FROM status WHERE NOT station_id IN (SELECT id FROM station WHERE city = 'Palo Alto')


Question:
What is the average longitude of stations that never had bike availability more than 10?
Additional table information: table: bike_1

Answer: SELECT AVG(long) FROM station WHERE NOT id IN (SELECT station_id FROM status GROUP BY station_id HAVING MAX(bikes_available) > 10)


Question:
What is the mean longitude for all stations that have never had more than 10 bikes available?
Additional table information: table: bike_1

Answer: SELECT AVG(long) FROM station WHERE NOT id IN (SELECT station_id FROM status GROUP BY station_id HAVING MAX(bikes_available) > 10)


Question:
When and in what zip code did max temperature reach 80?
Additional table information: table: bike_1

Answer: SELECT date, zip_code FROM weather WHERE max_temperature_f >= 80


Question:
What zip codes have a station with a max temperature greater than or equal to 80 and when did it reach that temperature?
Additional table information: table: bike_1

Answer: SELECT date, zip_code FROM weather WHERE max_temperature_f >= 80


Question:
Give me ids for all the trip that took place in a zip code area with average mean temperature above 60.
Additional table information: table: bike_1

Answer: SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING AVG(T2.mean_temperature_f) > 60


Question:
For each zip code, find the ids of all trips that have a higher average mean temperature above 60?
Additional table information: table: bike_1

Answer: SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING AVG(T2.mean_temperature_f) > 60


Question:
For each zip code, return how many times max wind speed reached 25?
Additional table information: table: bike_1

Answer: SELECT zip_code, COUNT(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code


Question:
For each zip code, how many times has the maximum wind speed reached 25 mph?
Additional table information: table: bike_1

Answer: SELECT zip_code, COUNT(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code


Question:
On which day and in which zip code was the min dew point lower than any day in zip code 94107?
Additional table information: table: bike_1

Answer: SELECT date, zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107)


Question:
Which days had a minimum dew point smaller than any day in zip code 94107, and in which zip codes were those measurements taken?
Additional table information: table: bike_1

Answer: SELECT date, zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107)


Question:
For each trip, return its ending station's installation date.
Additional table information: table: bike_1

Answer: SELECT T1.id, T2.installation_date FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id


Question:
What is the installation date for each ending station on all the trips?
Additional table information: table: bike_1

Answer: SELECT T1.id, T2.installation_date FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id


Question:
Which trip started from the station with the largest dock count? Give me the trip id.
Additional table information: table: bike_1

Answer: SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC LIMIT 1


Question:
What is the id of the trip that started from the station with the highest dock count?
Additional table information: table: bike_1

Answer: SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC LIMIT 1


Question:
Count the number of trips that did not end in San Francisco city.
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> 'San Francisco'


Question:
How many trips did not end in San Francisco?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> 'San Francisco'


Question:
In zip code 94107, on which day neither Fog nor Rain was not observed?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> 'Fog' AND EVENTS <> 'Rain'


Question:
On which day has it neither been foggy nor rained in the zip code of 94107?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> 'Fog' AND EVENTS <> 'Rain'


Question:
What are the ids of stations that have latitude above 37.4 and never had bike availability below 7?
Additional table information: table: bike_1

Answer: SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7


Question:
What are the ids of all stations that have a latitude above 37.4 and have never had less than 7 bikes available?
Additional table information: table: bike_1

Answer: SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7


Question:
What are names of stations that have average bike availability above 10 and are not located in San Jose city?
Additional table information: table: bike_1

Answer: SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = 'San Jose'


Question:
What are the names of all stations that have more than 10 bikes available and are not located in San Jose?
Additional table information: table: bike_1

Answer: SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = 'San Jose'


Question:
What are the name, latitude, and city of the station with the lowest latitude?
Additional table information: table: bike_1

Answer: SELECT name, lat, city FROM station ORDER BY lat NULLS FIRST LIMIT 1


Question:
What is the name, latitude, and city of the station that is located the furthest South?
Additional table information: table: bike_1

Answer: SELECT name, lat, city FROM station ORDER BY lat NULLS FIRST LIMIT 1


Question:
What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds?
Additional table information: table: bike_1

Answer: SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3


Question:
What is the date, average temperature and mean humidity for the days with the 3 largest maximum gust speeds?
Additional table information: table: bike_1

Answer: SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3


Question:
List the name and the number of stations for all the cities that have at least 15 stations.
Additional table information: table: bike_1

Answer: SELECT city, COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15


Question:
What is the name of every city that has at least 15 stations and how many stations does it have?
Additional table information: table: bike_1

Answer: SELECT city, COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15


Question:
Find the ids and names of stations from which at least 200 trips started.
Additional table information: table: bike_1

Answer: SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200


Question:
What are the ids and names of all start stations that were the beginning of at least 200 trips?
Additional table information: table: bike_1

Answer: SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200


Question:
Find the zip code in which the average mean visibility is lower than 10.
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10


Question:
For each zip code, select all those that have an average mean visiblity below 10.
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10


Question:
List all the cities in a decreasing order of each city's stations' highest latitude.
Additional table information: table: bike_1

Answer: SELECT city FROM station GROUP BY city ORDER BY MAX(lat) DESC


Question:
For each city, list their names in decreasing order by their highest station latitude.
Additional table information: table: bike_1

Answer: SELECT city FROM station GROUP BY city ORDER BY MAX(lat) DESC


Question:
What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate.
Additional table information: table: bike_1

Answer: SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5


Question:
What are the dates that have the 5 highest cloud cover rates and what are the rates?
Additional table information: table: bike_1

Answer: SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5


Question:
What are the ids and durations of the trips with the top 3 durations?
Additional table information: table: bike_1

Answer: SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3


Question:
What are the ids of the trips that lasted the longest and how long did they last?
Additional table information: table: bike_1

Answer: SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3


Question:
For each station, return its longitude and the average duration of trips that started from the station.
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.long, AVG(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id GROUP BY T2.start_station_id


Question:
For each start station id, what is its name, longitude and average duration of trips started there?
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.long, AVG(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id GROUP BY T2.start_station_id


Question:
For each station, find its latitude and the minimum duration of trips that ended at the station.
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.lat, MIN(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id


Question:
For each end station id, what is its name, latitude, and minimum duration for trips ended there?
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.lat, MIN(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id


Question:
List all the distinct stations from which a trip of duration below 100 started.
Additional table information: table: bike_1

Answer: SELECT DISTINCT start_station_name FROM trip WHERE duration < 100


Question:
What are all the different start station names for a trip that lasted less than 100?
Additional table information: table: bike_1

Answer: SELECT DISTINCT start_station_name FROM trip WHERE duration < 100


Question:
Find all the zip codes in which the max dew point have never reached 70.
Additional table information: table: bike_1

Answer: SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70


Question:
What are all the different zip codes that have a maximum dew point that was always below 70?
Additional table information: table: bike_1

Answer: SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70


Question:
Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103.
Additional table information: table: bike_1

Answer: SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103)


Question:
What are the ids of all trips that had a duration as long as the average trip duration in the zip code 94103?
Additional table information: table: bike_1

Answer: SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103)


Question:
What are the dates in which the mean sea level pressure was between 30.3 and 31?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31


Question:
What are the dates that have an average sea level pressure between 30.3 and 31?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31


Question:
Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference.
Additional table information: table: bike_1

Answer: SELECT date, max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f NULLS FIRST LIMIT 1


Question:
What are the days that had the smallest temperature range, and what was that range?
Additional table information: table: bike_1

Answer: SELECT date, max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f NULLS FIRST LIMIT 1


Question:
What are the id and name of the stations that have ever had more than 12 bikes available?
Additional table information: table: bike_1

Answer: SELECT DISTINCT T1.id, T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12


Question:
What are the different ids and names of the stations that have had more than 12 bikes available?
Additional table information: table: bike_1

Answer: SELECT DISTINCT T1.id, T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12


Question:
Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place.
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING COUNT(*) >= 100


Question:
What are the zip codes that have an average mean humidity below 70 and had at least 100 trips come through there?
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING COUNT(*) >= 100


Question:
What are the names of stations that are located in Palo Alto city but have never been the ending point of trips more than 100 times?
Additional table information: table: bike_1

Answer: SELECT name FROM station WHERE city = 'Palo Alto' EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING COUNT(*) > 100


Question:
What are the names of the stations that are located in Palo Alto but have never been the ending point of the trips
Additional table information: table: bike_1

Answer: SELECT name FROM station WHERE city = 'Palo Alto' EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING COUNT(*) > 100


Question:
How many trips started from Mountain View city and ended at Palo Alto city?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM station AS T1, trip AS T2, station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = 'Mountain View' AND T3.city = 'Palo Alto'


Question:
How many trips stated from  a station in Mountain View and ended at one in Palo Alto?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM station AS T1, trip AS T2, station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = 'Mountain View' AND T3.city = 'Palo Alto'


Question:
What is the average latitude and longitude of the starting points of all trips?
Additional table information: table: bike_1

Answer: SELECT AVG(T1.lat), AVG(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id


Question:
What is the average latitude and longitude of all starting stations for the trips?
Additional table information: table: bike_1

Answer: SELECT AVG(T1.lat), AVG(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id


Question:
How many books are there?
Additional table information: table: book_2

Answer: SELECT COUNT(*) FROM book


Question:
List the writers of the books in ascending alphabetical order.
Additional table information: table: book_2

Answer: SELECT Writer FROM book ORDER BY Writer ASC NULLS FIRST


Question:
List the titles of the books in ascending order of issues.
Additional table information: table: book_2

Answer: SELECT Title FROM book ORDER BY Issues ASC NULLS FIRST


Question:
What are the titles of the books whose writer is not 'Elaine Lee'?
Additional table information: table: book_2

Answer: SELECT Title FROM book WHERE Writer <> 'Elaine Lee'


Question:
What are the title and issues of the books?
Additional table information: table: book_2

Answer: SELECT Title, Issues FROM book


Question:
What are the dates of publications in descending order of price?
Additional table information: table: book_2

Answer: SELECT Publication_Date FROM publication ORDER BY Price DESC


Question:
What are the distinct publishers of publications with price higher than 5000000?
Additional table information: table: book_2

Answer: SELECT DISTINCT Publisher FROM publication WHERE Price > 5000000


Question:
List the publisher of the publication with the highest price.
Additional table information: table: book_2

Answer: SELECT Publisher FROM publication ORDER BY Price DESC LIMIT 1


Question:
List the publication dates of publications with 3 lowest prices.
Additional table information: table: book_2

Answer: SELECT Publication_Date FROM publication ORDER BY Price ASC NULLS FIRST LIMIT 3


Question:
Show the title and publication dates of books.
Additional table information: table: book_2

Answer: SELECT T1.Title, T2.Publication_Date FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID


Question:
Show writers who have published a book with price more than 4000000.
Additional table information: table: book_2

Answer: SELECT T1.Writer FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID WHERE T2.Price > 4000000


Question:
Show the titles of books in descending order of publication price.
Additional table information: table: book_2

Answer: SELECT T1.Title FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Price DESC


Question:
Show publishers that have more than one publication.
Additional table information: table: book_2

Answer: SELECT Publisher FROM publication GROUP BY Publisher HAVING COUNT(*) > 1


Question:
Show different publishers together with the number of publications they have.
Additional table information: table: book_2

Answer: SELECT Publisher, COUNT(*) FROM publication GROUP BY Publisher


Question:
Please show the most common publication date.
Additional table information: table: book_2

Answer: SELECT Publication_Date FROM publication GROUP BY Publication_Date ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the writers who have written more than one book.
Additional table information: table: book_2

Answer: SELECT Writer FROM book GROUP BY Writer HAVING COUNT(*) > 1


Question:
List the titles of books that are not published.
Additional table information: table: book_2

Answer: SELECT Title FROM book WHERE NOT Book_ID IN (SELECT Book_ID FROM publication)


Question:
Show the publishers that have publications with price higher than 10000000 and publications with price lower than 5000000.
Additional table information: table: book_2

Answer: SELECT Publisher FROM publication WHERE Price > 10000000 INTERSECT SELECT Publisher FROM publication WHERE Price < 5000000


Question:
What is the number of distinct publication dates?
Additional table information: table: book_2

Answer: SELECT COUNT(DISTINCT Publication_Date) FROM publication


Question:
How many distinct publication dates are there in our record?
Additional table information: table: book_2

Answer: SELECT COUNT(DISTINCT Publication_Date) FROM publication


Question:
Show the prices of publications whose publisher is either 'Person' or 'Wiley'
Additional table information: table: book_2

Answer: SELECT Price FROM publication WHERE Publisher = 'Person' OR Publisher = 'Wiley'


Question:
How many actors are there?
Additional table information: table: musical

Answer: SELECT COUNT(*) FROM actor


Question:
Count the number of actors.
Additional table information: table: musical

Answer: SELECT COUNT(*) FROM actor


Question:
List the name of actors in ascending alphabetical order.
Additional table information: table: musical

Answer: SELECT Name FROM actor ORDER BY Name ASC NULLS FIRST


Question:
What are the names of actors, ordered alphabetically?
Additional table information: table: musical

Answer: SELECT Name FROM actor ORDER BY Name ASC NULLS FIRST


Question:
What are the characters and duration of actors?
Additional table information: table: musical

Answer: SELECT Character, Duration FROM actor


Question:
Return the characters and durations for each actor.
Additional table information: table: musical

Answer: SELECT Character, Duration FROM actor


Question:
List the name of actors whose age is not 20.
Additional table information: table: musical

Answer: SELECT Name FROM actor WHERE Age <> 20


Question:
What are the names of actors who are not 20 years old?
Additional table information: table: musical

Answer: SELECT Name FROM actor WHERE Age <> 20


Question:
What are the characters of actors in descending order of age?
Additional table information: table: musical

Answer: SELECT Character FROM actor ORDER BY age DESC


Question:
Return the characters for actors, ordered by age descending.
Additional table information: table: musical

Answer: SELECT Character FROM actor ORDER BY age DESC


Question:
What is the duration of the oldest actor?
Additional table information: table: musical

Answer: SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1


Question:
Return the duration of the actor with the greatest age.
Additional table information: table: musical

Answer: SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1


Question:
What are the names of musicals with nominee 'Bob Fosse'?
Additional table information: table: musical

Answer: SELECT Name FROM musical WHERE Nominee = 'Bob Fosse'


Question:
Return the names of musicals who have the nominee Bob Fosse.
Additional table information: table: musical

Answer: SELECT Name FROM musical WHERE Nominee = 'Bob Fosse'


Question:
What are the distinct nominees of the musicals with the award that is not 'Tony Award'?
Additional table information: table: musical

Answer: SELECT DISTINCT Nominee FROM musical WHERE Award <> 'Tony Award'


Question:
Return the different nominees of musicals that have an award that is not the Tony Award.
Additional table information: table: musical

Answer: SELECT DISTINCT Nominee FROM musical WHERE Award <> 'Tony Award'


Question:
Show names of actors and names of musicals they are in.
Additional table information: table: musical

Answer: SELECT T1.Name, T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID


Question:
What are the names of actors and the musicals that they are in?
Additional table information: table: musical

Answer: SELECT T1.Name, T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID


Question:
Show names of actors that have appeared in musical with name 'The Phantom of the Opera'.
Additional table information: table: musical

Answer: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID WHERE T2.Name = 'The Phantom of the Opera'


Question:
What are the names of actors who have been in the musical titled The Phantom of the Opera?
Additional table information: table: musical

Answer: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID WHERE T2.Name = 'The Phantom of the Opera'


Question:
Show names of actors in descending order of the year their musical is awarded.
Additional table information: table: musical

Answer: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID ORDER BY T2.Year DESC


Question:
What are the names of actors ordered descending by the year in which their musical was awarded?
Additional table information: table: musical

Answer: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID ORDER BY T2.Year DESC


Question:
Show names of musicals and the number of actors who have appeared in the musicals.
Additional table information: table: musical

Answer: SELECT T2.Name, COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID


Question:
How many actors have appeared in each musical?
Additional table information: table: musical

Answer: SELECT T2.Name, COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID


Question:
Show names of musicals which have at least three actors.
Additional table information: table: musical

Answer: SELECT T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID HAVING COUNT(*) >= 3


Question:
What are the names of musicals who have at 3 or more actors?
Additional table information: table: musical

Answer: SELECT T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID HAVING COUNT(*) >= 3


Question:
Show different nominees and the number of musicals they have been nominated.
Additional table information: table: musical

Answer: SELECT Nominee, COUNT(*) FROM musical GROUP BY Nominee


Question:
How many musicals has each nominee been nominated for?
Additional table information: table: musical

Answer: SELECT Nominee, COUNT(*) FROM musical GROUP BY Nominee


Question:
Please show the nominee who has been nominated the greatest number of times.
Additional table information: table: musical

Answer: SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1


Question:
Who is the nominee who has been nominated for the most musicals?
Additional table information: table: musical

Answer: SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the most common result of the musicals.
Additional table information: table: musical

Answer: SELECT RESULT FROM musical GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the most frequent result across all musicals.
Additional table information: table: musical

Answer: SELECT RESULT FROM musical GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the nominees that have been nominated more than two musicals.
Additional table information: table: musical

Answer: SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2


Question:
Who are the nominees who have been nominated more than two times?
Additional table information: table: musical

Answer: SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2


Question:
List the name of musicals that do not have actors.
Additional table information: table: musical

Answer: SELECT Name FROM musical WHERE NOT Musical_ID IN (SELECT Musical_ID FROM actor)


Question:
What are the names of musicals who have no actors?
Additional table information: table: musical

Answer: SELECT Name FROM musical WHERE NOT Musical_ID IN (SELECT Musical_ID FROM actor)


Question:
Show the nominees that have nominated musicals for both 'Tony Award' and 'Drama Desk Award'.
Additional table information: table: musical

Answer: SELECT Nominee FROM musical WHERE Award = 'Tony Award' INTERSECT SELECT Nominee FROM musical WHERE Award = 'Drama Desk Award'


Question:
Who are the nominees who have been nominated for both a Tony Award and a Drama Desk Award?
Additional table information: table: musical

Answer: SELECT Nominee FROM musical WHERE Award = 'Tony Award' INTERSECT SELECT Nominee FROM musical WHERE Award = 'Drama Desk Award'


Question:
Show the musical nominee with award 'Bob Fosse' or 'Cleavant Derricks'.
Additional table information: table: musical

Answer: SELECT Nominee FROM musical WHERE Award = 'Tony Award' OR Award = 'Cleavant Derricks'


Question:
Who are the nominees who were nominated for either of the Bob Fosse or Cleavant Derricks awards?
Additional table information: table: musical

Answer: SELECT Nominee FROM musical WHERE Award = 'Tony Award' OR Award = 'Cleavant Derricks'


Question:
Find the emails of the user named 'Mary'.
Additional table information: table: twitter_1

Answer: SELECT email FROM user_profiles WHERE name = 'Mary'


Question:
What is the partition id of the user named 'Iron Man'.
Additional table information: table: twitter_1

Answer: SELECT partitionid FROM user_profiles WHERE name = 'Iron Man'


Question:
How many users are there?
Additional table information: table: twitter_1

Answer: SELECT COUNT(*) FROM user_profiles


Question:
How many followers does each user have?
Additional table information: table: twitter_1

Answer: SELECT COUNT(*) FROM follows


Question:
Find the number of followers for each user.
Additional table information: table: twitter_1

Answer: SELECT COUNT(*) FROM follows GROUP BY f1


Question:
Find the number of tweets in record.
Additional table information: table: twitter_1

Answer: SELECT COUNT(*) FROM tweets


Question:
Find the number of users who posted some tweets.
Additional table information: table: twitter_1

Answer: SELECT COUNT(DISTINCT UID) FROM tweets


Question:
Find the name and email of the user whose name contains the word ‘Swift’.
Additional table information: table: twitter_1

Answer: SELECT name, email FROM user_profiles WHERE name LIKE '%Swift%'


Question:
Find the names of users whose emails contain ‘superstar’ or ‘edu’.
Additional table information: table: twitter_1

Answer: SELECT name FROM user_profiles WHERE email LIKE '%superstar%' OR email LIKE '%edu%'


Question:
Return the text of tweets about the topic 'intern'.
Additional table information: table: twitter_1

Answer: SELECT text FROM tweets WHERE text LIKE '%intern%'


Question:
Find the name and email of the users who have more than 1000 followers.
Additional table information: table: twitter_1

Answer: SELECT name, email FROM user_profiles WHERE followers > 1000


Question:
Find the names of the users whose number of followers is greater than that of the user named 'Tyler Swift'.
Additional table information: table: twitter_1

Answer: SELECT T1.name FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING COUNT(*) > (SELECT COUNT(*) FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 WHERE T1.name = 'Tyler Swift')


Question:
Find the name and email for the users who have more than one follower.
Additional table information: table: twitter_1

Answer: SELECT T1.name, T1.email FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING COUNT(*) > 1


Question:
Find the names of users who have more than one tweet.
Additional table information: table: twitter_1

Answer: SELECT T1.name FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING COUNT(*) > 1


Question:
Find the id of users who are followed by Mary and Susan.
Additional table information: table: twitter_1

Answer: SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = 'Mary' INTERSECT SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = 'Susan'


Question:
Find the id of users who are followed by Mary or Susan.
Additional table information: table: twitter_1

Answer: SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = 'Mary' OR T1.name = 'Susan'


Question:
Find the name of the user who has the largest number of followers.
Additional table information: table: twitter_1

Answer: SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 1


Question:
Find the name and email of the user followed by the least number of people.
Additional table information: table: twitter_1

Answer: SELECT name, email FROM user_profiles ORDER BY followers NULLS FIRST LIMIT 1


Question:
List the name and number of followers for each user, and sort the results by the number of followers in descending order.
Additional table information: table: twitter_1

Answer: SELECT name, followers FROM user_profiles ORDER BY followers DESC


Question:
List the names of 5 users followed by the largest number of other users.
Additional table information: table: twitter_1

Answer: SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 5


Question:
List the text of all tweets in the order of date.
Additional table information: table: twitter_1

Answer: SELECT text FROM tweets ORDER BY createdate NULLS FIRST


Question:
Find the name of each user and number of tweets tweeted by each of them.
Additional table information: table: twitter_1

Answer: SELECT T1.name, COUNT(*) FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid


Question:
Find the name and partition id for users who tweeted less than twice.
Additional table information: table: twitter_1

Answer: SELECT T1.name, T1.partitionid FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING COUNT(*) < 2


Question:
Find the name of the user who tweeted more than once, and number of tweets tweeted by them.
Additional table information: table: twitter_1

Answer: SELECT T1.name, COUNT(*) FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING COUNT(*) > 1


Question:
Find the average number of followers for the users who do not have any tweet.
Additional table information: table: twitter_1

Answer: SELECT AVG(followers) FROM user_profiles WHERE NOT UID IN (SELECT UID FROM tweets)


Question:
Find the average number of followers for the users who had some tweets.
Additional table information: table: twitter_1

Answer: SELECT AVG(followers) FROM user_profiles WHERE UID IN (SELECT UID FROM tweets)


Question:
Find the maximum and total number of followers of all users.
Additional table information: table: twitter_1

Answer: SELECT MAX(followers), SUM(followers) FROM user_profiles


Question:
Find the names of all the catalog entries.
Additional table information: table: product_catalog

Answer: SELECT DISTINCT (catalog_entry_name) FROM catalog_contents


Question:
What are all the catalog entry names?
Additional table information: table: product_catalog

Answer: SELECT DISTINCT (catalog_entry_name) FROM catalog_contents


Question:
Find the list of attribute data types possessed by more than 3 attribute definitions.
Additional table information: table: product_catalog

Answer: SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING COUNT(*) > 3


Question:
What are the attribute data types with more than 3 attribute definitions?
Additional table information: table: product_catalog

Answer: SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING COUNT(*) > 3


Question:
What is the attribute data type of the attribute with name 'Green'?
Additional table information: table: product_catalog

Answer: SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = 'Green'


Question:
Find the attribute data type for the attribute named 'Green'.
Additional table information: table: product_catalog

Answer: SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = 'Green'


Question:
Find the name and level of catalog structure with level between 5 and 10.
Additional table information: table: product_catalog

Answer: SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10


Question:
What are the name and level of catalog structure with level number between 5 and 10
Additional table information: table: product_catalog

Answer: SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10


Question:
Find all the catalog publishers whose name contains 'Murray'
Additional table information: table: product_catalog

Answer: SELECT DISTINCT (catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE '%Murray%'


Question:
Which catalog publishers have substring 'Murray' in their names?
Additional table information: table: product_catalog

Answer: SELECT DISTINCT (catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE '%Murray%'


Question:
Which catalog publisher has published the most catalogs?
Additional table information: table: product_catalog

Answer: SELECT catalog_publisher FROM catalogs GROUP BY catalog_publisher ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the catalog publisher that has the most catalogs.
Additional table information: table: product_catalog

Answer: SELECT catalog_publisher FROM catalogs GROUP BY catalog_publisher ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names and publication dates of all catalogs that have catalog level number greater than 5.
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_name, t1.date_of_publication FROM catalogs AS t1 JOIN catalog_structure AS t2 ON t1.catalog_id = t2.catalog_id WHERE catalog_level_number > 5


Question:
What are the name and publication date of the catalogs with catalog level number above 5?
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_name, t1.date_of_publication FROM catalogs AS t1 JOIN catalog_structure AS t2 ON t1.catalog_id = t2.catalog_id WHERE catalog_level_number > 5


Question:
What are the entry names of catalog with the attribute possessed by most entries.
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.attribute_value = (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes GROUP BY attribute_value ORDER BY COUNT(*) DESC LIMIT 1)


Question:
Find the entry names of the catalog with the attribute that have the most entries.
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.attribute_value = (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes GROUP BY attribute_value ORDER BY COUNT(*) DESC LIMIT 1)


Question:
What is the entry name of the most expensive catalog (in USD)?
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1


Question:
Find the entry name of the catalog with the highest price (in USD).
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1


Question:
What is the level name of the cheapest catalog (in USD)?
Additional table information: table: product_catalog

Answer: SELECT t2.catalog_level_name FROM catalog_contents AS t1 JOIN catalog_structure AS t2 ON t1.catalog_level_number = t2.catalog_level_number ORDER BY t1.price_in_dollars NULLS FIRST LIMIT 1


Question:
Find the level name of the catalog with the lowest price (in USD).
Additional table information: table: product_catalog

Answer: SELECT t2.catalog_level_name FROM catalog_contents AS t1 JOIN catalog_structure AS t2 ON t1.catalog_level_number = t2.catalog_level_number ORDER BY t1.price_in_dollars NULLS FIRST LIMIT 1


Question:
What are the average and minimum price (in Euro) of all products?
Additional table information: table: product_catalog

Answer: SELECT AVG(price_in_euros), MIN(price_in_euros) FROM catalog_contents


Question:
Give me the average and minimum price (in Euro) of the products.
Additional table information: table: product_catalog

Answer: SELECT AVG(price_in_euros), MIN(price_in_euros) FROM catalog_contents


Question:
What is the product with the highest height? Give me the catalog entry name.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1


Question:
Which catalog content has the highest height? Give me the catalog entry name.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1


Question:
Find the name of the product that has the smallest capacity.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY capacity ASC NULLS FIRST LIMIT 1


Question:
Which catalog content has the smallest capacity? Return the catalog entry name.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY capacity ASC NULLS FIRST LIMIT 1


Question:
Find the names of all the products whose stock number starts with '2'.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE '2%'


Question:
Which catalog contents have a product stock number that starts from '2'? Show the catalog entry names.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE '2%'


Question:
Find the names of catalog entries with level number 8.
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = '8'


Question:
What are the names of catalog entries with level number 8?
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = '8'


Question:
Find the names of the products with length smaller than 3 or height greater than 5.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH < 3 OR width > 5


Question:
Which catalog contents have length below 3 or above 5? Find the catalog entry names.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH < 3 OR width > 5


Question:
Find the name and attribute ID of the attribute definitions with attribute value 0.
Additional table information: table: product_catalog

Answer: SELECT t1.attribute_name, t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0


Question:
Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID.
Additional table information: table: product_catalog

Answer: SELECT t1.attribute_name, t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0


Question:
Find the name and capacity of products with price greater than 700 (in USD).
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700


Question:
Which catalog contents has price above 700 dollars? Show their catalog entry names and capacities.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700


Question:
Find the dates on which more than one revisions were made.
Additional table information: table: product_catalog

Answer: SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 1


Question:
On which days more than one revisions were made on catalogs.
Additional table information: table: product_catalog

Answer: SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 1


Question:
How many products are there in the records?
Additional table information: table: product_catalog

Answer: SELECT COUNT(*) FROM catalog_contents


Question:
Find the total number of catalog contents.
Additional table information: table: product_catalog

Answer: SELECT COUNT(*) FROM catalog_contents


Question:
Name all the products with next entry ID greater than 8.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8


Question:
What are the catalog entry names of the products with next entry ID above 8?
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8


Question:
How many aircrafts do we have?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Aircraft


Question:
How many aircrafts exist in the database?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Aircraft


Question:
Show name and distance for all aircrafts.
Additional table information: table: flight_1

Answer: SELECT name, distance FROM Aircraft


Question:
What are the names and distances for all airplanes?
Additional table information: table: flight_1

Answer: SELECT name, distance FROM Aircraft


Question:
Show ids for all aircrafts with more than 1000 distance.
Additional table information: table: flight_1

Answer: SELECT aid FROM Aircraft WHERE distance > 1000


Question:
What are the ids of all aircrafts that can cover a distance of more than 1000?
Additional table information: table: flight_1

Answer: SELECT aid FROM Aircraft WHERE distance > 1000


Question:
How many aircrafts have distance between 1000 and 5000?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000


Question:
What is the count of aircrafts that have a distance between 1000 and 5000?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000


Question:
What is the name and distance for aircraft with id 12?
Additional table information: table: flight_1

Answer: SELECT name, distance FROM Aircraft WHERE aid = 12


Question:
What is the name and distance for the aircraft that has an id of 12?
Additional table information: table: flight_1

Answer: SELECT name, distance FROM Aircraft WHERE aid = 12


Question:
What is the minimum, average, and maximum distance of all aircrafts.
Additional table information: table: flight_1

Answer: SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft


Question:
Return the minimum, average and maximum distances traveled across all aircrafts.
Additional table information: table: flight_1

Answer: SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft


Question:
Show the id and name of the aircraft with the maximum distance.
Additional table information: table: flight_1

Answer: SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1


Question:
What is the id and name of the aircraft that can cover the maximum distance?
Additional table information: table: flight_1

Answer: SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1


Question:
Show the name of aircrafts with top three lowest distances.
Additional table information: table: flight_1

Answer: SELECT name FROM Aircraft ORDER BY distance NULLS FIRST LIMIT 3


Question:
What are the aircrafts with top 3 shortest lengthes? List their names.
Additional table information: table: flight_1

Answer: SELECT name FROM Aircraft ORDER BY distance NULLS FIRST LIMIT 3


Question:
Show names for all aircrafts with distances more than the average.
Additional table information: table: flight_1

Answer: SELECT name FROM Aircraft WHERE distance > (SELECT AVG(distance) FROM Aircraft)


Question:
What are the names of all aircrafts that can cover more distances than average?
Additional table information: table: flight_1

Answer: SELECT name FROM Aircraft WHERE distance > (SELECT AVG(distance) FROM Aircraft)


Question:
How many employees do we have?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Employee


Question:
What is the number of employees?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Employee


Question:
Show name and salary for all employees sorted by salary.
Additional table information: table: flight_1

Answer: SELECT name, salary FROM Employee ORDER BY salary NULLS FIRST


Question:
What is the name and salary of all employees in order of salary?
Additional table information: table: flight_1

Answer: SELECT name, salary FROM Employee ORDER BY salary NULLS FIRST


Question:
Show ids for all employees with at least 100000 salary.
Additional table information: table: flight_1

Answer: SELECT eid FROM Employee WHERE salary > 100000


Question:
What is the id of every employee who has at least a salary of  100000?
Additional table information: table: flight_1

Answer: SELECT eid FROM Employee WHERE salary > 100000


Question:
How many employees have salary between 100000 and 200000?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000


Question:
What is the number of employees that have a salary between 100000 and 200000?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000


Question:
What is the name and salary for employee with id 242518965?
Additional table information: table: flight_1

Answer: SELECT name, salary FROM Employee WHERE eid = 242518965


Question:
What is the name and salary of the employee with the id 242518965?
Additional table information: table: flight_1

Answer: SELECT name, salary FROM Employee WHERE eid = 242518965


Question:
What is average and maximum salary of all employees.
Additional table information: table: flight_1

Answer: SELECT AVG(salary), MAX(salary) FROM Employee


Question:
What is the average and largest salary of all employees?
Additional table information: table: flight_1

Answer: SELECT AVG(salary), MAX(salary) FROM Employee


Question:
Show the id and name of the employee with maximum salary.
Additional table information: table: flight_1

Answer: SELECT eid, name FROM Employee ORDER BY salary DESC LIMIT 1


Question:
What is the id and name of the employee with the highest salary?
Additional table information: table: flight_1

Answer: SELECT eid, name FROM Employee ORDER BY salary DESC LIMIT 1


Question:
Show the name of employees with three lowest salaries.
Additional table information: table: flight_1

Answer: SELECT name FROM Employee ORDER BY salary ASC NULLS FIRST LIMIT 3


Question:
What is the name of the 3 employees who get paid the least?
Additional table information: table: flight_1

Answer: SELECT name FROM Employee ORDER BY salary ASC NULLS FIRST LIMIT 3


Question:
Show names for all employees with salary more than the average.
Additional table information: table: flight_1

Answer: SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee)


Question:
What are the names of all employees who have a salary higher than average?
Additional table information: table: flight_1

Answer: SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee)


Question:
Show the id and salary of Mark Young.
Additional table information: table: flight_1

Answer: SELECT eid, salary FROM Employee WHERE name = 'Mark Young'


Question:
What is the id and salary of the employee named Mark Young?
Additional table information: table: flight_1

Answer: SELECT eid, salary FROM Employee WHERE name = 'Mark Young'


Question:
How many flights do we have?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Flight


Question:
What is the number of flights?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Flight


Question:
Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.
Additional table information: table: flight_1

Answer: SELECT flno, origin, destination FROM Flight ORDER BY origin NULLS FIRST


Question:
What is the flight number, origin, and destination for all flights in alphabetical order by departure cities?
Additional table information: table: flight_1

Answer: SELECT flno, origin, destination FROM Flight ORDER BY origin NULLS FIRST


Question:
Show all flight number from Los Angeles.
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight WHERE origin = 'Los Angeles'


Question:
What are the numbers of all flights coming from Los Angeles?
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight WHERE origin = 'Los Angeles'


Question:
Show origins of all flights with destination Honolulu.
Additional table information: table: flight_1

Answer: SELECT origin FROM Flight WHERE destination = 'Honolulu'


Question:
What are the origins of all flights that are headed to Honolulu?
Additional table information: table: flight_1

Answer: SELECT origin FROM Flight WHERE destination = 'Honolulu'


Question:
Show me the departure date and arrival date for all flights from Los Angeles to Honolulu.
Additional table information: table: flight_1

Answer: SELECT departure_date, arrival_date FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'


Question:
What are the departure and arrival dates of all flights from LA to Honolulu?
Additional table information: table: flight_1

Answer: SELECT departure_date, arrival_date FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'


Question:
Show flight number for all flights with more than 2000 distance.
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight WHERE distance > 2000


Question:
What are the numbers of all flights that can cover a distance of more than 2000?
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight WHERE distance > 2000


Question:
What is the average price for flights from Los Angeles to Honolulu.
Additional table information: table: flight_1

Answer: SELECT AVG(price) FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'


Question:
What is the average price for flights from LA to Honolulu?
Additional table information: table: flight_1

Answer: SELECT AVG(price) FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'


Question:
Show origin and destination for flights with price higher than 300.
Additional table information: table: flight_1

Answer: SELECT origin, destination FROM Flight WHERE price > 300


Question:
What is the origin and destination for all flights whose price is higher than 300?
Additional table information: table: flight_1

Answer: SELECT origin, destination FROM Flight WHERE price > 300


Question:
Show the flight number and distance of the flight with maximum price.
Additional table information: table: flight_1

Answer: SELECT flno, distance FROM Flight ORDER BY price DESC LIMIT 1


Question:
What is the flight number and its distance for the one with the maximum price?
Additional table information: table: flight_1

Answer: SELECT flno, distance FROM Flight ORDER BY price DESC LIMIT 1


Question:
Show the flight number of flights with three lowest distances.
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight ORDER BY distance ASC NULLS FIRST LIMIT 3


Question:
What are the numbers of the shortest flights?
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight ORDER BY distance ASC NULLS FIRST LIMIT 3


Question:
What is the average distance and average price for flights from Los Angeles.
Additional table information: table: flight_1

Answer: SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = 'Los Angeles'


Question:
What is the average distance and price for all flights from LA?
Additional table information: table: flight_1

Answer: SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = 'Los Angeles'


Question:
Show all origins and the number of flights from each origin.
Additional table information: table: flight_1

Answer: SELECT origin, COUNT(*) FROM Flight GROUP BY origin


Question:
For each origin, how many flights came from there?
Additional table information: table: flight_1

Answer: SELECT origin, COUNT(*) FROM Flight GROUP BY origin


Question:
Show all destinations and the number of flights to each destination.
Additional table information: table: flight_1

Answer: SELECT destination, COUNT(*) FROM Flight GROUP BY destination


Question:
What are the destinations and number of flights to each one?
Additional table information: table: flight_1

Answer: SELECT destination, COUNT(*) FROM Flight GROUP BY destination


Question:
Which origin has most number of flights?
Additional table information: table: flight_1

Answer: SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1


Question:
What place has the most flights coming from there?
Additional table information: table: flight_1

Answer: SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which destination has least number of flights?
Additional table information: table: flight_1

Answer: SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What destination has the fewest number of flights?
Additional table information: table: flight_1

Answer: SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What is the aircraft name for the flight with number 99
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99


Question:
What is the name of the aircraft that was on flight number 99?
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99


Question:
Show all flight numbers with aircraft Airbus A340-300.
Additional table information: table: flight_1

Answer: SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = 'Airbus A340-300'


Question:
What are the flight numbers for the aircraft Airbus A340-300?
Additional table information: table: flight_1

Answer: SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = 'Airbus A340-300'


Question:
Show aircraft names and number of flights for each aircraft.
Additional table information: table: flight_1

Answer: SELECT T2.name, COUNT(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid


Question:
What is the name of each aircraft and how many flights does each one complete?
Additional table information: table: flight_1

Answer: SELECT T2.name, COUNT(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid


Question:
Show names for all aircraft with at least two flights.
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING COUNT(*) >= 2


Question:
What are the names for all aircrafts with at least 2 flights?
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING COUNT(*) >= 2


Question:
How many employees have certificate.
Additional table information: table: flight_1

Answer: SELECT COUNT(DISTINCT eid) FROM Certificate


Question:
What is the count of distinct employees with certificates?
Additional table information: table: flight_1

Answer: SELECT COUNT(DISTINCT eid) FROM Certificate


Question:
Show ids for all employees who don't have a certificate.
Additional table information: table: flight_1

Answer: SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate


Question:
What are the ids of all employees that don't have certificates?
Additional table information: table: flight_1

Answer: SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate


Question:
Show names for all aircrafts of which John Williams has certificates.
Additional table information: table: flight_1

Answer: SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = 'John Williams'


Question:
What are the names of all aircrafts that John Williams have certificates to be able to fly?
Additional table information: table: flight_1

Answer: SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = 'John Williams'


Question:
Show names for all employees who have certificate of Boeing 737-800.
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800'


Question:
What are the names of all employees who have a certificate to fly Boeing 737-800?
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800'


Question:
Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800' INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Airbus A340-300'