text "convert the question into postgresql query using the context values ### Question: How many heads of the departments are older than 56 ? ### Context: CREATE TABLE head (age INTEGER) ###Answer: SELECT COUNT(*) FROM head WHERE age > 56" "convert the question into postgresql query using the context values ### Question: List the name, born state and age of the heads of departments ordered by age. ### Context: CREATE TABLE head (name VARCHAR, born_state VARCHAR, age VARCHAR) ###Answer: SELECT name, born_state, age FROM head ORDER BY age" "convert the question into postgresql query using the context values ### Question: List the creation year, name and budget of each department. ### Context: CREATE TABLE department (creation VARCHAR, name VARCHAR, budget_in_billions VARCHAR) ###Answer: SELECT creation, name, budget_in_billions FROM department" "convert the question into postgresql query using the context values ### Question: What are the maximum and minimum budget of the departments? ### Context: CREATE TABLE department (budget_in_billions INTEGER) ###Answer: SELECT MAX(budget_in_billions), MIN(budget_in_billions) FROM department" "convert the question into postgresql query using the context values ### Question: What is the average number of employees of the departments whose rank is between 10 and 15? ### Context: CREATE TABLE department (num_employees INTEGER, ranking INTEGER) ###Answer: SELECT AVG(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15" "convert the question into postgresql query using the context values ### Question: What are the names of the heads who are born outside the California state? ### Context: CREATE TABLE head (name VARCHAR, born_state VARCHAR) ###Answer: SELECT name FROM head WHERE born_state <> 'California'" "convert the question into postgresql query using the context values ### Question: What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? ### Context: CREATE TABLE department (creation VARCHAR, department_id VARCHAR); CREATE TABLE management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE head (head_id VARCHAR, born_state VARCHAR) ###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'" "convert the question into postgresql query using the context values ### Question: What are the names of the states where at least 3 heads were born? ### Context: CREATE TABLE head (born_state VARCHAR) ###Answer: SELECT born_state FROM head GROUP BY born_state HAVING COUNT(*) >= 3" "convert the question into postgresql query using the context values ### Question: In which year were most departments established? ### Context: CREATE TABLE department (creation VARCHAR) ###Answer: SELECT creation FROM department GROUP BY creation ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'? ### Context: CREATE TABLE management (department_id VARCHAR, temporary_acting VARCHAR); CREATE TABLE department (name VARCHAR, num_employees VARCHAR, department_id VARCHAR) ###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'" "convert the question into postgresql query using the context values ### Question: How many acting statuses are there? ### Context: CREATE TABLE management (temporary_acting VARCHAR) ###Answer: SELECT COUNT(DISTINCT temporary_acting) FROM management" "convert the question into postgresql query using the context values ### Question: How many departments are led by heads who are not mentioned? ### Context: CREATE TABLE management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR) ###Answer: SELECT COUNT(*) FROM department WHERE NOT department_id IN (SELECT department_id FROM management)" "convert the question into postgresql query using the context values ### Question: What are the distinct ages of the heads who are acting? ### Context: CREATE TABLE head (age VARCHAR, head_id VARCHAR); CREATE TABLE management (head_id VARCHAR, temporary_acting VARCHAR) ###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'" "convert the question into postgresql query using the context values ### Question: List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. ### Context: CREATE TABLE management (department_id VARCHAR, head_id VARCHAR); CREATE TABLE head (born_state VARCHAR, head_id VARCHAR); CREATE TABLE department (department_id VARCHAR, name VARCHAR) ###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'" "convert the question into postgresql query using the context values ### Question: Which department has more than 1 head at a time? List the id, name and the number of heads. ### Context: CREATE TABLE management (department_id VARCHAR); CREATE TABLE department (department_id VARCHAR, name VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Which head's name has the substring 'Ha'? List the id and name. ### Context: CREATE TABLE head (head_id VARCHAR, name VARCHAR) ###Answer: SELECT head_id, name FROM head WHERE name LIKE '%Ha%'" "convert the question into postgresql query using the context values ### Question: How many farms are there? ### Context: CREATE TABLE farm (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM farm" "convert the question into postgresql query using the context values ### Question: List the total number of horses on farms in ascending order. ### Context: CREATE TABLE farm (Total_Horses VARCHAR) ###Answer: SELECT Total_Horses FROM farm ORDER BY Total_Horses" "convert the question into postgresql query using the context values ### Question: What are the hosts of competitions whose theme is not ""Aliens""? ### Context: CREATE TABLE farm_competition (Hosts VARCHAR, Theme VARCHAR) ###Answer: SELECT Hosts FROM farm_competition WHERE Theme <> 'Aliens'" "convert the question into postgresql query using the context values ### Question: What are the themes of farm competitions sorted by year in ascending order? ### Context: CREATE TABLE farm_competition (Theme VARCHAR, YEAR VARCHAR) ###Answer: SELECT Theme FROM farm_competition ORDER BY YEAR" "convert the question into postgresql query using the context values ### Question: What is the average number of working horses of farms with more than 5000 total number of horses? ### Context: CREATE TABLE farm (Working_Horses INTEGER, Total_Horses INTEGER) ###Answer: SELECT AVG(Working_Horses) FROM farm WHERE Total_Horses > 5000" "convert the question into postgresql query using the context values ### Question: What are the maximum and minimum number of cows across all farms. ### Context: CREATE TABLE farm (Cows INTEGER) ###Answer: SELECT MAX(Cows), MIN(Cows) FROM farm" "convert the question into postgresql query using the context values ### Question: How many different statuses do cities have? ### Context: CREATE TABLE city (Status VARCHAR) ###Answer: SELECT COUNT(DISTINCT Status) FROM city" "convert the question into postgresql query using the context values ### Question: List official names of cities in descending order of population. ### Context: CREATE TABLE city (Official_Name VARCHAR, Population VARCHAR) ###Answer: SELECT Official_Name FROM city ORDER BY Population DESC" "convert the question into postgresql query using the context values ### Question: List the official name and status of the city with the largest population. ### Context: CREATE TABLE city (Official_Name VARCHAR, Status VARCHAR, Population VARCHAR) ###Answer: SELECT Official_Name, Status FROM city ORDER BY Population DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the years and the official names of the host cities of competitions. ### Context: CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Year VARCHAR, Host_city_ID VARCHAR) ###Answer: SELECT T2.Year, T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID" "convert the question into postgresql query using the context values ### Question: Show the official names of the cities that have hosted more than one competition. ### Context: CREATE TABLE farm_competition (Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Show the status of the city that has hosted the greatest number of competitions. ### Context: CREATE TABLE city (Status VARCHAR, City_ID VARCHAR); CREATE TABLE farm_competition (Host_city_ID VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Please show the themes of competitions with host cities having populations larger than 1000. ### Context: CREATE TABLE city (City_ID VARCHAR, Population INTEGER); CREATE TABLE farm_competition (Theme VARCHAR, Host_city_ID VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Please show the different statuses of cities and the average population of cities with each status. ### Context: CREATE TABLE city (Status VARCHAR, Population INTEGER) ###Answer: SELECT Status, AVG(Population) FROM city GROUP BY Status" "convert the question into postgresql query using the context values ### Question: Please show the different statuses, ordered by the number of cities that have each. ### Context: CREATE TABLE city (Status VARCHAR) ###Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*)" "convert the question into postgresql query using the context values ### Question: List the most common type of Status across cities. ### Context: CREATE TABLE city (Status VARCHAR) ###Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the official names of cities that have not held any competition. ### Context: CREATE TABLE farm_competition (Official_Name VARCHAR, City_ID VARCHAR, Host_city_ID VARCHAR); CREATE TABLE city (Official_Name VARCHAR, City_ID VARCHAR, Host_city_ID VARCHAR) ###Answer: SELECT Official_Name FROM city WHERE NOT City_ID IN (SELECT Host_city_ID FROM farm_competition)" "convert the question into postgresql query using the context values ### Question: Show the status shared by cities with population bigger than 1500 and smaller than 500. ### Context: CREATE TABLE city (Status VARCHAR, Population INTEGER) ###Answer: SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500" "convert the question into postgresql query using the context values ### Question: Find the official names of cities with population bigger than 1500 or smaller than 500. ### Context: CREATE TABLE city (Official_Name VARCHAR, Population VARCHAR) ###Answer: SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500" "convert the question into postgresql query using the context values ### Question: Show the census ranking of cities whose status are not ""Village"". ### Context: CREATE TABLE city (Census_Ranking VARCHAR, Status VARCHAR) ###Answer: SELECT Census_Ranking FROM city WHERE Status <> ""Village""" "convert the question into postgresql query using the context values ### Question: which course has most number of registered students? ### Context: CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (course_Id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: what is id of students who registered some courses but the least number of courses in these students? ### Context: CREATE TABLE student_course_registrations (student_id VARCHAR) ###Answer: SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: what are the first name and last name of all candidates? ### Context: CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (first_name VARCHAR, last_name VARCHAR, person_id VARCHAR) ###Answer: SELECT T2.first_name, T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id" "convert the question into postgresql query using the context values ### Question: List the id of students who never attends courses? ### Context: CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE students (student_id VARCHAR) ###Answer: SELECT student_id FROM students WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)" "convert the question into postgresql query using the context values ### Question: List the id of students who attended some courses? ### Context: CREATE TABLE student_course_attendance (student_id VARCHAR) ###Answer: SELECT student_id FROM student_course_attendance" "convert the question into postgresql query using the context values ### Question: What are the ids of all students for courses and what are the names of those courses? ### Context: CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR, course_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: What is detail of the student who most recently registered course? ### Context: CREATE TABLE student_course_registrations (student_id VARCHAR, registration_date VARCHAR); CREATE TABLE students (student_details VARCHAR, student_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: How many students attend course English? ### Context: CREATE TABLE student_course_attendance (course_id VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: How many courses do the student whose id is 171 attend? ### Context: CREATE TABLE courses (course_id VARCHAR); CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Find id of the candidate whose email is stanley.monahan@example.org? ### Context: CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (person_id VARCHAR, email_address VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Find id of the candidate who most recently accessed the course? ### Context: CREATE TABLE candidate_assessments (candidate_id VARCHAR, assessment_date VARCHAR) ###Answer: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is detail of the student who registered the most number of courses? ### Context: CREATE TABLE students (student_details VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: List the id of students who registered some courses and the number of their registered courses? ### Context: CREATE TABLE students (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: How many registed students do each course have? List course name and the number of their registered students? ### Context: CREATE TABLE students (student_id VARCHAR); CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR); CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Find id of candidates whose assessment code is ""Pass""? ### Context: CREATE TABLE candidate_assessments (candidate_id VARCHAR, asessment_outcome_code VARCHAR) ###Answer: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = ""Pass""" "convert the question into postgresql query using the context values ### Question: Find the cell mobile number of the candidates whose assessment code is ""Fail""? ### Context: CREATE TABLE candidates (candidate_id VARCHAR); CREATE TABLE people (cell_mobile_number VARCHAR, person_id VARCHAR); CREATE TABLE candidate_assessments (candidate_id VARCHAR, asessment_outcome_code VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: What are the id of students who registered course 301? ### Context: CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR) ###Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301" "convert the question into postgresql query using the context values ### Question: What is the id of the student who most recently registered course 301? ### Context: CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR) ###Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find distinct cities of addresses of people? ### Context: CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id VARCHAR) ###Answer: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id" "convert the question into postgresql query using the context values ### Question: Find distinct cities of address of students? ### Context: CREATE TABLE students (student_id VARCHAR); CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE people_addresses (address_id VARCHAR, person_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: List the names of courses in alphabetical order? ### Context: CREATE TABLE courses (course_name VARCHAR) ###Answer: SELECT course_name FROM courses ORDER BY course_name" "convert the question into postgresql query using the context values ### Question: List the first names of people in alphabetical order? ### Context: CREATE TABLE people (first_name VARCHAR) ###Answer: SELECT first_name FROM people ORDER BY first_name" "convert the question into postgresql query using the context values ### Question: What are the id of students who registered courses or attended courses? ### Context: CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) ###Answer: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance" "convert the question into postgresql query using the context values ### Question: Find the id of courses which are registered or attended by student whose id is 121? ### Context: CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR); CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR) ###Answer: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121" "convert the question into postgresql query using the context values ### Question: What are all info of students who registered courses but not attended courses? ### Context: CREATE TABLE student_course_attendance (student_id VARCHAR); CREATE TABLE student_course_registrations (student_id VARCHAR) ###Answer: SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)" "convert the question into postgresql query using the context values ### Question: List the id of students who registered course statistics in the order of registration date. ### Context: CREATE TABLE student_course_registrations (student_id VARCHAR, course_id VARCHAR, registration_date VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: List the id of students who attended statistics courses in the order of attendance date. ### Context: CREATE TABLE student_course_attendance (student_id VARCHAR, course_id VARCHAR, date_of_attendance VARCHAR); CREATE TABLE courses (course_id VARCHAR, course_name VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Give me the dates when the max temperature was higher than 85. ### Context: CREATE TABLE weather (date VARCHAR, max_temperature_f INTEGER) ###Answer: SELECT date FROM weather WHERE max_temperature_f > 85" "convert the question into postgresql query using the context values ### Question: What are the names of stations that have latitude lower than 37.5? ### Context: CREATE TABLE station (name VARCHAR, lat INTEGER) ###Answer: SELECT name FROM station WHERE lat < 37.5" "convert the question into postgresql query using the context values ### Question: For each city, return the highest latitude among its stations. ### Context: CREATE TABLE station (city VARCHAR, lat INTEGER) ###Answer: SELECT city, MAX(lat) FROM station GROUP BY city" "convert the question into postgresql query using the context values ### Question: Give me the start station and end station for the trips with the three oldest id. ### Context: CREATE TABLE trip (start_station_name VARCHAR, end_station_name VARCHAR, id VARCHAR) ###Answer: SELECT start_station_name, end_station_name FROM trip ORDER BY id LIMIT 3" "convert the question into postgresql query using the context values ### Question: What is the average latitude and longitude of stations located in San Jose city? ### Context: CREATE TABLE station (lat INTEGER, long INTEGER, city VARCHAR) ###Answer: SELECT AVG(lat), AVG(long) FROM station WHERE city = ""San Jose""" "convert the question into postgresql query using the context values ### Question: What is the id of the trip that has the shortest duration? ### Context: CREATE TABLE trip (id VARCHAR, duration VARCHAR) ###Answer: SELECT id FROM trip ORDER BY duration LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the total and maximum duration of trips with bike id 636? ### Context: CREATE TABLE trip (duration INTEGER, bike_id VARCHAR) ###Answer: SELECT SUM(duration), MAX(duration) FROM trip WHERE bike_id = 636" "convert the question into postgresql query using the context values ### Question: For each zip code, return the average mean temperature of August there. ### Context: CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER, date VARCHAR) ###Answer: SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE ""8/%"" GROUP BY zip_code" "convert the question into postgresql query using the context values ### Question: From the trip record, find the number of unique bikes. ### Context: CREATE TABLE trip (bike_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT bike_id) FROM trip" "convert the question into postgresql query using the context values ### Question: What is the number of distinct cities the stations are located at? ### Context: CREATE TABLE station (city VARCHAR) ###Answer: SELECT COUNT(DISTINCT city) FROM station" "convert the question into postgresql query using the context values ### Question: How many stations does Mountain View city has? ### Context: CREATE TABLE station (city VARCHAR) ###Answer: SELECT COUNT(*) FROM station WHERE city = ""Mountain View""" "convert the question into postgresql query using the context values ### Question: Return the unique name for stations that have ever had 7 bikes available. ### Context: CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available VARCHAR) ###Answer: SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7" "convert the question into postgresql query using the context values ### Question: Which start station had the most trips starting from August? Give me the name and id of the station. ### Context: CREATE TABLE trip (start_station_name VARCHAR, start_station_id VARCHAR, start_date VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Which bike traveled the most often in zip code 94002? ### Context: CREATE TABLE trip (bike_id VARCHAR, zip_code VARCHAR) ###Answer: SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many days had both mean humidity above 50 and mean visibility above 8? ### Context: CREATE TABLE weather (mean_humidity VARCHAR, mean_visibility_miles VARCHAR) ###Answer: SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8" "convert the question into postgresql query using the context values ### Question: What is the latitude, longitude, city of the station from which the shortest trip started? ### Context: CREATE TABLE trip (start_station_id VARCHAR, duration VARCHAR); CREATE TABLE station (lat VARCHAR, long VARCHAR, city VARCHAR, id VARCHAR) ###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 LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the ids of stations that are located in San Francisco and have average bike availability above 10. ### Context: CREATE TABLE status (id VARCHAR, station_id VARCHAR, city VARCHAR, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR, city VARCHAR, bikes_available INTEGER) ###Answer: SELECT id FROM station WHERE city = ""San Francisco"" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING AVG(bikes_available) > 10" "convert the question into postgresql query using the context values ### Question: What are the names and ids of stations that had more than 14 bikes available on average or were installed in December? ### Context: CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE station (name VARCHAR, id VARCHAR, installation_date VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available INTEGER) ###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/%""" "convert the question into postgresql query using the context values ### Question: What is the 3 most common cloud cover rates in the region of zip code 94107? ### Context: CREATE TABLE weather (cloud_cover VARCHAR, zip_code VARCHAR) ###Answer: SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: What is the zip code in which the average mean sea level pressure is the lowest? ### Context: CREATE TABLE weather (zip_code VARCHAR, mean_sea_level_pressure_inches INTEGER) ###Answer: SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the average bike availability in stations that are not located in Palo Alto? ### Context: CREATE TABLE status (bikes_available INTEGER, station_id VARCHAR, id VARCHAR, city VARCHAR); CREATE TABLE station (bikes_available INTEGER, station_id VARCHAR, id VARCHAR, city VARCHAR) ###Answer: SELECT AVG(bikes_available) FROM status WHERE NOT station_id IN (SELECT id FROM station WHERE city = ""Palo Alto"")" "convert the question into postgresql query using the context values ### Question: What is the average longitude of stations that never had bike availability more than 10? ### Context: CREATE TABLE station (long INTEGER, id VARCHAR, station_id VARCHAR, bikes_available INTEGER); CREATE TABLE status (long INTEGER, id VARCHAR, station_id VARCHAR, bikes_available INTEGER) ###Answer: SELECT AVG(long) FROM station WHERE NOT id IN (SELECT station_id FROM status GROUP BY station_id HAVING MAX(bikes_available) > 10)" "convert the question into postgresql query using the context values ### Question: When and in what zip code did max temperature reach 80? ### Context: CREATE TABLE weather (date VARCHAR, zip_code VARCHAR, max_temperature_f VARCHAR) ###Answer: SELECT date, zip_code FROM weather WHERE max_temperature_f >= 80" "convert the question into postgresql query using the context values ### Question: Give me ids for all the trip that took place in a zip code area with average mean temperature above 60. ### Context: CREATE TABLE trip (id VARCHAR, zip_code VARCHAR); CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER) ###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" "convert the question into postgresql query using the context values ### Question: For each zip code, return how many times max wind speed reached 25? ### Context: CREATE TABLE weather (zip_code VARCHAR, max_wind_Speed_mph VARCHAR) ###Answer: SELECT zip_code, COUNT(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code" "convert the question into postgresql query using the context values ### Question: On which day and in which zip code was the min dew point lower than any day in zip code 94107? ### Context: CREATE TABLE weather (date VARCHAR, zip_code VARCHAR, min_dew_point_f INTEGER) ###Answer: SELECT date, zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107)" "convert the question into postgresql query using the context values ### Question: For each trip, return its ending station's installation date. ### Context: CREATE TABLE station (installation_date VARCHAR, id VARCHAR); CREATE TABLE trip (id VARCHAR, end_station_id VARCHAR) ###Answer: SELECT T1.id, T2.installation_date FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id" "convert the question into postgresql query using the context values ### Question: Which trip started from the station with the largest dock count? Give me the trip id. ### Context: CREATE TABLE trip (id VARCHAR, start_station_id VARCHAR); CREATE TABLE station (id VARCHAR, dock_count VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Count the number of trips that did not end in San Francisco city. ### Context: CREATE TABLE trip (end_station_id VARCHAR); CREATE TABLE station (id VARCHAR, city VARCHAR) ###Answer: SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> ""San Francisco""" "convert the question into postgresql query using the context values ### Question: In zip code 94107, on which day neither Fog nor Rain was not observed? ### Context: CREATE TABLE weather (date VARCHAR, EVENTS VARCHAR, zip_code VARCHAR) ###Answer: SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> ""Fog"" AND EVENTS <> ""Rain""" "convert the question into postgresql query using the context values ### Question: What are the ids of stations that have latitude above 37.4 and never had bike availability below 7? ### Context: CREATE TABLE status (id VARCHAR, station_id VARCHAR, lat INTEGER, bikes_available INTEGER); CREATE TABLE station (id VARCHAR, station_id VARCHAR, lat INTEGER, bikes_available INTEGER) ###Answer: SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7" "convert the question into postgresql query using the context values ### Question: What are names of stations that have average bike availability above 10 and are not located in San Jose city? ### Context: CREATE TABLE station (name VARCHAR, id VARCHAR); CREATE TABLE status (station_id VARCHAR); CREATE TABLE station (name VARCHAR, city VARCHAR, bikes_available INTEGER) ###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""" "convert the question into postgresql query using the context values ### Question: What are the name, latitude, and city of the station with the lowest latitude? ### Context: CREATE TABLE station (name VARCHAR, lat VARCHAR, city VARCHAR) ###Answer: SELECT name, lat, city FROM station ORDER BY lat LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds? ### Context: CREATE TABLE weather (date VARCHAR, mean_temperature_f VARCHAR, mean_humidity VARCHAR, max_gust_speed_mph VARCHAR) ###Answer: SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: List the name and the number of stations for all the cities that have at least 15 stations. ### Context: CREATE TABLE station (city VARCHAR) ###Answer: SELECT city, COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15" "convert the question into postgresql query using the context values ### Question: Find the ids and names of stations from which at least 200 trips started. ### Context: CREATE TABLE trip (start_station_id VARCHAR, start_station_name VARCHAR) ###Answer: SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200" "convert the question into postgresql query using the context values ### Question: Find the zip code in which the average mean visibility is lower than 10. ### Context: CREATE TABLE weather (zip_code VARCHAR, mean_visibility_miles INTEGER) ###Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10" "convert the question into postgresql query using the context values ### Question: List all the cities in a decreasing order of each city's stations' highest latitude. ### Context: CREATE TABLE station (city VARCHAR, lat INTEGER) ###Answer: SELECT city FROM station GROUP BY city ORDER BY MAX(lat) DESC" "convert the question into postgresql query using the context values ### Question: What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate. ### Context: CREATE TABLE weather (date VARCHAR, cloud_cover VARCHAR) ###Answer: SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: What are the ids and durations of the trips with the top 3 durations? ### Context: CREATE TABLE trip (id VARCHAR, duration VARCHAR) ###Answer: SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: For each station, return its longitude and the average duration of trips that started from the station. ### Context: CREATE TABLE station (name VARCHAR, long VARCHAR, id VARCHAR); CREATE TABLE trip (duration INTEGER, start_station_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: For each station, find its latitude and the minimum duration of trips that ended at the station. ### Context: CREATE TABLE trip (duration INTEGER, end_station_id VARCHAR); CREATE TABLE station (name VARCHAR, lat VARCHAR, id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: List all the distinct stations from which a trip of duration below 100 started. ### Context: CREATE TABLE trip (start_station_name VARCHAR, duration INTEGER) ###Answer: SELECT DISTINCT start_station_name FROM trip WHERE duration < 100" "convert the question into postgresql query using the context values ### Question: Find all the zip codes in which the max dew point have never reached 70. ### Context: CREATE TABLE weather (zip_code VARCHAR, max_dew_point_f VARCHAR) ###Answer: SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70" "convert the question into postgresql query using the context values ### Question: Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103. ### Context: CREATE TABLE trip (id VARCHAR, duration INTEGER, zip_code VARCHAR) ###Answer: SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103)" "convert the question into postgresql query using the context values ### Question: What are the dates in which the mean sea level pressure was between 30.3 and 31? ### Context: CREATE TABLE weather (date VARCHAR, mean_sea_level_pressure_inches INTEGER) ###Answer: SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31" "convert the question into postgresql query using the context values ### Question: Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference. ### Context: CREATE TABLE weather (date VARCHAR, max_temperature_f VARCHAR, min_temperature_f VARCHAR) ###Answer: SELECT date, max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the id and name of the stations that have ever had more than 12 bikes available? ### Context: CREATE TABLE station (id VARCHAR, name VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available INTEGER) ###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" "convert the question into postgresql query using the context values ### Question: Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place. ### Context: CREATE TABLE weather (zip_code VARCHAR, mean_humidity INTEGER); CREATE TABLE trip (zip_code VARCHAR, mean_humidity INTEGER) ###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" "convert the question into postgresql query using the context values ### 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? ### Context: CREATE TABLE trip (name VARCHAR, end_station_name VARCHAR, city VARCHAR); CREATE TABLE station (name VARCHAR, end_station_name VARCHAR, city VARCHAR) ###Answer: SELECT name FROM station WHERE city = ""Palo Alto"" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING COUNT(*) > 100" "convert the question into postgresql query using the context values ### Question: How many trips started from Mountain View city and ended at Palo Alto city? ### Context: CREATE TABLE station (city VARCHAR, id VARCHAR); CREATE TABLE trip (end_station_id VARCHAR, id VARCHAR); CREATE TABLE station (id VARCHAR, city VARCHAR); CREATE TABLE trip (start_station_id VARCHAR, id VARCHAR) ###Answer: SELECT COUNT(*) FROM station AS T1 JOIN trip AS T2 JOIN 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""" "convert the question into postgresql query using the context values ### Question: What is the average latitude and longitude of the starting points of all trips? ### Context: CREATE TABLE trip (start_station_id VARCHAR); CREATE TABLE station (lat INTEGER, long INTEGER, id VARCHAR) ###Answer: SELECT AVG(T1.lat), AVG(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id" "convert the question into postgresql query using the context values ### Question: How many books are there? ### Context: CREATE TABLE book (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM book" "convert the question into postgresql query using the context values ### Question: List the writers of the books in ascending alphabetical order. ### Context: CREATE TABLE book (Writer VARCHAR) ###Answer: SELECT Writer FROM book ORDER BY Writer" "convert the question into postgresql query using the context values ### Question: List the titles of the books in ascending order of issues. ### Context: CREATE TABLE book (Title VARCHAR, Issues VARCHAR) ###Answer: SELECT Title FROM book ORDER BY Issues" "convert the question into postgresql query using the context values ### Question: What are the titles of the books whose writer is not ""Elaine Lee""? ### Context: CREATE TABLE book (Title VARCHAR, Writer VARCHAR) ###Answer: SELECT Title FROM book WHERE Writer <> ""Elaine Lee""" "convert the question into postgresql query using the context values ### Question: What are the title and issues of the books? ### Context: CREATE TABLE book (Title VARCHAR, Issues VARCHAR) ###Answer: SELECT Title, Issues FROM book" "convert the question into postgresql query using the context values ### Question: What are the dates of publications in descending order of price? ### Context: CREATE TABLE publication (Publication_Date VARCHAR, Price VARCHAR) ###Answer: SELECT Publication_Date FROM publication ORDER BY Price DESC" "convert the question into postgresql query using the context values ### Question: What are the distinct publishers of publications with price higher than 5000000? ### Context: CREATE TABLE publication (Publisher VARCHAR, Price INTEGER) ###Answer: SELECT DISTINCT Publisher FROM publication WHERE Price > 5000000" "convert the question into postgresql query using the context values ### Question: List the publisher of the publication with the highest price. ### Context: CREATE TABLE publication (Publisher VARCHAR, Price VARCHAR) ###Answer: SELECT Publisher FROM publication ORDER BY Price DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the publication dates of publications with 3 lowest prices. ### Context: CREATE TABLE publication (Publication_Date VARCHAR, Price VARCHAR) ###Answer: SELECT Publication_Date FROM publication ORDER BY Price LIMIT 3" "convert the question into postgresql query using the context values ### Question: Show the title and publication dates of books. ### Context: CREATE TABLE book (Title VARCHAR, Book_ID VARCHAR); CREATE TABLE publication (Publication_Date VARCHAR, Book_ID VARCHAR) ###Answer: SELECT T1.Title, T2.Publication_Date FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID" "convert the question into postgresql query using the context values ### Question: Show writers who have published a book with price more than 4000000. ### Context: CREATE TABLE publication (Book_ID VARCHAR, Price INTEGER); CREATE TABLE book (Writer VARCHAR, Book_ID VARCHAR) ###Answer: SELECT T1.Writer FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID WHERE T2.Price > 4000000" "convert the question into postgresql query using the context values ### Question: Show the titles of books in descending order of publication price. ### Context: CREATE TABLE publication (Book_ID VARCHAR, Price VARCHAR); CREATE TABLE book (Title VARCHAR, Book_ID VARCHAR) ###Answer: SELECT T1.Title FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Price DESC" "convert the question into postgresql query using the context values ### Question: Show publishers that have more than one publication. ### Context: CREATE TABLE publication (Publisher VARCHAR) ###Answer: SELECT Publisher FROM publication GROUP BY Publisher HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Show different publishers together with the number of publications they have. ### Context: CREATE TABLE publication (Publisher VARCHAR) ###Answer: SELECT Publisher, COUNT(*) FROM publication GROUP BY Publisher" "convert the question into postgresql query using the context values ### Question: Please show the most common publication date. ### Context: CREATE TABLE publication (Publication_Date VARCHAR) ###Answer: SELECT Publication_Date FROM publication GROUP BY Publication_Date ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the writers who have written more than one book. ### Context: CREATE TABLE book (Writer VARCHAR) ###Answer: SELECT Writer FROM book GROUP BY Writer HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: List the titles of books that are not published. ### Context: CREATE TABLE book (Title VARCHAR, Book_ID VARCHAR); CREATE TABLE publication (Title VARCHAR, Book_ID VARCHAR) ###Answer: SELECT Title FROM book WHERE NOT Book_ID IN (SELECT Book_ID FROM publication)" "convert the question into postgresql query using the context values ### Question: Show the publishers that have publications with price higher than 10000000 and publications with price lower than 5000000. ### Context: CREATE TABLE publication (Publisher VARCHAR, Price INTEGER) ###Answer: SELECT Publisher FROM publication WHERE Price > 10000000 INTERSECT SELECT Publisher FROM publication WHERE Price < 5000000" "convert the question into postgresql query using the context values ### Question: What is the number of distinct publication dates? ### Context: CREATE TABLE publication (Publication_Date VARCHAR) ###Answer: SELECT COUNT(DISTINCT Publication_Date) FROM publication" "convert the question into postgresql query using the context values ### Question: Show the prices of publications whose publisher is either ""Person"" or ""Wiley"" ### Context: CREATE TABLE publication (Price VARCHAR, Publisher VARCHAR) ###Answer: SELECT Price FROM publication WHERE Publisher = ""Person"" OR Publisher = ""Wiley""" "convert the question into postgresql query using the context values ### Question: How many actors are there? ### Context: CREATE TABLE actor (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM actor" "convert the question into postgresql query using the context values ### Question: List the name of actors in ascending alphabetical order. ### Context: CREATE TABLE actor (Name VARCHAR) ###Answer: SELECT Name FROM actor ORDER BY Name" "convert the question into postgresql query using the context values ### Question: What are the characters and duration of actors? ### Context: CREATE TABLE actor (Character VARCHAR, Duration VARCHAR) ###Answer: SELECT Character, Duration FROM actor" "convert the question into postgresql query using the context values ### Question: List the name of actors whose age is not 20. ### Context: CREATE TABLE actor (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM actor WHERE Age <> 20" "convert the question into postgresql query using the context values ### Question: What are the characters of actors in descending order of age? ### Context: CREATE TABLE actor (Character VARCHAR, age VARCHAR) ###Answer: SELECT Character FROM actor ORDER BY age DESC" "convert the question into postgresql query using the context values ### Question: What is the duration of the oldest actor? ### Context: CREATE TABLE actor (Duration VARCHAR, Age VARCHAR) ###Answer: SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the names of musicals with nominee ""Bob Fosse""? ### Context: CREATE TABLE musical (Name VARCHAR, Nominee VARCHAR) ###Answer: SELECT Name FROM musical WHERE Nominee = ""Bob Fosse""" "convert the question into postgresql query using the context values ### Question: What are the distinct nominees of the musicals with the award that is not ""Tony Award""? ### Context: CREATE TABLE musical (Nominee VARCHAR, Award VARCHAR) ###Answer: SELECT DISTINCT Nominee FROM musical WHERE Award <> ""Tony Award""" "convert the question into postgresql query using the context values ### Question: Show names of actors and names of musicals they are in. ### Context: CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR); CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) ###Answer: SELECT T1.Name, T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID" "convert the question into postgresql query using the context values ### Question: Show names of actors that have appeared in musical with name ""The Phantom of the Opera"". ### Context: CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR); CREATE TABLE musical (Musical_ID VARCHAR, Name VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Show names of actors in descending order of the year their musical is awarded. ### Context: CREATE TABLE musical (Musical_ID VARCHAR, Year VARCHAR); CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR) ###Answer: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID ORDER BY T2.Year DESC" "convert the question into postgresql query using the context values ### Question: Show names of musicals and the number of actors who have appeared in the musicals. ### Context: CREATE TABLE actor (Musical_ID VARCHAR); CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Show names of musicals which have at least three actors. ### Context: CREATE TABLE actor (Musical_ID VARCHAR); CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Show different nominees and the number of musicals they have been nominated. ### Context: CREATE TABLE musical (Nominee VARCHAR) ###Answer: SELECT Nominee, COUNT(*) FROM musical GROUP BY Nominee" "convert the question into postgresql query using the context values ### Question: Please show the nominee who has been nominated the greatest number of times. ### Context: CREATE TABLE musical (Nominee VARCHAR) ###Answer: SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the most common result of the musicals. ### Context: CREATE TABLE musical (RESULT VARCHAR) ###Answer: SELECT RESULT FROM musical GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the nominees that have been nominated more than two musicals. ### Context: CREATE TABLE musical (Nominee VARCHAR) ###Answer: SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: List the name of musicals that do not have actors. ### Context: CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR); CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) ###Answer: SELECT Name FROM musical WHERE NOT Musical_ID IN (SELECT Musical_ID FROM actor)" "convert the question into postgresql query using the context values ### Question: Show the nominees that have nominated musicals for both ""Tony Award"" and ""Drama Desk Award"". ### Context: CREATE TABLE musical (Nominee VARCHAR, Award VARCHAR) ###Answer: SELECT Nominee FROM musical WHERE Award = ""Tony Award"" INTERSECT SELECT Nominee FROM musical WHERE Award = ""Drama Desk Award""" "convert the question into postgresql query using the context values ### Question: Show the musical nominee with award ""Bob Fosse"" or ""Cleavant Derricks"". ### Context: CREATE TABLE musical (Nominee VARCHAR, Award VARCHAR) ###Answer: SELECT Nominee FROM musical WHERE Award = ""Tony Award"" OR Award = ""Cleavant Derricks""" "convert the question into postgresql query using the context values ### Question: Find the emails of the user named ""Mary"". ### Context: CREATE TABLE user_profiles (email VARCHAR, name VARCHAR) ###Answer: SELECT email FROM user_profiles WHERE name = 'Mary'" "convert the question into postgresql query using the context values ### Question: What is the partition id of the user named ""Iron Man"". ### Context: CREATE TABLE user_profiles (partitionid VARCHAR, name VARCHAR) ###Answer: SELECT partitionid FROM user_profiles WHERE name = 'Iron Man'" "convert the question into postgresql query using the context values ### Question: How many users are there? ### Context: CREATE TABLE user_profiles (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM user_profiles" "convert the question into postgresql query using the context values ### Question: How many followers does each user have? ### Context: CREATE TABLE follows (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM follows" "convert the question into postgresql query using the context values ### Question: Find the number of followers for each user. ### Context: CREATE TABLE follows (f1 VARCHAR) ###Answer: SELECT COUNT(*) FROM follows GROUP BY f1" "convert the question into postgresql query using the context values ### Question: Find the number of tweets in record. ### Context: CREATE TABLE tweets (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM tweets" "convert the question into postgresql query using the context values ### Question: Find the number of users who posted some tweets. ### Context: CREATE TABLE tweets (UID VARCHAR) ###Answer: SELECT COUNT(DISTINCT UID) FROM tweets" "convert the question into postgresql query using the context values ### Question: Find the name and email of the user whose name contains the word ‘Swift’. ### Context: CREATE TABLE user_profiles (name VARCHAR, email VARCHAR) ###Answer: SELECT name, email FROM user_profiles WHERE name LIKE '%Swift%'" "convert the question into postgresql query using the context values ### Question: Find the names of users whose emails contain ‘superstar’ or ‘edu’. ### Context: CREATE TABLE user_profiles (name VARCHAR, email VARCHAR) ###Answer: SELECT name FROM user_profiles WHERE email LIKE '%superstar%' OR email LIKE '%edu%'" "convert the question into postgresql query using the context values ### Question: Return the text of tweets about the topic 'intern'. ### Context: CREATE TABLE tweets (text VARCHAR) ###Answer: SELECT text FROM tweets WHERE text LIKE '%intern%'" "convert the question into postgresql query using the context values ### Question: Find the name and email of the users who have more than 1000 followers. ### Context: CREATE TABLE user_profiles (name VARCHAR, email VARCHAR, followers INTEGER) ###Answer: SELECT name, email FROM user_profiles WHERE followers > 1000" "convert the question into postgresql query using the context values ### Question: Find the names of the users whose number of followers is greater than that of the user named ""Tyler Swift"". ### Context: CREATE TABLE follows (f1 VARCHAR); CREATE TABLE user_profiles (name VARCHAR, uid VARCHAR) ###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')" "convert the question into postgresql query using the context values ### Question: Find the name and email for the users who have more than one follower. ### Context: CREATE TABLE follows (f1 VARCHAR); CREATE TABLE user_profiles (name VARCHAR, email VARCHAR, uid VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Find the names of users who have more than one tweet. ### Context: CREATE TABLE tweets (uid VARCHAR); CREATE TABLE user_profiles (name VARCHAR, uid VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Find the id of users who are followed by Mary and Susan. ### Context: CREATE TABLE follows (f1 VARCHAR, f2 VARCHAR); CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Find the id of users who are followed by Mary or Susan. ### Context: CREATE TABLE follows (f1 VARCHAR, f2 VARCHAR); CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Find the name of the user who has the largest number of followers. ### Context: CREATE TABLE user_profiles (name VARCHAR, followers VARCHAR) ###Answer: SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name and email of the user followed by the least number of people. ### Context: CREATE TABLE user_profiles (name VARCHAR, email VARCHAR, followers VARCHAR) ###Answer: SELECT name, email FROM user_profiles ORDER BY followers LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the name and number of followers for each user, and sort the results by the number of followers in descending order. ### Context: CREATE TABLE user_profiles (name VARCHAR, followers VARCHAR) ###Answer: SELECT name, followers FROM user_profiles ORDER BY followers DESC" "convert the question into postgresql query using the context values ### Question: List the names of 5 users followed by the largest number of other users. ### Context: CREATE TABLE user_profiles (name VARCHAR, followers VARCHAR) ###Answer: SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: List the text of all tweets in the order of date. ### Context: CREATE TABLE tweets (text VARCHAR, createdate VARCHAR) ###Answer: SELECT text FROM tweets ORDER BY createdate" "convert the question into postgresql query using the context values ### Question: Find the name of each user and number of tweets tweeted by each of them. ### Context: CREATE TABLE tweets (uid VARCHAR); CREATE TABLE user_profiles (name VARCHAR, uid VARCHAR) ###Answer: SELECT T1.name, COUNT(*) FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid" "convert the question into postgresql query using the context values ### Question: Find the name and partition id for users who tweeted less than twice. ### Context: CREATE TABLE user_profiles (name VARCHAR, partitionid VARCHAR, uid VARCHAR); CREATE TABLE tweets (uid VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Find the name of the user who tweeted more than once, and number of tweets tweeted by them. ### Context: CREATE TABLE tweets (uid VARCHAR); CREATE TABLE user_profiles (name VARCHAR, uid VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Find the average number of followers for the users who do not have any tweet. ### Context: CREATE TABLE user_profiles (followers INTEGER, UID VARCHAR); CREATE TABLE tweets (followers INTEGER, UID VARCHAR) ###Answer: SELECT AVG(followers) FROM user_profiles WHERE NOT UID IN (SELECT UID FROM tweets)" "convert the question into postgresql query using the context values ### Question: Find the average number of followers for the users who had some tweets. ### Context: CREATE TABLE user_profiles (followers INTEGER, UID VARCHAR); CREATE TABLE tweets (followers INTEGER, UID VARCHAR) ###Answer: SELECT AVG(followers) FROM user_profiles WHERE UID IN (SELECT UID FROM tweets)" "convert the question into postgresql query using the context values ### Question: Find the maximum and total number of followers of all users. ### Context: CREATE TABLE user_profiles (followers INTEGER) ###Answer: SELECT MAX(followers), SUM(followers) FROM user_profiles" "convert the question into postgresql query using the context values ### Question: Find the names of all the catalog entries. ### Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR) ###Answer: SELECT DISTINCT (catalog_entry_name) FROM catalog_contents" "convert the question into postgresql query using the context values ### Question: Find the list of attribute data types possessed by more than 3 attribute definitions. ### Context: CREATE TABLE Attribute_Definitions (attribute_data_type VARCHAR) ###Answer: SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING COUNT(*) > 3" "convert the question into postgresql query using the context values ### Question: What is the attribute data type of the attribute with name ""Green""? ### Context: CREATE TABLE Attribute_Definitions (attribute_data_type VARCHAR, attribute_name VARCHAR) ###Answer: SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = ""Green""" "convert the question into postgresql query using the context values ### Question: Find the name and level of catalog structure with level between 5 and 10. ### Context: CREATE TABLE Catalog_Structure (catalog_level_name VARCHAR, catalog_level_number INTEGER) ###Answer: SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10" "convert the question into postgresql query using the context values ### Question: Find all the catalog publishers whose name contains ""Murray"" ### Context: CREATE TABLE catalogs (catalog_publisher VARCHAR) ###Answer: SELECT DISTINCT (catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE ""%Murray%""" "convert the question into postgresql query using the context values ### Question: Which catalog publisher has published the most catalogs? ### Context: CREATE TABLE catalogs (catalog_publisher VARCHAR) ###Answer: SELECT catalog_publisher FROM catalogs GROUP BY catalog_publisher ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names and publication dates of all catalogs that have catalog level number greater than 5. ### Context: CREATE TABLE catalogs (catalog_name VARCHAR, date_of_publication VARCHAR, catalog_id VARCHAR); CREATE TABLE catalog_structure (catalog_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: What are the entry names of catalog with the attribute possessed by most entries. ### Context: CREATE TABLE Catalog_Contents_Additional_Attributes (catalog_entry_id VARCHAR, attribute_value VARCHAR); CREATE TABLE Catalog_Contents (catalog_entry_name VARCHAR, catalog_entry_id VARCHAR); CREATE TABLE Catalog_Contents_Additional_Attributes (attribute_value VARCHAR) ###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)" "convert the question into postgresql query using the context values ### Question: What is the entry name of the most expensive catalog (in USD)? ### Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, price_in_dollars VARCHAR) ###Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the level name of the cheapest catalog (in USD)? ### Context: CREATE TABLE catalog_structure (catalog_level_name VARCHAR, catalog_level_number VARCHAR); CREATE TABLE catalog_contents (catalog_level_number VARCHAR, price_in_dollars VARCHAR) ###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 LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the average and minimum price (in Euro) of all products? ### Context: CREATE TABLE catalog_contents (price_in_euros INTEGER) ###Answer: SELECT AVG(price_in_euros), MIN(price_in_euros) FROM catalog_contents" "convert the question into postgresql query using the context values ### Question: What is the product with the highest height? Give me the catalog entry name. ### Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, height VARCHAR) ###Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of the product that has the smallest capacity. ### Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, capacity VARCHAR) ###Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY capacity LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names of all the products whose stock number starts with ""2"". ### Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, product_stock_number VARCHAR) ###Answer: SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE ""2%""" "convert the question into postgresql query using the context values ### Question: Find the names of catalog entries with level number 8. ### Context: CREATE TABLE Catalog_Contents_Additional_Attributes (catalog_entry_id VARCHAR, catalog_level_number VARCHAR); CREATE TABLE Catalog_Contents (catalog_entry_name VARCHAR, catalog_entry_id VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Find the names of the products with length smaller than 3 or height greater than 5. ### Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, LENGTH VARCHAR, width VARCHAR) ###Answer: SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH < 3 OR width > 5" "convert the question into postgresql query using the context values ### Question: Find the name and attribute ID of the attribute definitions with attribute value 0. ### Context: CREATE TABLE Catalog_Contents_Additional_Attributes (attribute_id VARCHAR, attribute_value VARCHAR); CREATE TABLE Attribute_Definitions (attribute_name VARCHAR, attribute_id VARCHAR) ###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" "convert the question into postgresql query using the context values ### Question: Find the name and capacity of products with price greater than 700 (in USD). ### Context: CREATE TABLE Catalog_Contents (catalog_entry_name VARCHAR, capacity VARCHAR, price_in_dollars INTEGER) ###Answer: SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700" "convert the question into postgresql query using the context values ### Question: Find the dates on which more than one revisions were made. ### Context: CREATE TABLE Catalogs (date_of_latest_revision VARCHAR) ###Answer: SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: How many products are there in the records? ### Context: CREATE TABLE catalog_contents (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM catalog_contents" "convert the question into postgresql query using the context values ### Question: Name all the products with next entry ID greater than 8. ### Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, next_entry_id INTEGER) ###Answer: SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8" "convert the question into postgresql query using the context values ### Question: How many aircrafts do we have? ### Context: CREATE TABLE Aircraft (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Aircraft" "convert the question into postgresql query using the context values ### Question: Show name and distance for all aircrafts. ### Context: CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR) ###Answer: SELECT name, distance FROM Aircraft" "convert the question into postgresql query using the context values ### Question: Show ids for all aircrafts with more than 1000 distance. ### Context: CREATE TABLE Aircraft (aid VARCHAR, distance INTEGER) ###Answer: SELECT aid FROM Aircraft WHERE distance > 1000" "convert the question into postgresql query using the context values ### Question: How many aircrafts have distance between 1000 and 5000? ### Context: CREATE TABLE Aircraft (distance INTEGER) ###Answer: SELECT COUNT(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000" "convert the question into postgresql query using the context values ### Question: What is the name and distance for aircraft with id 12? ### Context: CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR, aid VARCHAR) ###Answer: SELECT name, distance FROM Aircraft WHERE aid = 12" "convert the question into postgresql query using the context values ### Question: What is the minimum, average, and maximum distance of all aircrafts. ### Context: CREATE TABLE Aircraft (distance INTEGER) ###Answer: SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft" "convert the question into postgresql query using the context values ### Question: Show the id and name of the aircraft with the maximum distance. ### Context: CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR, distance VARCHAR) ###Answer: SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the name of aircrafts with top three lowest distances. ### Context: CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR) ###Answer: SELECT name FROM Aircraft ORDER BY distance LIMIT 3" "convert the question into postgresql query using the context values ### Question: Show names for all aircrafts with distances more than the average. ### Context: CREATE TABLE Aircraft (name VARCHAR, distance INTEGER) ###Answer: SELECT name FROM Aircraft WHERE distance > (SELECT AVG(distance) FROM Aircraft)" "convert the question into postgresql query using the context values ### Question: How many employees do we have? ### Context: CREATE TABLE Employee (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Employee" "convert the question into postgresql query using the context values ### Question: Show name and salary for all employees sorted by salary. ### Context: CREATE TABLE Employee (name VARCHAR, salary VARCHAR) ###Answer: SELECT name, salary FROM Employee ORDER BY salary" "convert the question into postgresql query using the context values ### Question: Show ids for all employees with at least 100000 salary. ### Context: CREATE TABLE Employee (eid VARCHAR, salary INTEGER) ###Answer: SELECT eid FROM Employee WHERE salary > 100000" "convert the question into postgresql query using the context values ### Question: How many employees have salary between 100000 and 200000? ### Context: CREATE TABLE Employee (salary INTEGER) ###Answer: SELECT COUNT(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000" "convert the question into postgresql query using the context values ### Question: What is the name and salary for employee with id 242518965? ### Context: CREATE TABLE Employee (name VARCHAR, salary VARCHAR, eid VARCHAR) ###Answer: SELECT name, salary FROM Employee WHERE eid = 242518965" "convert the question into postgresql query using the context values ### Question: What is average and maximum salary of all employees. ### Context: CREATE TABLE Employee (salary INTEGER) ###Answer: SELECT AVG(salary), MAX(salary) FROM Employee" "convert the question into postgresql query using the context values ### Question: Show the id and name of the employee with maximum salary. ### Context: CREATE TABLE Employee (eid VARCHAR, name VARCHAR, salary VARCHAR) ###Answer: SELECT eid, name FROM Employee ORDER BY salary DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the name of employees with three lowest salaries. ### Context: CREATE TABLE Employee (name VARCHAR, salary VARCHAR) ###Answer: SELECT name FROM Employee ORDER BY salary LIMIT 3" "convert the question into postgresql query using the context values ### Question: Show names for all employees with salary more than the average. ### Context: CREATE TABLE Employee (name VARCHAR, salary INTEGER) ###Answer: SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee)" "convert the question into postgresql query using the context values ### Question: Show the id and salary of Mark Young. ### Context: CREATE TABLE Employee (eid VARCHAR, salary VARCHAR, name VARCHAR) ###Answer: SELECT eid, salary FROM Employee WHERE name = 'Mark Young'" "convert the question into postgresql query using the context values ### Question: How many flights do we have? ### Context: CREATE TABLE Flight (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Flight" "convert the question into postgresql query using the context values ### Question: Show flight number, origin, destination of all flights in the alphabetical order of the departure cities. ### Context: CREATE TABLE Flight (flno VARCHAR, origin VARCHAR, destination VARCHAR) ###Answer: SELECT flno, origin, destination FROM Flight ORDER BY origin" "convert the question into postgresql query using the context values ### Question: Show all flight number from Los Angeles. ### Context: CREATE TABLE Flight (flno VARCHAR, origin VARCHAR) ###Answer: SELECT flno FROM Flight WHERE origin = ""Los Angeles""" "convert the question into postgresql query using the context values ### Question: Show origins of all flights with destination Honolulu. ### Context: CREATE TABLE Flight (origin VARCHAR, destination VARCHAR) ###Answer: SELECT origin FROM Flight WHERE destination = ""Honolulu""" "convert the question into postgresql query using the context values ### Question: Show me the departure date and arrival date for all flights from Los Angeles to Honolulu. ### Context: CREATE TABLE Flight (departure_date VARCHAR, arrival_date VARCHAR, origin VARCHAR, destination VARCHAR) ###Answer: SELECT departure_date, arrival_date FROM Flight WHERE origin = ""Los Angeles"" AND destination = ""Honolulu""" "convert the question into postgresql query using the context values ### Question: Show flight number for all flights with more than 2000 distance. ### Context: CREATE TABLE Flight (flno VARCHAR, distance INTEGER) ###Answer: SELECT flno FROM Flight WHERE distance > 2000" "convert the question into postgresql query using the context values ### Question: What is the average price for flights from Los Angeles to Honolulu. ### Context: CREATE TABLE Flight (price INTEGER, origin VARCHAR, destination VARCHAR) ###Answer: SELECT AVG(price) FROM Flight WHERE origin = ""Los Angeles"" AND destination = ""Honolulu""" "convert the question into postgresql query using the context values ### Question: Show origin and destination for flights with price higher than 300. ### Context: CREATE TABLE Flight (origin VARCHAR, destination VARCHAR, price INTEGER) ###Answer: SELECT origin, destination FROM Flight WHERE price > 300" "convert the question into postgresql query using the context values ### Question: Show the flight number and distance of the flight with maximum price. ### Context: CREATE TABLE Flight (flno VARCHAR, distance VARCHAR, price VARCHAR) ###Answer: SELECT flno, distance FROM Flight ORDER BY price DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the flight number of flights with three lowest distances. ### Context: CREATE TABLE Flight (flno VARCHAR, distance VARCHAR) ###Answer: SELECT flno FROM Flight ORDER BY distance LIMIT 3" "convert the question into postgresql query using the context values ### Question: What is the average distance and average price for flights from Los Angeles. ### Context: CREATE TABLE Flight (distance INTEGER, price INTEGER, origin VARCHAR) ###Answer: SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = ""Los Angeles""" "convert the question into postgresql query using the context values ### Question: Show all origins and the number of flights from each origin. ### Context: CREATE TABLE Flight (origin VARCHAR) ###Answer: SELECT origin, COUNT(*) FROM Flight GROUP BY origin" "convert the question into postgresql query using the context values ### Question: Show all destinations and the number of flights to each destination. ### Context: CREATE TABLE Flight (destination VARCHAR) ###Answer: SELECT destination, COUNT(*) FROM Flight GROUP BY destination" "convert the question into postgresql query using the context values ### Question: Which origin has most number of flights? ### Context: CREATE TABLE Flight (origin VARCHAR) ###Answer: SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which destination has least number of flights? ### Context: CREATE TABLE Flight (destination VARCHAR) ###Answer: SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the aircraft name for the flight with number 99 ### Context: CREATE TABLE Flight (aid VARCHAR, flno VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR) ###Answer: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99" "convert the question into postgresql query using the context values ### Question: Show all flight numbers with aircraft Airbus A340-300. ### Context: CREATE TABLE Flight (flno VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) ###Answer: SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = ""Airbus A340-300""" "convert the question into postgresql query using the context values ### Question: Show aircraft names and number of flights for each aircraft. ### Context: CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Flight (aid VARCHAR) ###Answer: SELECT T2.name, COUNT(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid" "convert the question into postgresql query using the context values ### Question: Show names for all aircraft with at least two flights. ### Context: CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Flight (aid VARCHAR) ###Answer: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: How many employees have certificate. ### Context: CREATE TABLE Certificate (eid VARCHAR) ###Answer: SELECT COUNT(DISTINCT eid) FROM Certificate" "convert the question into postgresql query using the context values ### Question: Show ids for all employees who don't have a certificate. ### Context: CREATE TABLE Employee (eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR) ###Answer: SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate" "convert the question into postgresql query using the context values ### Question: Show names for all aircrafts of which John Williams has certificates. ### Context: CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Employee (eid VARCHAR, name VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Show names for all employees who have certificate of Boeing 737-800. ### Context: CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300. ### Context: CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) ###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""" "convert the question into postgresql query using the context values ### Question: Show names for all employees who do not have certificate of Boeing 737-800. ### Context: CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Employee (name VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) ###Answer: SELECT name FROM Employee EXCEPT 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""" "convert the question into postgresql query using the context values ### Question: Show the name of aircraft which fewest people have its certificate. ### Context: CREATE TABLE Certificate (aid VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR) ###Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate. ### Context: CREATE TABLE Certificate (aid VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR, distance INTEGER) ###Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY COUNT(*) >= 5" "convert the question into postgresql query using the context values ### Question: what is the salary and name of the employee who has the most number of aircraft certificates? ### Context: CREATE TABLE Certificate (eid VARCHAR); CREATE TABLE Employee (name VARCHAR, salary VARCHAR, eid VARCHAR) ###Answer: SELECT T1.name, T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000? ### Context: CREATE TABLE Aircraft (aid VARCHAR, distance INTEGER); CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR) ###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.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many allergies are there? ### Context: CREATE TABLE Allergy_type (allergy VARCHAR) ###Answer: SELECT COUNT(DISTINCT allergy) FROM Allergy_type" "convert the question into postgresql query using the context values ### Question: How many different allergy types exist? ### Context: CREATE TABLE Allergy_type (allergytype VARCHAR) ###Answer: SELECT COUNT(DISTINCT allergytype) FROM Allergy_type" "convert the question into postgresql query using the context values ### Question: Show all allergy types. ### Context: CREATE TABLE Allergy_type (allergytype VARCHAR) ###Answer: SELECT DISTINCT allergytype FROM Allergy_type" "convert the question into postgresql query using the context values ### Question: Show all allergies and their types. ### Context: CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) ###Answer: SELECT allergy, allergytype FROM Allergy_type" "convert the question into postgresql query using the context values ### Question: Show all allergies with type food. ### Context: CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) ###Answer: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = ""food""" "convert the question into postgresql query using the context values ### Question: What is the type of allergy Cat? ### Context: CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR) ###Answer: SELECT allergytype FROM Allergy_type WHERE allergy = ""Cat""" "convert the question into postgresql query using the context values ### Question: How many allergies have type animal? ### Context: CREATE TABLE Allergy_type (allergytype VARCHAR) ###Answer: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = ""animal""" "convert the question into postgresql query using the context values ### Question: Show all allergy types and the number of allergies in each type. ### Context: CREATE TABLE Allergy_type (allergytype VARCHAR) ###Answer: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype" "convert the question into postgresql query using the context values ### Question: Which allergy type has most number of allergies? ### Context: CREATE TABLE Allergy_type (allergytype VARCHAR) ###Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which allergy type has least number of allergies? ### Context: CREATE TABLE Allergy_type (allergytype VARCHAR) ###Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many students are there? ### Context: CREATE TABLE Student (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Student" "convert the question into postgresql query using the context values ### Question: Show first name and last name for all students. ### Context: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR) ###Answer: SELECT Fname, Lname FROM Student" "convert the question into postgresql query using the context values ### Question: How many different advisors are listed? ### Context: CREATE TABLE Student (advisor VARCHAR) ###Answer: SELECT COUNT(DISTINCT advisor) FROM Student" "convert the question into postgresql query using the context values ### Question: Show all majors. ### Context: CREATE TABLE Student (Major VARCHAR) ###Answer: SELECT DISTINCT Major FROM Student" "convert the question into postgresql query using the context values ### Question: Show all cities where students live. ### Context: CREATE TABLE Student (city_code VARCHAR) ###Answer: SELECT DISTINCT city_code FROM Student" "convert the question into postgresql query using the context values ### Question: Show first name, last name, age for all female students. Their sex is F. ### Context: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Age VARCHAR, Sex VARCHAR) ###Answer: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'" "convert the question into postgresql query using the context values ### Question: Show student ids for all male students. ### Context: CREATE TABLE Student (StuID VARCHAR, Sex VARCHAR) ###Answer: SELECT StuID FROM Student WHERE Sex = 'M'" "convert the question into postgresql query using the context values ### Question: How many students are age 18? ### Context: CREATE TABLE Student (age VARCHAR) ###Answer: SELECT COUNT(*) FROM Student WHERE age = 18" "convert the question into postgresql query using the context values ### Question: Show all student ids who are older than 20. ### Context: CREATE TABLE Student (StuID VARCHAR, age INTEGER) ###Answer: SELECT StuID FROM Student WHERE age > 20" "convert the question into postgresql query using the context values ### Question: Which city does the student whose last name is ""Kim"" live in? ### Context: CREATE TABLE Student (city_code VARCHAR, LName VARCHAR) ###Answer: SELECT city_code FROM Student WHERE LName = ""Kim""" "convert the question into postgresql query using the context values ### Question: Who is the advisor of student with ID 1004? ### Context: CREATE TABLE Student (Advisor VARCHAR, StuID VARCHAR) ###Answer: SELECT Advisor FROM Student WHERE StuID = 1004" "convert the question into postgresql query using the context values ### Question: How many students live in HKG or CHI? ### Context: CREATE TABLE Student (city_code VARCHAR) ###Answer: SELECT COUNT(*) FROM Student WHERE city_code = ""HKG"" OR city_code = ""CHI""" "convert the question into postgresql query using the context values ### Question: Show the minimum, average, and maximum age of all students. ### Context: CREATE TABLE Student (age INTEGER) ###Answer: SELECT MIN(age), AVG(age), MAX(age) FROM Student" "convert the question into postgresql query using the context values ### Question: What is the last name of the youngest student? ### Context: CREATE TABLE Student (LName VARCHAR, age INTEGER) ###Answer: SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student)" "convert the question into postgresql query using the context values ### Question: Show the student id of the oldest student. ### Context: CREATE TABLE Student (StuID VARCHAR, age INTEGER) ###Answer: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student)" "convert the question into postgresql query using the context values ### Question: Show all majors and corresponding number of students. ### Context: CREATE TABLE Student (major VARCHAR) ###Answer: SELECT major, COUNT(*) FROM Student GROUP BY major" "convert the question into postgresql query using the context values ### Question: Which major has most number of students? ### Context: CREATE TABLE Student (major VARCHAR) ###Answer: SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show all ages and corresponding number of students. ### Context: CREATE TABLE Student (age VARCHAR) ###Answer: SELECT age, COUNT(*) FROM Student GROUP BY age" "convert the question into postgresql query using the context values ### Question: Show the average age for male and female students. ### Context: CREATE TABLE Student (sex VARCHAR, age INTEGER) ###Answer: SELECT AVG(age), sex FROM Student GROUP BY sex" "convert the question into postgresql query using the context values ### Question: Show all cities and corresponding number of students. ### Context: CREATE TABLE Student (city_code VARCHAR) ###Answer: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code" "convert the question into postgresql query using the context values ### Question: Show all advisors and corresponding number of students. ### Context: CREATE TABLE Student (advisor VARCHAR) ###Answer: SELECT advisor, COUNT(*) FROM Student GROUP BY advisor" "convert the question into postgresql query using the context values ### Question: Which advisor has most number of students? ### Context: CREATE TABLE Student (advisor VARCHAR) ###Answer: SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many students have cat allergies? ### Context: CREATE TABLE Has_allergy (Allergy VARCHAR) ###Answer: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = ""Cat""" "convert the question into postgresql query using the context values ### Question: Show all student IDs who have at least two allergies. ### Context: CREATE TABLE Has_allergy (StuID VARCHAR) ###Answer: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What are the student ids of students who don't have any allergies? ### Context: CREATE TABLE Has_allergy (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR) ###Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy" "convert the question into postgresql query using the context values ### Question: How many female students have milk or egg allergies? ### Context: CREATE TABLE Student (StuID VARCHAR, sex VARCHAR); CREATE TABLE has_allergy (StuID VARCHAR, allergy VARCHAR) ###Answer: SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = ""F"" AND T1.allergy = ""Milk"" OR T1.allergy = ""Eggs""" "convert the question into postgresql query using the context values ### Question: How many students have a food allergy? ### Context: CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) ###Answer: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = ""food""" "convert the question into postgresql query using the context values ### Question: Which allergy has most number of students affected? ### Context: CREATE TABLE Has_allergy (Allergy VARCHAR) ###Answer: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show all allergies with number of students affected. ### Context: CREATE TABLE Has_allergy (Allergy VARCHAR) ###Answer: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy" "convert the question into postgresql query using the context values ### Question: Show all allergy type with number of students affected. ### Context: CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR) ###Answer: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype" "convert the question into postgresql query using the context values ### Question: Find the last name and age of the student who has allergy to both milk and cat. ### Context: CREATE TABLE Has_allergy (lname VARCHAR, age VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Student (lname VARCHAR, age VARCHAR, StuID VARCHAR, Allergy VARCHAR) ###Answer: SELECT lname, age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = ""Milk"" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = ""Cat"")" "convert the question into postgresql query using the context values ### Question: What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies. ### Context: CREATE TABLE Has_allergy (Allergy VARCHAR, StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR, Fname VARCHAR); CREATE TABLE Allergy_type (Allergy VARCHAR, AllergyType VARCHAR) ###Answer: SELECT T1.Allergy, T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = ""Lisa"" ORDER BY T1.Allergy" "convert the question into postgresql query using the context values ### Question: Find the first name and gender of the student who has allergy to milk but not cat. ### Context: CREATE TABLE Student (fname VARCHAR, sex VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Has_allergy (fname VARCHAR, sex VARCHAR, StuID VARCHAR, Allergy VARCHAR) ###Answer: SELECT fname, sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = ""Milk"" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = ""Cat"")" "convert the question into postgresql query using the context values ### Question: Find the average age of the students who have allergies with food and animal types. ### Context: CREATE TABLE Student (age INTEGER, StuID VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (StuID VARCHAR, Allergy VARCHAR) ###Answer: SELECT AVG(age) FROM Student WHERE StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = ""food"" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = ""animal"")" "convert the question into postgresql query using the context values ### Question: List the first and last name of the students who do not have any food type allergy. ### Context: CREATE TABLE Student (fname VARCHAR, lname VARCHAR, StuID VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (StuID VARCHAR, Allergy VARCHAR) ###Answer: SELECT fname, lname FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = ""food"")" "convert the question into postgresql query using the context values ### Question: Find the number of male (sex is 'M') students who have some food type allery. ### Context: CREATE TABLE Has_allergy (Allergy VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Student (sex VARCHAR, StuID VARCHAR) ###Answer: SELECT COUNT(*) FROM Student WHERE sex = ""M"" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = ""food"")" "convert the question into postgresql query using the context values ### Question: Find the different first names and cities of the students who have allergy to milk or cat. ### Context: CREATE TABLE Has_Allergy (stuid VARCHAR, Allergy VARCHAR); CREATE TABLE Student (fname VARCHAR, city_code VARCHAR, stuid VARCHAR) ###Answer: SELECT DISTINCT T1.fname, T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = ""Milk"" OR T2.Allergy = ""Cat""" "convert the question into postgresql query using the context values ### Question: Find the number of students who are older than 18 and do not have allergy to either food or animal. ### Context: CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (Allergy VARCHAR); CREATE TABLE Student (age VARCHAR, StuID VARCHAR) ###Answer: SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = ""food"" OR T2.allergytype = ""animal"")" "convert the question into postgresql query using the context values ### Question: Find the first name and major of the students who are not allegry to soy. ### Context: CREATE TABLE Has_allergy (fname VARCHAR, major VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Student (fname VARCHAR, major VARCHAR, StuID VARCHAR, Allergy VARCHAR) ###Answer: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = ""Soy"")" "convert the question into postgresql query using the context values ### Question: A list of the top 5 countries by number of invoices. List country name and number of invoices. ### Context: CREATE TABLE invoices (billing_country VARCHAR) ###Answer: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size. ### Context: CREATE TABLE invoices (billing_country VARCHAR, total INTEGER) ###Answer: SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8" "convert the question into postgresql query using the context values ### Question: A list of the top 10 countries by average invoice size. List country name and average invoice size. ### Context: CREATE TABLE invoices (billing_country VARCHAR, total INTEGER) ###Answer: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10" "convert the question into postgresql query using the context values ### Question: Find out 5 customers who most recently purchased something. List customers' first and last name. ### Context: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR, invoice_date VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders. ### Context: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name, COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10" "convert the question into postgresql query using the context values ### Question: List the top 10 customers by total gross sales. List customers' first and last name and total gross sales. ### Context: CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name, SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10" "convert the question into postgresql query using the context values ### Question: List the top 5 genres by number of tracks. List genres name and total tracks. ### Context: CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: List every album's title. ### Context: CREATE TABLE albums (title VARCHAR) ###Answer: SELECT title FROM albums" "convert the question into postgresql query using the context values ### Question: List every album ordered by album title in ascending order. ### Context: CREATE TABLE albums (title VARCHAR) ###Answer: SELECT title FROM albums ORDER BY title" "convert the question into postgresql query using the context values ### Question: List every album whose title starts with A in alphabetical order. ### Context: CREATE TABLE albums (title VARCHAR) ###Answer: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title" "convert the question into postgresql query using the context values ### Question: List the customers first and last name of 10 least expensive invoices. ### Context: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE invoices (customer_id VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total LIMIT 10" "convert the question into postgresql query using the context values ### Question: List total amount of invoice from Chicago, IL. ### Context: CREATE TABLE invoices (total INTEGER, billing_city VARCHAR, billing_state VARCHAR) ###Answer: SELECT SUM(total) FROM invoices WHERE billing_city = ""Chicago"" AND billing_state = ""IL""" "convert the question into postgresql query using the context values ### Question: List the number of invoices from Chicago, IL. ### Context: CREATE TABLE invoices (billing_city VARCHAR, billing_state VARCHAR) ###Answer: SELECT COUNT(*) FROM invoices WHERE billing_city = ""Chicago"" AND billing_state = ""IL""" "convert the question into postgresql query using the context values ### Question: List the number of invoices from the US, grouped by state. ### Context: CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR) ###Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = ""USA"" GROUP BY billing_state" "convert the question into postgresql query using the context values ### Question: List the state in the US with the most invoices. ### Context: CREATE TABLE invoices (billing_state VARCHAR, billing_country VARCHAR) ###Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = ""USA"" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the number of invoices and the invoice total from California. ### Context: CREATE TABLE invoices (billing_state VARCHAR, total INTEGER) ###Answer: SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = ""CA""" "convert the question into postgresql query using the context values ### Question: List Aerosmith's albums. ### Context: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR) ###Answer: SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = ""Aerosmith""" "convert the question into postgresql query using the context values ### Question: How many albums does Billy Cobham has? ### Context: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (artist_id VARCHAR) ###Answer: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = ""Billy Cobham""" "convert the question into postgresql query using the context values ### Question: Eduardo Martins is a customer at which company? ### Context: CREATE TABLE customers (company VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT company FROM customers WHERE first_name = ""Eduardo"" AND last_name = ""Martins""" "convert the question into postgresql query using the context values ### Question: What is Astrid Gruber's email and phone number? ### Context: CREATE TABLE customers (email VARCHAR, phone VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT email, phone FROM customers WHERE first_name = ""Astrid"" AND last_name = ""Gruber""" "convert the question into postgresql query using the context values ### Question: How many customers live in Prague city? ### Context: CREATE TABLE customers (city VARCHAR) ###Answer: SELECT COUNT(*) FROM customers WHERE city = ""Prague""" "convert the question into postgresql query using the context values ### Question: How many customers in state of CA? ### Context: CREATE TABLE customers (state VARCHAR) ###Answer: SELECT COUNT(*) FROM customers WHERE state = ""CA""" "convert the question into postgresql query using the context values ### Question: What country does Roberto Almeida live? ### Context: CREATE TABLE customers (country VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT country FROM customers WHERE first_name = ""Roberto"" AND last_name = ""Almeida""" "convert the question into postgresql query using the context values ### Question: List the name of albums that are released by aritist whose name has 'Led' ### Context: CREATE TABLE artists (id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, artist_id VARCHAR) ###Answer: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'" "convert the question into postgresql query using the context values ### Question: How many customers does Steve Johnson support? ### Context: CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR) ###Answer: SELECT COUNT(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = ""Steve"" AND T1.last_name = ""Johnson""" "convert the question into postgresql query using the context values ### Question: What is the title, phone and hire date of Nancy Edwards? ### Context: CREATE TABLE employees (title VARCHAR, phone VARCHAR, hire_date VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT title, phone, hire_date FROM employees WHERE first_name = ""Nancy"" AND last_name = ""Edwards""" "convert the question into postgresql query using the context values ### Question: find the full name of employees who report to Nancy Edwards? ### Context: CREATE TABLE employees (id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, reports_to VARCHAR) ###Answer: SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = ""Nancy"" AND T1.last_name = ""Edwards""" "convert the question into postgresql query using the context values ### Question: What is the address of employee Nancy Edwards? ### Context: CREATE TABLE employees (address VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT address FROM employees WHERE first_name = ""Nancy"" AND last_name = ""Edwards""" "convert the question into postgresql query using the context values ### Question: Find the full name of employee who supported the most number of customers. ### Context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE customers (support_rep_id VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many employees are living in Canada? ### Context: CREATE TABLE employees (country VARCHAR) ###Answer: SELECT COUNT(*) FROM employees WHERE country = ""Canada""" "convert the question into postgresql query using the context values ### Question: What is employee Nancy Edwards's phone number? ### Context: CREATE TABLE employees (phone VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT phone FROM employees WHERE first_name = ""Nancy"" AND last_name = ""Edwards""" "convert the question into postgresql query using the context values ### Question: Who is the youngest employee in the company? List employee's first and last name. ### Context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, birth_date VARCHAR) ###Answer: SELECT first_name, last_name FROM employees ORDER BY birth_date DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List top 10 employee work longest in the company. List employee's first and last name. ### Context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR) ###Answer: SELECT first_name, last_name FROM employees ORDER BY hire_date LIMIT 10" "convert the question into postgresql query using the context values ### Question: Find the number of employees whose title is IT Staff from each city? ### Context: CREATE TABLE employees (city VARCHAR, title VARCHAR) ###Answer: SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city" "convert the question into postgresql query using the context values ### Question: Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee. ### Context: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, id VARCHAR); CREATE TABLE employees (reports_to VARCHAR) ###Answer: SELECT T2.first_name, T2.last_name, COUNT(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY COUNT(T1.reports_to) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many orders does Lucas Mancini has? ### Context: CREATE TABLE invoices (customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = ""Lucas"" AND T1.last_name = ""Mancini""" "convert the question into postgresql query using the context values ### Question: What is the total amount of money spent by Lucas Mancini? ### Context: CREATE TABLE invoices (total INTEGER, customer_id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = ""Lucas"" AND T1.last_name = ""Mancini""" "convert the question into postgresql query using the context values ### Question: List all media types. ### Context: CREATE TABLE media_types (name VARCHAR) ###Answer: SELECT name FROM media_types" "convert the question into postgresql query using the context values ### Question: List all different genre types. ### Context: CREATE TABLE genres (name VARCHAR) ###Answer: SELECT DISTINCT name FROM genres" "convert the question into postgresql query using the context values ### Question: List the name of all playlist. ### Context: CREATE TABLE playlists (name VARCHAR) ###Answer: SELECT name FROM playlists" "convert the question into postgresql query using the context values ### Question: Who is the composer of track Fast As a Shark? ### Context: CREATE TABLE tracks (composer VARCHAR, name VARCHAR) ###Answer: SELECT composer FROM tracks WHERE name = ""Fast As a Shark""" "convert the question into postgresql query using the context values ### Question: How long does track Fast As a Shark has? ### Context: CREATE TABLE tracks (milliseconds VARCHAR, name VARCHAR) ###Answer: SELECT milliseconds FROM tracks WHERE name = ""Fast As a Shark""" "convert the question into postgresql query using the context values ### Question: What is the name of tracks whose genre is Rock? ### Context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR) ###Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = ""Rock""" "convert the question into postgresql query using the context values ### Question: What is title of album which track Balls to the Wall belongs to? ### Context: CREATE TABLE tracks (genre_id VARCHAR, name VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR) ###Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = ""Balls to the Wall""" "convert the question into postgresql query using the context values ### Question: List name of all tracks in Balls to the Wall. ### Context: CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR); CREATE TABLE albums (id VARCHAR, title VARCHAR) ###Answer: SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = ""Balls to the Wall""" "convert the question into postgresql query using the context values ### Question: List title of albums have the number of tracks greater than 10. ### Context: CREATE TABLE tracks (album_id VARCHAR); CREATE TABLE albums (title VARCHAR, id VARCHAR) ###Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10" "convert the question into postgresql query using the context values ### Question: List the name of tracks belongs to genre Rock and whose media type is MPEG audio file. ### Context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR) ###Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = ""Rock"" AND T3.name = ""MPEG audio file""" "convert the question into postgresql query using the context values ### Question: List the name of tracks belongs to genre Rock or media type is MPEG audio file. ### Context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR, media_type_id VARCHAR); CREATE TABLE media_types (id VARCHAR, name VARCHAR) ###Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = ""Rock"" OR T3.name = ""MPEG audio file""" "convert the question into postgresql query using the context values ### Question: List the name of tracks belongs to genre Rock or genre Jazz. ### Context: CREATE TABLE genres (id VARCHAR, name VARCHAR); CREATE TABLE tracks (name VARCHAR, genre_id VARCHAR) ###Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = ""Rock"" OR T1.name = ""Jazz""" "convert the question into postgresql query using the context values ### Question: List the name of all tracks in the playlists of Movies. ### Context: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = ""Movies""" "convert the question into postgresql query using the context values ### Question: List the name of playlist which has number of tracks greater than 100. ### Context: CREATE TABLE playlist_tracks (playlist_id VARCHAR, track_id VARCHAR); CREATE TABLE playlists (name VARCHAR, id VARCHAR) ###Answer: SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING COUNT(T1.track_id) > 100" "convert the question into postgresql query using the context values ### Question: List all tracks bought by customer Daan Peeters. ### Context: CREATE TABLE invoices (id VARCHAR, customer_id VARCHAR); CREATE TABLE invoice_lines (track_id VARCHAR, invoice_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR); CREATE TABLE customers (id VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = ""Daan"" AND T4.last_name = ""Peeters""" "convert the question into postgresql query using the context values ### Question: How much is the track Fast As a Shark? ### Context: CREATE TABLE tracks (unit_price VARCHAR, name VARCHAR) ###Answer: SELECT unit_price FROM tracks WHERE name = ""Fast As a Shark""" "convert the question into postgresql query using the context values ### Question: Find the name of tracks which are in Movies playlist but not in music playlist. ### Context: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'" "convert the question into postgresql query using the context values ### Question: Find the name of tracks which are in both Movies and music playlists. ### Context: CREATE TABLE playlists (id VARCHAR, name VARCHAR); CREATE TABLE playlist_tracks (track_id VARCHAR, playlist_id VARCHAR); CREATE TABLE tracks (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'" "convert the question into postgresql query using the context values ### Question: Find number of tracks in each genre? ### Context: CREATE TABLE tracks (genre_id VARCHAR); CREATE TABLE genres (name VARCHAR, id VARCHAR) ###Answer: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name" "convert the question into postgresql query using the context values ### Question: How many editors are there? ### Context: CREATE TABLE editor (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM editor" "convert the question into postgresql query using the context values ### Question: List the names of editors in ascending order of age. ### Context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM editor ORDER BY Age" "convert the question into postgresql query using the context values ### Question: What are the names and ages of editors? ### Context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name, Age FROM editor" "convert the question into postgresql query using the context values ### Question: List the names of editors who are older than 25. ### Context: CREATE TABLE editor (Name VARCHAR, Age INTEGER) ###Answer: SELECT Name FROM editor WHERE Age > 25" "convert the question into postgresql query using the context values ### Question: Show the names of editors of age either 24 or 25. ### Context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM editor WHERE Age = 24 OR Age = 25" "convert the question into postgresql query using the context values ### Question: What is the name of the youngest editor? ### Context: CREATE TABLE editor (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM editor ORDER BY Age LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the different ages of editors? Show each age along with the number of editors of that age. ### Context: CREATE TABLE editor (Age VARCHAR) ###Answer: SELECT Age, COUNT(*) FROM editor GROUP BY Age" "convert the question into postgresql query using the context values ### Question: Please show the most common age of editors. ### Context: CREATE TABLE editor (Age VARCHAR) ###Answer: SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the distinct themes of journals. ### Context: CREATE TABLE journal (Theme VARCHAR) ###Answer: SELECT DISTINCT Theme FROM journal" "convert the question into postgresql query using the context values ### Question: Show the names of editors and the theme of journals for which they serve on committees. ### Context: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR) ###Answer: SELECT T2.Name, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID" "convert the question into postgresql query using the context values ### Question: Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme. ### Context: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, age VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Theme VARCHAR, Journal_ID VARCHAR) ###Answer: SELECT T2.Name, T2.age, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme" "convert the question into postgresql query using the context values ### Question: Show the names of editors that are on the committee of journals with sales bigger than 3000. ### Context: CREATE TABLE journal_committee (Editor_ID VARCHAR, Journal_ID VARCHAR); CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal (Journal_ID VARCHAR, Sales INTEGER) ###Answer: SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000" "convert the question into postgresql query using the context values ### Question: Show the id, name of each editor and the number of journal committees they are on. ### Context: CREATE TABLE editor (editor_id VARCHAR, Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR) ###Answer: SELECT T1.editor_id, T1.Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id" "convert the question into postgresql query using the context values ### Question: Show the names of editors that are on at least two journal committees. ### Context: CREATE TABLE editor (Name VARCHAR, Editor_ID VARCHAR); CREATE TABLE journal_committee (Editor_ID VARCHAR) ###Answer: SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: List the names of editors that are not on any journal committee. ### Context: CREATE TABLE editor (Name VARCHAR, editor_id VARCHAR); CREATE TABLE journal_committee (Name VARCHAR, editor_id VARCHAR) ###Answer: SELECT Name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee)" "convert the question into postgresql query using the context values ### Question: List the date, theme and sales of the journal which did not have any of the listed editors serving on committee. ### Context: CREATE TABLE journal_committee (journal_ID VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR); CREATE TABLE journal (date VARCHAR, theme VARCHAR, sales VARCHAR, journal_ID VARCHAR) ###Answer: SELECT date, theme, sales FROM journal EXCEPT SELECT T1.date, T1.theme, T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID" "convert the question into postgresql query using the context values ### Question: What is the average sales of the journals that have an editor whose work type is 'Photo'? ### Context: CREATE TABLE journal_committee (journal_ID VARCHAR, work_type VARCHAR); CREATE TABLE journal (sales INTEGER, journal_ID VARCHAR) ###Answer: SELECT AVG(T1.sales) FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID WHERE T2.work_type = 'Photo'" "convert the question into postgresql query using the context values ### Question: How many accounts do we have? ### Context: CREATE TABLE Accounts (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Accounts" "convert the question into postgresql query using the context values ### Question: Show ids, customer ids, names for all accounts. ### Context: CREATE TABLE Accounts (account_id VARCHAR, customer_id VARCHAR, account_name VARCHAR) ###Answer: SELECT account_id, customer_id, account_name FROM Accounts" "convert the question into postgresql query using the context values ### Question: Show other account details for account with name 338. ### Context: CREATE TABLE Accounts (other_account_details VARCHAR, account_name VARCHAR) ###Answer: SELECT other_account_details FROM Accounts WHERE account_name = ""338""" "convert the question into postgresql query using the context values ### Question: What is the first name, last name, and phone of the customer with account name 162? ### Context: CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR, account_name VARCHAR) ###Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = ""162""" "convert the question into postgresql query using the context values ### Question: How many accounts does the customer with first name Art and last name Turcotte have? ### Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) ###Answer: SELECT COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = ""Art"" AND T2.customer_last_name = ""Turcotte""" "convert the question into postgresql query using the context values ### Question: Show all customer ids and the number of accounts for each customer. ### Context: CREATE TABLE Accounts (customer_id VARCHAR) ###Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id" "convert the question into postgresql query using the context values ### Question: Show the customer id and number of accounts with most accounts. ### Context: CREATE TABLE Accounts (customer_id VARCHAR) ###Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the customer first, last name and id with least number of accounts. ### Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the number of all customers without an account. ### Context: CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) ###Answer: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts)" "convert the question into postgresql query using the context values ### Question: Show the first names and last names of customers without any account. ### Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR) ###Answer: SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id" "convert the question into postgresql query using the context values ### Question: Show distinct first and last names for all customers with an account. ### Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id" "convert the question into postgresql query using the context values ### Question: How many customers have an account? ### Context: CREATE TABLE Accounts (customer_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts" "convert the question into postgresql query using the context values ### Question: How many customers do we have? ### Context: CREATE TABLE Customers (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Customers" "convert the question into postgresql query using the context values ### Question: Show ids, first names, last names, and phones for all customers. ### Context: CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR) ###Answer: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers" "convert the question into postgresql query using the context values ### Question: What is the phone and email for customer with first name Aniyah and last name Feest? ### Context: CREATE TABLE Customers (customer_phone VARCHAR, customer_email VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) ###Answer: SELECT customer_phone, customer_email FROM Customers WHERE customer_first_name = ""Aniyah"" AND customer_last_name = ""Feest""" "convert the question into postgresql query using the context values ### Question: Show the number of customer cards. ### Context: CREATE TABLE Customers_cards (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Customers_cards" "convert the question into postgresql query using the context values ### Question: Show ids, customer ids, card type codes, card numbers for all cards. ### Context: CREATE TABLE Customers_cards (card_id VARCHAR, customer_id VARCHAR, card_type_code VARCHAR, card_number VARCHAR) ###Answer: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards" "convert the question into postgresql query using the context values ### Question: Show the date valid from and the date valid to for the card with card number '4560596484842'. ### Context: CREATE TABLE Customers_cards (date_valid_from VARCHAR, date_valid_to VARCHAR, card_number VARCHAR) ###Answer: SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = ""4560596484842""" "convert the question into postgresql query using the context values ### Question: What is the first name, last name, and phone of the customer with card 4560596484842. ### Context: CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE Customers_cards (customer_id VARCHAR, card_number VARCHAR) ###Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = ""4560596484842""" "convert the question into postgresql query using the context values ### Question: How many cards does customer Art Turcotte have? ### Context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) ###Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = ""Art"" AND T2.customer_last_name = ""Turcotte""" "convert the question into postgresql query using the context values ### Question: How many debit cards do we have? ### Context: CREATE TABLE Customers_cards (card_type_code VARCHAR) ###Answer: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = ""Debit""" "convert the question into postgresql query using the context values ### Question: How many credit cards does customer Blanche Huels have? ### Context: CREATE TABLE Customers_cards (customer_id VARCHAR, card_type_code VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR) ###Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = ""Blanche"" AND T2.customer_last_name = ""Huels"" AND T1.card_type_code = ""Credit""" "convert the question into postgresql query using the context values ### Question: Show all customer ids and the number of cards owned by each customer. ### Context: CREATE TABLE Customers_cards (customer_id VARCHAR) ###Answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id" "convert the question into postgresql query using the context values ### Question: What is the customer id with most number of cards, and how many does he have? ### Context: CREATE TABLE Customers_cards (customer_id VARCHAR) ###Answer: SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show id, first and last names for all customers with at least two cards. ### Context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What is the customer id, first and last name with least number of accounts. ### Context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show all card type codes and the number of cards in each type. ### Context: CREATE TABLE Customers_cards (card_type_code VARCHAR) ###Answer: SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code" "convert the question into postgresql query using the context values ### Question: What is the card type code with most number of cards? ### Context: CREATE TABLE Customers_cards (card_type_code VARCHAR) ###Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show card type codes with at least 5 cards. ### Context: CREATE TABLE Customers_cards (card_type_code VARCHAR) ###Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5" "convert the question into postgresql query using the context values ### Question: Show all card type codes and the number of customers holding cards in each type. ### Context: CREATE TABLE Customers_cards (card_type_code VARCHAR, customer_id VARCHAR) ###Answer: SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code" "convert the question into postgresql query using the context values ### Question: Show the customer ids and firstname without a credit card. ### Context: CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, card_type_code VARCHAR) ###Answer: SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = ""Credit""" "convert the question into postgresql query using the context values ### Question: Show all card type codes. ### Context: CREATE TABLE Customers_Cards (card_type_code VARCHAR) ###Answer: SELECT DISTINCT card_type_code FROM Customers_Cards" "convert the question into postgresql query using the context values ### Question: Show the number of card types. ### Context: CREATE TABLE Customers_Cards (card_type_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards" "convert the question into postgresql query using the context values ### Question: Show all transaction types. ### Context: CREATE TABLE Financial_Transactions (transaction_type VARCHAR) ###Answer: SELECT DISTINCT transaction_type FROM Financial_Transactions" "convert the question into postgresql query using the context values ### Question: Show the number of transaction types. ### Context: CREATE TABLE Financial_Transactions (transaction_type VARCHAR) ###Answer: SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions" "convert the question into postgresql query using the context values ### Question: What is the average and total transaction amount? ### Context: CREATE TABLE Financial_transactions (transaction_amount INTEGER) ###Answer: SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions" "convert the question into postgresql query using the context values ### Question: Show the card type codes and the number of transactions. ### Context: CREATE TABLE Financial_transactions (card_id VARCHAR); CREATE TABLE Customers_cards (card_type_code VARCHAR, card_id VARCHAR) ###Answer: SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code" "convert the question into postgresql query using the context values ### Question: Show the transaction type and the number of transactions. ### Context: CREATE TABLE Financial_transactions (transaction_type VARCHAR) ###Answer: SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type" "convert the question into postgresql query using the context values ### Question: What is the transaction type that has processed the greatest total amount in transactions? ### Context: CREATE TABLE Financial_transactions (transaction_type VARCHAR, transaction_amount INTEGER) ###Answer: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the account id and the number of transactions for each account ### Context: CREATE TABLE Financial_transactions (account_id VARCHAR) ###Answer: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id" "convert the question into postgresql query using the context values ### Question: How many tracks do we have? ### Context: CREATE TABLE track (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM track" "convert the question into postgresql query using the context values ### Question: Show the name and location for all tracks. ### Context: CREATE TABLE track (name VARCHAR, LOCATION VARCHAR) ###Answer: SELECT name, LOCATION FROM track" "convert the question into postgresql query using the context values ### Question: Show names and seatings, ordered by seating for all tracks opened after 2000. ### Context: CREATE TABLE track (name VARCHAR, seating VARCHAR, year_opened INTEGER) ###Answer: SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating" "convert the question into postgresql query using the context values ### Question: What is the name, location and seating for the most recently opened track? ### Context: CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, seating VARCHAR, year_opened VARCHAR) ###Answer: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the minimum, maximum, and average seating for all tracks. ### Context: CREATE TABLE track (seating INTEGER) ###Answer: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track" "convert the question into postgresql query using the context values ### Question: Show the name, location, open year for all tracks with a seating higher than the average. ### Context: CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, year_opened VARCHAR, seating INTEGER) ###Answer: SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)" "convert the question into postgresql query using the context values ### Question: What are distinct locations where tracks are located? ### Context: CREATE TABLE track (LOCATION VARCHAR) ###Answer: SELECT DISTINCT LOCATION FROM track" "convert the question into postgresql query using the context values ### Question: How many races are there? ### Context: CREATE TABLE race (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM race" "convert the question into postgresql query using the context values ### Question: What are the distinct classes that races can have? ### Context: CREATE TABLE race (CLASS VARCHAR) ###Answer: SELECT DISTINCT CLASS FROM race" "convert the question into postgresql query using the context values ### Question: Show name, class, and date for all races. ### Context: CREATE TABLE race (name VARCHAR, CLASS VARCHAR, date VARCHAR) ###Answer: SELECT name, CLASS, date FROM race" "convert the question into postgresql query using the context values ### Question: Show the race class and number of races in each class. ### Context: CREATE TABLE race (CLASS VARCHAR) ###Answer: SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS" "convert the question into postgresql query using the context values ### Question: What is the race class with most number of races. ### Context: CREATE TABLE race (CLASS VARCHAR) ###Answer: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the race class with at least two races. ### Context: CREATE TABLE race (CLASS VARCHAR) ###Answer: SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What are the names for tracks without a race in class 'GT'. ### Context: CREATE TABLE race (track_id VARCHAR, class VARCHAR); CREATE TABLE track (name VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR) ###Answer: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'" "convert the question into postgresql query using the context values ### Question: Show all track names that have had no races. ### Context: CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (name VARCHAR, track_id VARCHAR) ###Answer: SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)" "convert the question into postgresql query using the context values ### Question: Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened. ### Context: CREATE TABLE track (year_opened VARCHAR, seating INTEGER) ###Answer: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000" "convert the question into postgresql query using the context values ### Question: Show the name of track and the number of races in each track. ### Context: CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (track_id VARCHAR) ###Answer: SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id" "convert the question into postgresql query using the context values ### Question: Show the name of track with most number of races. ### Context: CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (track_id VARCHAR) ###Answer: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the name and date for each race and its track name. ### Context: CREATE TABLE race (name VARCHAR, date VARCHAR, track_id VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR) ###Answer: SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id" "convert the question into postgresql query using the context values ### Question: Show the name and location of track with 1 race. ### Context: CREATE TABLE race (track_id VARCHAR); CREATE TABLE track (name VARCHAR, location VARCHAR, track_id VARCHAR) ###Answer: SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1" "convert the question into postgresql query using the context values ### Question: Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats. ### Context: CREATE TABLE track (LOCATION VARCHAR, seating INTEGER) ###Answer: SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000" "convert the question into postgresql query using the context values ### Question: How many members have the black membership card? ### Context: CREATE TABLE member (Membership_card VARCHAR) ###Answer: SELECT COUNT(*) FROM member WHERE Membership_card = 'Black'" "convert the question into postgresql query using the context values ### Question: Find the number of members living in each address. ### Context: CREATE TABLE member (address VARCHAR) ###Answer: SELECT COUNT(*), address FROM member GROUP BY address" "convert the question into postgresql query using the context values ### Question: Give me the names of members whose address is in Harford or Waterbury. ### Context: CREATE TABLE member (name VARCHAR, address VARCHAR) ###Answer: SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'" "convert the question into postgresql query using the context values ### Question: Find the ids and names of members who are under age 30 or with black membership card. ### Context: CREATE TABLE member (name VARCHAR, member_id VARCHAR, Membership_card VARCHAR, age VARCHAR) ###Answer: SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30" "convert the question into postgresql query using the context values ### Question: Find the purchase time, age and address of each member, and show the results in the order of purchase time. ### Context: CREATE TABLE member (Time_of_purchase VARCHAR, age VARCHAR, address VARCHAR) ###Answer: SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase" "convert the question into postgresql query using the context values ### Question: Which membership card has more than 5 members? ### Context: CREATE TABLE member (Membership_card VARCHAR) ###Answer: SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5" "convert the question into postgresql query using the context values ### Question: Which address has both members younger than 30 and members older than 40? ### Context: CREATE TABLE member (address VARCHAR, age INTEGER) ###Answer: SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40" "convert the question into postgresql query using the context values ### Question: What is the membership card held by both members living in Hartford and ones living in Waterbury address? ### Context: CREATE TABLE member (membership_card VARCHAR, address VARCHAR) ###Answer: SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'" "convert the question into postgresql query using the context values ### Question: How many members are not living in Hartford? ### Context: CREATE TABLE member (address VARCHAR) ###Answer: SELECT COUNT(*) FROM member WHERE address <> 'Hartford'" "convert the question into postgresql query using the context values ### Question: Which address do not have any member with the black membership card? ### Context: CREATE TABLE member (address VARCHAR, Membership_card VARCHAR) ###Answer: SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'" "convert the question into postgresql query using the context values ### Question: Show the shop addresses ordered by their opening year. ### Context: CREATE TABLE shop (address VARCHAR, open_year VARCHAR) ###Answer: SELECT address FROM shop ORDER BY open_year" "convert the question into postgresql query using the context values ### Question: What are the average score and average staff number of all shops? ### Context: CREATE TABLE shop (num_of_staff INTEGER, score INTEGER) ###Answer: SELECT AVG(num_of_staff), AVG(score) FROM shop" "convert the question into postgresql query using the context values ### Question: Find the id and address of the shops whose score is below the average score. ### Context: CREATE TABLE shop (shop_id VARCHAR, address VARCHAR, score INTEGER) ###Answer: SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop)" "convert the question into postgresql query using the context values ### Question: Find the address and staff number of the shops that do not have any happy hour. ### Context: CREATE TABLE shop (address VARCHAR, num_of_staff VARCHAR, shop_id VARCHAR); CREATE TABLE happy_hour (address VARCHAR, num_of_staff VARCHAR, shop_id VARCHAR) ###Answer: SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour)" "convert the question into postgresql query using the context values ### Question: What are the id and address of the shops which have a happy hour in May? ### Context: CREATE TABLE shop (address VARCHAR, shop_id VARCHAR); CREATE TABLE happy_hour (shop_id VARCHAR) ###Answer: SELECT t1.address, t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = 'May'" "convert the question into postgresql query using the context values ### Question: which shop has happy hour most frequently? List its id and number of happy hours. ### Context: CREATE TABLE happy_hour (shop_id VARCHAR) ###Answer: SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which month has the most happy hours? ### Context: CREATE TABLE happy_hour (MONTH VARCHAR) ###Answer: SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which months have more than 2 happy hours? ### Context: CREATE TABLE happy_hour (MONTH VARCHAR) ###Answer: SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: How many albums are there? ### Context: CREATE TABLE ALBUM (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM ALBUM" "convert the question into postgresql query using the context values ### Question: List the names of all music genres. ### Context: CREATE TABLE GENRE (Name VARCHAR) ###Answer: SELECT Name FROM GENRE" "convert the question into postgresql query using the context values ### Question: Find all the customer information in state NY. ### Context: CREATE TABLE CUSTOMER (State VARCHAR) ###Answer: SELECT * FROM CUSTOMER WHERE State = ""NY""" "convert the question into postgresql query using the context values ### Question: What are the first names and last names of the employees who live in Calgary city. ### Context: CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, City VARCHAR) ###Answer: SELECT FirstName, LastName FROM EMPLOYEE WHERE City = ""Calgary""" "convert the question into postgresql query using the context values ### Question: What are the distinct billing countries of the invoices? ### Context: CREATE TABLE INVOICE (BillingCountry VARCHAR) ###Answer: SELECT DISTINCT (BillingCountry) FROM INVOICE" "convert the question into postgresql query using the context values ### Question: Find the names of all artists that have ""a"" in their names. ### Context: CREATE TABLE ARTIST (Name VARCHAR) ###Answer: SELECT Name FROM ARTIST WHERE Name LIKE ""%a%""" "convert the question into postgresql query using the context values ### Question: Find the title of all the albums of the artist ""AC/DC"". ### Context: CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR) ###Answer: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = ""AC/DC""" "convert the question into postgresql query using the context values ### Question: Hom many albums does the artist ""Metallica"" have? ### Context: CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR) ###Answer: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = ""Metallica""" "convert the question into postgresql query using the context values ### Question: Which artist does the album ""Balls to the Wall"" belong to? ### Context: CREATE TABLE ALBUM (ArtistId VARCHAR, Title VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR) ###Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = ""Balls to the Wall""" "convert the question into postgresql query using the context values ### Question: Which artist has the most albums? ### Context: CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR) ###Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names of all the tracks that contain the word ""you"". ### Context: CREATE TABLE TRACK (Name VARCHAR) ###Answer: SELECT Name FROM TRACK WHERE Name LIKE '%you%'" "convert the question into postgresql query using the context values ### Question: What is the average unit price of all the tracks? ### Context: CREATE TABLE TRACK (UnitPrice INTEGER) ###Answer: SELECT AVG(UnitPrice) FROM TRACK" "convert the question into postgresql query using the context values ### Question: What are the durations of the longest and the shortest tracks in milliseconds? ### Context: CREATE TABLE TRACK (Milliseconds INTEGER) ###Answer: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK" "convert the question into postgresql query using the context values ### Question: Show the album names, ids and the number of tracks for each album. ### Context: CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR) ###Answer: SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID" "convert the question into postgresql query using the context values ### Question: What is the name of the most common genre in all tracks? ### Context: CREATE TABLE GENRE (Name VARCHAR, GenreId VARCHAR); CREATE TABLE TRACK (GenreId VARCHAR) ###Answer: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the least common media type in all tracks? ### Context: CREATE TABLE MEDIATYPE (Name VARCHAR, MediaTypeId VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR) ###Answer: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the album names and ids for albums that contain tracks with unit price bigger than 1. ### Context: CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR, UnitPrice INTEGER) ###Answer: SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID" "convert the question into postgresql query using the context values ### Question: How many tracks belong to rock genre? ### Context: CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR) ###Answer: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = ""Rock""" "convert the question into postgresql query using the context values ### Question: What is the average unit price of tracks that belong to Jazz genre? ### Context: CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR) ###Answer: SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = ""Jazz""" "convert the question into postgresql query using the context values ### Question: What is the first name and last name of the customer that has email ""luisg@embraer.com.br""? ### Context: CREATE TABLE CUSTOMER (FirstName VARCHAR, LastName VARCHAR, Email VARCHAR) ###Answer: SELECT FirstName, LastName FROM CUSTOMER WHERE Email = ""luisg@embraer.com.br""" "convert the question into postgresql query using the context values ### Question: How many customers have email that contains ""gmail.com""? ### Context: CREATE TABLE CUSTOMER (Email VARCHAR) ###Answer: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE ""%gmail.com%""" "convert the question into postgresql query using the context values ### Question: What is the first name and last name employee helps the customer with first name Leonie? ### Context: CREATE TABLE CUSTOMER (SupportRepId VARCHAR, FirstName VARCHAR); CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, EmployeeId VARCHAR) ###Answer: SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = ""Leonie""" "convert the question into postgresql query using the context values ### Question: What city does the employee who helps the customer with postal code 70174 live in? ### Context: CREATE TABLE EMPLOYEE (City VARCHAR, EmployeeId VARCHAR); CREATE TABLE CUSTOMER (SupportRepId VARCHAR, PostalCode VARCHAR) ###Answer: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = ""70174""" "convert the question into postgresql query using the context values ### Question: How many distinct cities does the employees live in? ### Context: CREATE TABLE EMPLOYEE (city VARCHAR) ###Answer: SELECT COUNT(DISTINCT city) FROM EMPLOYEE" "convert the question into postgresql query using the context values ### Question: Find all invoice dates corresponding to customers with first name Astrid and last name Gruber. ### Context: CREATE TABLE CUSTOMER (CustomerId VARCHAR, FirstName VARCHAR); CREATE TABLE INVOICE (InvoiceDate VARCHAR, CustomerId VARCHAR) ###Answer: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = ""Astrid"" AND LastName = ""Gruber""" "convert the question into postgresql query using the context values ### Question: Find all the customer last names that do not have invoice totals larger than 20. ### Context: CREATE TABLE CUSTOMER (LastName VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, CustomerId VARCHAR); CREATE TABLE Invoice (CustomerId VARCHAR, total INTEGER) ###Answer: SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20" "convert the question into postgresql query using the context values ### Question: Find the first names of all customers that live in Brazil and have an invoice. ### Context: CREATE TABLE CUSTOMER (FirstName VARCHAR, CustomerId VARCHAR, country VARCHAR); CREATE TABLE INVOICE (CustomerId VARCHAR) ###Answer: SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = ""Brazil""" "convert the question into postgresql query using the context values ### Question: Find the address of all customers that live in Germany and have invoice. ### Context: CREATE TABLE INVOICE (CustomerId VARCHAR); CREATE TABLE CUSTOMER (Address VARCHAR, CustomerId VARCHAR, country VARCHAR) ###Answer: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = ""Germany""" "convert the question into postgresql query using the context values ### Question: List the phone numbers of all employees. ### Context: CREATE TABLE EMPLOYEE (Phone VARCHAR) ###Answer: SELECT Phone FROM EMPLOYEE" "convert the question into postgresql query using the context values ### Question: How many tracks are in the AAC audio file media type? ### Context: CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR) ###Answer: SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = ""AAC audio file""" "convert the question into postgresql query using the context values ### Question: What is the average duration in milliseconds of tracks that belong to Latin or Pop genre? ### Context: CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR) ###Answer: SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = ""Latin"" OR T1.Name = ""Pop""" "convert the question into postgresql query using the context values ### Question: Please show the employee first names and ids of employees who serve at least 10 customers. ### Context: CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR); CREATE TABLE EMPLOYEE (EmployeeId VARCHAR) ###Answer: SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10" "convert the question into postgresql query using the context values ### Question: Please show the employee last names that serves no more than 20 customers. ### Context: CREATE TABLE EMPLOYEE (EmployeeId VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, SupportRepId VARCHAR) ###Answer: SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20" "convert the question into postgresql query using the context values ### Question: Please list all album titles in alphabetical order. ### Context: CREATE TABLE ALBUM (Title VARCHAR) ###Answer: SELECT Title FROM ALBUM ORDER BY Title" "convert the question into postgresql query using the context values ### Question: Please list the name and id of all artists that have at least 3 albums in alphabetical order. ### Context: CREATE TABLE ARTIST (Name VARCHAR, ArtistID VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR) ###Answer: SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name" "convert the question into postgresql query using the context values ### Question: Find the names of artists that do not have any albums. ### Context: CREATE TABLE ARTIST (Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR) ###Answer: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId" "convert the question into postgresql query using the context values ### Question: What is the average unit price of rock tracks? ### Context: CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (UnitPrice INTEGER, GenreId VARCHAR) ###Answer: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = ""Rock""" "convert the question into postgresql query using the context values ### Question: What are the duration of the longest and shortest pop tracks in milliseconds? ### Context: CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR) ###Answer: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = ""Pop""" "convert the question into postgresql query using the context values ### Question: What are the birth dates of employees living in Edmonton? ### Context: CREATE TABLE EMPLOYEE (BirthDate VARCHAR, City VARCHAR) ###Answer: SELECT BirthDate FROM EMPLOYEE WHERE City = ""Edmonton""" "convert the question into postgresql query using the context values ### Question: What are the distinct unit prices of all tracks? ### Context: CREATE TABLE TRACK (UnitPrice VARCHAR) ###Answer: SELECT DISTINCT (UnitPrice) FROM TRACK" "convert the question into postgresql query using the context values ### Question: How many artists do not have any album? ### Context: CREATE TABLE ARTIST (artistid VARCHAR); CREATE TABLE ALBUM (artistid VARCHAR) ###Answer: SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)" "convert the question into postgresql query using the context values ### Question: What are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks? ### Context: CREATE TABLE Genre (GenreID VARCHAR, Name VARCHAR); CREATE TABLE Track (AlbumId VARCHAR, GenreID VARCHAR); CREATE TABLE Album (Title VARCHAR, AlbumId VARCHAR) ###Answer: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock'" "convert the question into postgresql query using the context values ### Question: Find all the phone numbers. ### Context: CREATE TABLE available_policies (customer_phone VARCHAR) ###Answer: SELECT customer_phone FROM available_policies" "convert the question into postgresql query using the context values ### Question: What are the customer phone numbers under the policy ""Life Insurance""? ### Context: CREATE TABLE available_policies (customer_phone VARCHAR, policy_type_code VARCHAR) ###Answer: SELECT customer_phone FROM available_policies WHERE policy_type_code = ""Life Insurance""" "convert the question into postgresql query using the context values ### Question: Which policy type has the most records in the database? ### Context: CREATE TABLE available_policies (policy_type_code VARCHAR) ###Answer: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are all the customer phone numbers under the most popular policy type? ### Context: CREATE TABLE available_policies (customer_phone VARCHAR, policy_type_code VARCHAR) ###Answer: SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)" "convert the question into postgresql query using the context values ### Question: Find the policy type used by more than 4 customers. ### Context: CREATE TABLE available_policies (policy_type_code VARCHAR) ###Answer: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4" "convert the question into postgresql query using the context values ### Question: Find the total and average amount of settlements. ### Context: CREATE TABLE settlements (settlement_amount INTEGER) ###Answer: SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements" "convert the question into postgresql query using the context values ### Question: Find the name of services that have been used for more than 2 times in first notification of loss. ### Context: CREATE TABLE services (service_name VARCHAR, service_id VARCHAR); CREATE TABLE first_notification_of_loss (service_id VARCHAR) ###Answer: SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: What is the effective date of the claim that has the largest amount of total settlement? ### Context: CREATE TABLE settlements (claim_id VARCHAR, settlement_amount INTEGER); CREATE TABLE claims (Effective_Date VARCHAR, claim_id VARCHAR) ###Answer: SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY SUM(t2.settlement_amount) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many policies are listed for the customer named ""Dayana Robel""? ### Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customers_policies (customer_id VARCHAR) ###Answer: SELECT COUNT(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = ""Dayana Robel""" "convert the question into postgresql query using the context values ### Question: What is the name of the customer who has the most policies listed? ### Context: CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers_policies (customer_id VARCHAR) ###Answer: SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are all the policy types of the customer named ""Dayana Robel""? ### Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE available_policies (policy_type_code VARCHAR, policy_id VARCHAR); CREATE TABLE customers_policies (customer_id VARCHAR, policy_id VARCHAR) ###Answer: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = ""Dayana Robel""" "convert the question into postgresql query using the context values ### Question: What are all the policy types of the customer that has the most policies listed? ### Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE available_policies (policy_type_code VARCHAR, policy_id VARCHAR); CREATE TABLE customers_policies (customer_id VARCHAR, policy_id VARCHAR) ###Answer: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1)" "convert the question into postgresql query using the context values ### Question: List all the services in the alphabetical order. ### Context: CREATE TABLE services (service_name VARCHAR) ###Answer: SELECT service_name FROM services ORDER BY service_name" "convert the question into postgresql query using the context values ### Question: How many services are there? ### Context: CREATE TABLE services (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM services" "convert the question into postgresql query using the context values ### Question: Find the names of users who do not have a first notification of loss record. ### Context: CREATE TABLE first_notification_of_loss (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR) ###Answer: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id" "convert the question into postgresql query using the context values ### Question: Find the names of customers who have used either the service ""Close a policy"" or the service ""Upgrade a policy"". ### Context: CREATE TABLE first_notification_of_loss (customer_id VARCHAR, service_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE services (service_id VARCHAR, service_name VARCHAR) ###Answer: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = ""Close a policy"" OR t3.service_name = ""Upgrade a policy""" "convert the question into postgresql query using the context values ### Question: Find the names of customers who have used both the service ""Close a policy"" and the service ""New policy application"". ### Context: CREATE TABLE first_notification_of_loss (customer_id VARCHAR, service_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE services (service_id VARCHAR, service_name VARCHAR) ###Answer: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = ""Close a policy"" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = ""New policy application""" "convert the question into postgresql query using the context values ### Question: Find the IDs of customers whose name contains ""Diana"". ### Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR) ###Answer: SELECT customer_id FROM customers WHERE customer_name LIKE ""%Diana%""" "convert the question into postgresql query using the context values ### Question: What are the maximum and minimum settlement amount on record? ### Context: CREATE TABLE settlements (settlement_amount INTEGER) ###Answer: SELECT MAX(settlement_amount), MIN(settlement_amount) FROM settlements" "convert the question into postgresql query using the context values ### Question: List all the customers in increasing order of IDs. ### Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR) ###Answer: SELECT customer_id, customer_name FROM customers ORDER BY customer_id" "convert the question into postgresql query using the context values ### Question: Retrieve the open and close dates of all the policies associated with the customer whose name contains ""Diana"" ### Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customers_policies (date_opened VARCHAR, date_closed VARCHAR, customer_id VARCHAR) ###Answer: SELECT t2.date_opened, t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE ""%Diana%""" "convert the question into postgresql query using the context values ### Question: How many kinds of enzymes are there? ### Context: CREATE TABLE enzyme (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM enzyme" "convert the question into postgresql query using the context values ### Question: List the name of enzymes in descending lexicographical order. ### Context: CREATE TABLE enzyme (name VARCHAR) ###Answer: SELECT name FROM enzyme ORDER BY name DESC" "convert the question into postgresql query using the context values ### Question: List the names and the locations that the enzymes can make an effect. ### Context: CREATE TABLE enzyme (name VARCHAR, LOCATION VARCHAR) ###Answer: SELECT name, LOCATION FROM enzyme" "convert the question into postgresql query using the context values ### Question: What is the maximum Online Mendelian Inheritance in Man (OMIM) value of the enzymes? ### Context: CREATE TABLE enzyme (OMIM INTEGER) ###Answer: SELECT MAX(OMIM) FROM enzyme" "convert the question into postgresql query using the context values ### Question: What is the product, chromosome and porphyria related to the enzymes which take effect at the location 'Cytosol'? ### Context: CREATE TABLE enzyme (product VARCHAR, chromosome VARCHAR, porphyria VARCHAR, LOCATION VARCHAR) ###Answer: SELECT product, chromosome, porphyria FROM enzyme WHERE LOCATION = 'Cytosol'" "convert the question into postgresql query using the context values ### Question: What are the names of enzymes who does not produce 'Heme'? ### Context: CREATE TABLE enzyme (name VARCHAR, product VARCHAR) ###Answer: SELECT name FROM enzyme WHERE product <> 'Heme'" "convert the question into postgresql query using the context values ### Question: What are the names and trade names of the medicines which has 'Yes' value in the FDA record? ### Context: CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR, FDA_approved VARCHAR) ###Answer: SELECT name, trade_name FROM medicine WHERE FDA_approved = 'Yes'" "convert the question into postgresql query using the context values ### Question: What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'? ### Context: CREATE TABLE medicine (id VARCHAR, name VARCHAR); CREATE TABLE medicine_enzyme_interaction (enzyme_id VARCHAR, medicine_id VARCHAR, interaction_type VARCHAR); CREATE TABLE enzyme (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'" "convert the question into postgresql query using the context values ### Question: What are the ids and names of the medicine that can interact with two or more enzymes? ### Context: CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR); CREATE TABLE medicine (id VARCHAR, Name VARCHAR) ###Answer: SELECT T1.id, T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with. ### Context: CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR); CREATE TABLE medicine (id VARCHAR, Name VARCHAR, FDA_approved VARCHAR) ###Answer: SELECT T1.id, T1.Name, T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC" "convert the question into postgresql query using the context values ### Question: What is the id and name of the enzyme with most number of medicines that can interact as 'activator'? ### Context: CREATE TABLE medicine_enzyme_interaction (enzyme_id VARCHAR, interaction_type VARCHAR); CREATE TABLE enzyme (id VARCHAR, name VARCHAR) ###Answer: SELECT T1.id, T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'? ### Context: CREATE TABLE enzyme (id VARCHAR, name VARCHAR); CREATE TABLE medicine (id VARCHAR, name VARCHAR); CREATE TABLE medicine_enzyme_interaction (interaction_type VARCHAR, medicine_id VARCHAR, enzyme_id VARCHAR) ###Answer: SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'" "convert the question into postgresql query using the context values ### Question: What is the most common interaction type between enzymes and medicine? And how many are there? ### Context: CREATE TABLE medicine_enzyme_interaction (interaction_type VARCHAR) ###Answer: SELECT interaction_type, COUNT(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many medicines have the FDA approval status 'No' ? ### Context: CREATE TABLE medicine (FDA_approved VARCHAR) ###Answer: SELECT COUNT(*) FROM medicine WHERE FDA_approved = 'No'" "convert the question into postgresql query using the context values ### Question: How many enzymes do not have any interactions? ### Context: CREATE TABLE medicine_enzyme_interaction (id VARCHAR, enzyme_id VARCHAR); CREATE TABLE enzyme (id VARCHAR, enzyme_id VARCHAR) ###Answer: SELECT COUNT(*) FROM enzyme WHERE NOT id IN (SELECT enzyme_id FROM medicine_enzyme_interaction)" "convert the question into postgresql query using the context values ### Question: What is the id and trade name of the medicines can interact with at least 3 enzymes? ### Context: CREATE TABLE medicine (id VARCHAR, trade_name VARCHAR); CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR) ###Answer: SELECT T1.id, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3" "convert the question into postgresql query using the context values ### Question: What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction? ### Context: CREATE TABLE enzyme (name VARCHAR, location VARCHAR, product VARCHAR, id VARCHAR); CREATE TABLE medicine_enzyme_interaction (enzyme_id VARCHAR, interaction_type VARCHAR) ###Answer: SELECT DISTINCT T1.name, T1.location, T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'" "convert the question into postgresql query using the context values ### Question: List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes. ### Context: CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR, id VARCHAR); CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR) ###Answer: SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'" "convert the question into postgresql query using the context values ### Question: Show the medicine names and trade names that cannot interact with the enzyme with product 'Heme'. ### Context: CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR); CREATE TABLE medicine_enzyme_interaction (medicine_id VARCHAR, enzyme_id VARCHAR); CREATE TABLE medicine (name VARCHAR, trade_name VARCHAR, id VARCHAR); CREATE TABLE enzyme (id VARCHAR, product VARCHAR) ###Answer: SELECT name, trade_name FROM medicine EXCEPT SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'" "convert the question into postgresql query using the context values ### Question: How many distinct FDA approval statuses are there for the medicines? ### Context: CREATE TABLE medicine (FDA_approved VARCHAR) ###Answer: SELECT COUNT(DISTINCT FDA_approved) FROM medicine" "convert the question into postgresql query using the context values ### Question: Which enzyme names have the substring ""ALA""? ### Context: CREATE TABLE enzyme (name VARCHAR) ###Answer: SELECT name FROM enzyme WHERE name LIKE ""%ALA%""" "convert the question into postgresql query using the context values ### Question: find the number of medicines offered by each trade. ### Context: CREATE TABLE medicine (trade_name VARCHAR) ###Answer: SELECT trade_name, COUNT(*) FROM medicine GROUP BY trade_name" "convert the question into postgresql query using the context values ### Question: List all schools and their nicknames in the order of founded year. ### Context: CREATE TABLE university (school VARCHAR, nickname VARCHAR, founded VARCHAR) ###Answer: SELECT school, nickname FROM university ORDER BY founded" "convert the question into postgresql query using the context values ### Question: List all public schools and their locations. ### Context: CREATE TABLE university (school VARCHAR, LOCATION VARCHAR, affiliation VARCHAR) ###Answer: SELECT school, LOCATION FROM university WHERE affiliation = 'Public'" "convert the question into postgresql query using the context values ### Question: When was the school with the largest enrollment founded? ### Context: CREATE TABLE university (founded VARCHAR, enrollment VARCHAR) ###Answer: SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the founded year of the newest non public school. ### Context: CREATE TABLE university (founded VARCHAR, affiliation VARCHAR) ###Answer: SELECT founded FROM university WHERE affiliation <> 'Public' ORDER BY founded DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many schools are in the basketball match? ### Context: CREATE TABLE basketball_match (school_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT school_id) FROM basketball_match" "convert the question into postgresql query using the context values ### Question: What is the highest acc percent score in the competition? ### Context: CREATE TABLE basketball_match (acc_percent VARCHAR) ###Answer: SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the primary conference of the school that has the lowest acc percent score in the competition? ### Context: CREATE TABLE basketball_match (school_id VARCHAR, acc_percent VARCHAR); CREATE TABLE university (Primary_conference VARCHAR, school_id VARCHAR) ###Answer: SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the team name and acc regular season score of the school that was founded for the longest time? ### Context: CREATE TABLE university (school_id VARCHAR, founded VARCHAR); CREATE TABLE basketball_match (team_name VARCHAR, ACC_Regular_Season VARCHAR, school_id VARCHAR) ###Answer: SELECT t2.team_name, t2.ACC_Regular_Season FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t1.founded LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the location and all games score of the school that has Clemson as its team name. ### Context: CREATE TABLE basketball_match (All_Games VARCHAR, school_id VARCHAR); CREATE TABLE university (location VARCHAR, school_id VARCHAR) ###Answer: SELECT t2.All_Games, t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson'" "convert the question into postgresql query using the context values ### Question: What are the average enrollment size of the universities that are founded before 1850? ### Context: CREATE TABLE university (enrollment INTEGER, founded INTEGER) ###Answer: SELECT AVG(enrollment) FROM university WHERE founded < 1850" "convert the question into postgresql query using the context values ### Question: Show the enrollment and primary_conference of the oldest college. ### Context: CREATE TABLE university (enrollment VARCHAR, primary_conference VARCHAR, founded VARCHAR) ###Answer: SELECT enrollment, primary_conference FROM university ORDER BY founded LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the total and minimum enrollment of all schools? ### Context: CREATE TABLE university (enrollment INTEGER) ###Answer: SELECT SUM(enrollment), MIN(enrollment) FROM university" "convert the question into postgresql query using the context values ### Question: Find the total student enrollment for different affiliation type schools. ### Context: CREATE TABLE university (affiliation VARCHAR, enrollment INTEGER) ###Answer: SELECT SUM(enrollment), affiliation FROM university GROUP BY affiliation" "convert the question into postgresql query using the context values ### Question: How many schools do not participate in the basketball match? ### Context: CREATE TABLE university (school_id VARCHAR); CREATE TABLE basketball_match (school_id VARCHAR) ###Answer: SELECT COUNT(*) FROM university WHERE NOT school_id IN (SELECT school_id FROM basketball_match)" "convert the question into postgresql query using the context values ### Question: Find the schools that were either founded after 1850 or public. ### Context: CREATE TABLE university (school VARCHAR, founded VARCHAR, affiliation VARCHAR) ###Answer: SELECT school FROM university WHERE founded > 1850 OR affiliation = 'Public'" "convert the question into postgresql query using the context values ### Question: Find how many different affiliation types there are. ### Context: CREATE TABLE university (affiliation VARCHAR) ###Answer: SELECT COUNT(DISTINCT affiliation) FROM university" "convert the question into postgresql query using the context values ### Question: Find how many school locations have the word 'NY'. ### Context: CREATE TABLE university (LOCATION VARCHAR) ###Answer: SELECT COUNT(*) FROM university WHERE LOCATION LIKE ""%NY%""" "convert the question into postgresql query using the context values ### Question: Find the team names of the universities whose enrollments are smaller than the average enrollment size. ### Context: CREATE TABLE university (school_id VARCHAR); CREATE TABLE basketball_match (team_name VARCHAR, school_id VARCHAR); CREATE TABLE university (enrollment INTEGER) ###Answer: SELECT t2.team_name FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE enrollment < (SELECT AVG(enrollment) FROM university)" "convert the question into postgresql query using the context values ### Question: Find the number of universities that have over a 20000 enrollment size for each affiliation type. ### Context: CREATE TABLE university (affiliation VARCHAR, enrollment INTEGER) ###Answer: SELECT COUNT(*), affiliation FROM university WHERE enrollment > 20000 GROUP BY affiliation" "convert the question into postgresql query using the context values ### Question: Find the total number of students enrolled in the colleges that were founded after the year of 1850 for each affiliation type. ### Context: CREATE TABLE university (affiliation VARCHAR, Enrollment INTEGER, founded INTEGER) ###Answer: SELECT SUM(Enrollment), affiliation FROM university WHERE founded > 1850 GROUP BY affiliation" "convert the question into postgresql query using the context values ### Question: What is the maximum enrollment across all schools? ### Context: CREATE TABLE university (Enrollment INTEGER) ###Answer: SELECT MAX(Enrollment) FROM university" "convert the question into postgresql query using the context values ### Question: List all information regarding the basketball match. ### Context: CREATE TABLE basketball_match (Id VARCHAR) ###Answer: SELECT * FROM basketball_match" "convert the question into postgresql query using the context values ### Question: List names of all teams in the basketball competition, ordered by all home scores in descending order. ### Context: CREATE TABLE basketball_match (team_name VARCHAR, All_Home VARCHAR) ###Answer: SELECT team_name FROM basketball_match ORDER BY All_Home DESC" "convert the question into postgresql query using the context values ### Question: the names of models that launched between 2002 and 2004. ### Context: CREATE TABLE chip_model (Model_name VARCHAR, Launch_year INTEGER) ###Answer: SELECT Model_name FROM chip_model WHERE Launch_year BETWEEN 2002 AND 2004" "convert the question into postgresql query using the context values ### Question: Which model has the least amount of RAM? List the model name and the amount of RAM. ### Context: CREATE TABLE chip_model (Model_name VARCHAR, RAM_MiB VARCHAR) ###Answer: SELECT Model_name, RAM_MiB FROM chip_model ORDER BY RAM_MiB LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the chip model and screen mode of the phone with hardware model name ""LG-P760""? ### Context: CREATE TABLE phone (chip_model VARCHAR, screen_mode VARCHAR, Hardware_Model_name VARCHAR) ###Answer: SELECT chip_model, screen_mode FROM phone WHERE Hardware_Model_name = ""LG-P760""" "convert the question into postgresql query using the context values ### Question: How many phone hardware models are produced by the company named ""Nokia Corporation""? ### Context: CREATE TABLE phone (Company_name VARCHAR) ###Answer: SELECT COUNT(*) FROM phone WHERE Company_name = ""Nokia Corporation""" "convert the question into postgresql query using the context values ### Question: What is maximum and minimum RAM size of phone produced by company named ""Nokia Corporation""? ### Context: CREATE TABLE phone (chip_model VARCHAR, Company_name VARCHAR); CREATE TABLE chip_model (RAM_MiB INTEGER, Model_name VARCHAR) ###Answer: SELECT MAX(T1.RAM_MiB), MIN(T1.RAM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = ""Nokia Corporation""" "convert the question into postgresql query using the context values ### Question: What is the average ROM size of phones produced by the company named ""Nokia Corporation""? ### Context: CREATE TABLE phone (chip_model VARCHAR, Company_name VARCHAR); CREATE TABLE chip_model (ROM_MiB INTEGER, Model_name VARCHAR) ###Answer: SELECT AVG(T1.ROM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = ""Nokia Corporation""" "convert the question into postgresql query using the context values ### Question: List the hardware model name and company name for all the phones that were launched in year 2002 or have RAM size greater than 32. ### Context: CREATE TABLE chip_model (Model_name VARCHAR, Launch_year VARCHAR, RAM_MiB VARCHAR); CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, chip_model VARCHAR) ###Answer: SELECT T2.Hardware_Model_name, T2.Company_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32" "convert the question into postgresql query using the context values ### Question: Find all phones that have word 'Full' in their accreditation types. List the Hardware Model name and Company name. ### Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, Accreditation_type VARCHAR) ###Answer: SELECT Hardware_Model_name, Company_name FROM phone WHERE Accreditation_type LIKE 'Full'" "convert the question into postgresql query using the context values ### Question: Find the Char cells, Pixels and Hardware colours for the screen of the phone whose hardware model name is ""LG-P760"". ### Context: CREATE TABLE phone (screen_mode VARCHAR, Hardware_Model_name VARCHAR); CREATE TABLE screen_mode (Char_cells VARCHAR, Pixels VARCHAR, Hardware_colours VARCHAR, Graphics_mode VARCHAR) ###Answer: SELECT T1.Char_cells, T1.Pixels, T1.Hardware_colours FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Hardware_Model_name = ""LG-P760""" "convert the question into postgresql query using the context values ### Question: List the hardware model name and company name for the phone whose screen mode type is ""Graphics."" ### Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, Type VARCHAR) ###Answer: SELECT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = ""Graphics""" "convert the question into postgresql query using the context values ### Question: Find the name of the company that has the least number of phone models. List the company name and the number of phone model produced by that company. ### Context: CREATE TABLE phone (Company_name VARCHAR) ###Answer: SELECT Company_name, COUNT(*) FROM phone GROUP BY Company_name ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the name of the company that produced more than one phone model. ### Context: CREATE TABLE phone (Company_name VARCHAR) ###Answer: SELECT Company_name FROM phone GROUP BY Company_name HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: List the maximum, minimum and average number of used kb in screen mode. ### Context: CREATE TABLE screen_mode (used_kb INTEGER) ###Answer: SELECT MAX(used_kb), MIN(used_kb), AVG(used_kb) FROM screen_mode" "convert the question into postgresql query using the context values ### Question: List the name of the phone model launched in year 2002 and with the highest RAM size. ### Context: CREATE TABLE chip_model (Model_name VARCHAR, Launch_year VARCHAR, RAM_MiB VARCHAR); CREATE TABLE phone (Hardware_Model_name VARCHAR, chip_model VARCHAR) ###Answer: SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 ORDER BY T1.RAM_MiB DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the wifi and screen mode type of the hardware model named ""LG-P760""? ### Context: CREATE TABLE phone (chip_model VARCHAR, screen_mode VARCHAR, Hardware_Model_name VARCHAR); CREATE TABLE chip_model (WiFi VARCHAR, Model_name VARCHAR); CREATE TABLE screen_mode (Type VARCHAR, Graphics_mode VARCHAR) ###Answer: SELECT T1.WiFi, T3.Type FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T2.Hardware_Model_name = ""LG-P760""" "convert the question into postgresql query using the context values ### Question: List the hardware model name for the phones that have screen mode type ""Text"" or RAM size greater than 32. ### Context: CREATE TABLE chip_model (Model_name VARCHAR, RAM_MiB VARCHAR); CREATE TABLE phone (Hardware_Model_name VARCHAR, chip_model VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, Type VARCHAR) ###Answer: SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T3.Type = ""Text"" OR T1.RAM_MiB > 32" "convert the question into postgresql query using the context values ### Question: List the hardware model name for the phones that were produced by ""Nokia Corporation"" or whose screen mode type is ""Graphics."" ### Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, Type VARCHAR) ###Answer: SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = ""Graphics"" OR t2.Company_name = ""Nokia Corporation""" "convert the question into postgresql query using the context values ### Question: List the hardware model name for the phons that were produced by ""Nokia Corporation"" but whose screen mode type is not Text. ### Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, Type VARCHAR) ###Answer: SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE t2.Company_name = ""Nokia Corporation"" AND T1.Type <> ""Text""" "convert the question into postgresql query using the context values ### Question: List the phone hardware model and company name for the phones whose screen usage in kb is between 10 and 15. ### Context: CREATE TABLE phone (Hardware_Model_name VARCHAR, Company_name VARCHAR, screen_mode VARCHAR); CREATE TABLE screen_mode (Graphics_mode VARCHAR, used_kb INTEGER) ###Answer: SELECT DISTINCT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.used_kb BETWEEN 10 AND 15" "convert the question into postgresql query using the context values ### Question: Find the number of phones for each accreditation type. ### Context: CREATE TABLE phone (Accreditation_type VARCHAR) ###Answer: SELECT Accreditation_type, COUNT(*) FROM phone GROUP BY Accreditation_type" "convert the question into postgresql query using the context values ### Question: Find the accreditation level that more than 3 phones use. ### Context: CREATE TABLE phone (Accreditation_level VARCHAR) ###Answer: SELECT Accreditation_level FROM phone GROUP BY Accreditation_level HAVING COUNT(*) > 3" "convert the question into postgresql query using the context values ### Question: Find the details for all chip models. ### Context: CREATE TABLE chip_model (Id VARCHAR) ###Answer: SELECT * FROM chip_model" "convert the question into postgresql query using the context values ### Question: How many models do not have the wifi function? ### Context: CREATE TABLE chip_model (wifi VARCHAR) ###Answer: SELECT COUNT(*) FROM chip_model WHERE wifi = 'No'" "convert the question into postgresql query using the context values ### Question: List all the model names sorted by their launch year. ### Context: CREATE TABLE chip_model (model_name VARCHAR, launch_year VARCHAR) ###Answer: SELECT model_name FROM chip_model ORDER BY launch_year" "convert the question into postgresql query using the context values ### Question: Find the average ram mib size of the chip models that are never used by any phone. ### Context: CREATE TABLE chip_model (RAM_MiB INTEGER, model_name VARCHAR, chip_model VARCHAR); CREATE TABLE phone (RAM_MiB INTEGER, model_name VARCHAR, chip_model VARCHAR) ###Answer: SELECT AVG(RAM_MiB) FROM chip_model WHERE NOT model_name IN (SELECT chip_model FROM phone)" "convert the question into postgresql query using the context values ### Question: Find the names of the chip models that are not used by any phone with full accreditation type. ### Context: CREATE TABLE chip_model (model_name VARCHAR, chip_model VARCHAR, Accreditation_type VARCHAR); CREATE TABLE phone (model_name VARCHAR, chip_model VARCHAR, Accreditation_type VARCHAR) ###Answer: SELECT model_name FROM chip_model EXCEPT SELECT chip_model FROM phone WHERE Accreditation_type = 'Full'" "convert the question into postgresql query using the context values ### Question: Find the pixels of the screen modes that are used by both phones with full accreditation types and phones with Provisional accreditation types. ### Context: CREATE TABLE phone (screen_mode VARCHAR, Accreditation_type VARCHAR); CREATE TABLE screen_mode (pixels VARCHAR, Graphics_mode VARCHAR) ###Answer: SELECT t1.pixels FROM screen_mode AS t1 JOIN phone AS t2 ON t1.Graphics_mode = t2.screen_mode WHERE t2.Accreditation_type = 'Provisional' INTERSECT SELECT t1.pixels FROM screen_mode AS t1 JOIN phone AS t2 ON t1.Graphics_mode = t2.screen_mode WHERE t2.Accreditation_type = 'Full'" "convert the question into postgresql query using the context values ### Question: How many countries are there in total? ### Context: CREATE TABLE country (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM country" "convert the question into postgresql query using the context values ### Question: Show the country name and capital of all countries. ### Context: CREATE TABLE country (Country_name VARCHAR, Capital VARCHAR) ###Answer: SELECT Country_name, Capital FROM country" "convert the question into postgresql query using the context values ### Question: Show all official native languages that contain the word ""English"". ### Context: CREATE TABLE country (Official_native_language VARCHAR) ###Answer: SELECT Official_native_language FROM country WHERE Official_native_language LIKE ""%English%""" "convert the question into postgresql query using the context values ### Question: Show all distinct positions of matches. ### Context: CREATE TABLE match_season (POSITION VARCHAR) ###Answer: SELECT DISTINCT POSITION FROM match_season" "convert the question into postgresql query using the context values ### Question: Show the players from college UCLA. ### Context: CREATE TABLE match_season (Player VARCHAR, College VARCHAR) ###Answer: SELECT Player FROM match_season WHERE College = ""UCLA""" "convert the question into postgresql query using the context values ### Question: Show the distinct position of players from college UCLA or Duke. ### Context: CREATE TABLE match_season (POSITION VARCHAR, College VARCHAR) ###Answer: SELECT DISTINCT POSITION FROM match_season WHERE College = ""UCLA"" OR College = ""Duke""" "convert the question into postgresql query using the context values ### Question: Show the draft pick numbers and draft classes of players whose positions are defenders. ### Context: CREATE TABLE match_season (Draft_Pick_Number VARCHAR, Draft_Class VARCHAR, POSITION VARCHAR) ###Answer: SELECT Draft_Pick_Number, Draft_Class FROM match_season WHERE POSITION = ""Defender""" "convert the question into postgresql query using the context values ### Question: How many distinct teams are involved in match seasons? ### Context: CREATE TABLE match_season (Team VARCHAR) ###Answer: SELECT COUNT(DISTINCT Team) FROM match_season" "convert the question into postgresql query using the context values ### Question: Show the players and the years played. ### Context: CREATE TABLE player (Player VARCHAR, Years_Played VARCHAR) ###Answer: SELECT Player, Years_Played FROM player" "convert the question into postgresql query using the context values ### Question: Show all team names. ### Context: CREATE TABLE Team (Name VARCHAR) ###Answer: SELECT Name FROM Team" "convert the question into postgresql query using the context values ### Question: Show the season, the player, and the name of the country that player belongs to. ### Context: CREATE TABLE match_season (Season VARCHAR, Player VARCHAR, Country VARCHAR); CREATE TABLE country (Country_name VARCHAR, Country_id VARCHAR) ###Answer: SELECT T2.Season, T2.Player, T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country" "convert the question into postgresql query using the context values ### Question: Which players are from Indonesia? ### Context: CREATE TABLE country (Country_id VARCHAR, Country_name VARCHAR); CREATE TABLE match_season (Player VARCHAR, Country VARCHAR) ###Answer: SELECT T2.Player FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Country_name = ""Indonesia""" "convert the question into postgresql query using the context values ### Question: What are the distinct positions of the players from a country whose capital is Dublin? ### Context: CREATE TABLE country (Country_id VARCHAR, Capital VARCHAR); CREATE TABLE match_season (Position VARCHAR, Country VARCHAR) ###Answer: SELECT DISTINCT T2.Position FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Capital = ""Dublin""" "convert the question into postgresql query using the context values ### Question: What are the official languages of the countries of players from Maryland or Duke college? ### Context: CREATE TABLE country (Official_native_language VARCHAR, Country_id VARCHAR); CREATE TABLE match_season (Country VARCHAR, College VARCHAR) ###Answer: SELECT T1.Official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = ""Maryland"" OR T2.College = ""Duke""" "convert the question into postgresql query using the context values ### Question: How many distinct official languages are there among countries of players whose positions are defenders. ### Context: CREATE TABLE country (Official_native_language VARCHAR, Country_id VARCHAR); CREATE TABLE match_season (Country VARCHAR, Position VARCHAR) ###Answer: SELECT COUNT(DISTINCT T1.Official_native_language) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = ""Defender""" "convert the question into postgresql query using the context values ### Question: Show the season, the player, and the name of the team that players belong to. ### Context: CREATE TABLE team (Name VARCHAR, Team_id VARCHAR); CREATE TABLE match_season (Season VARCHAR, Player VARCHAR, Team VARCHAR) ###Answer: SELECT T1.Season, T1.Player, T2.Name FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id" "convert the question into postgresql query using the context values ### Question: Show the positions of the players from the team with name ""Ryley Goldner"". ### Context: CREATE TABLE match_season (Position VARCHAR, Team VARCHAR); CREATE TABLE team (Team_id VARCHAR, Name VARCHAR) ###Answer: SELECT T1.Position FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = ""Ryley Goldner""" "convert the question into postgresql query using the context values ### Question: How many distinct colleges are associated with players from the team with name ""Columbus Crew"". ### Context: CREATE TABLE match_season (College VARCHAR, Team VARCHAR); CREATE TABLE team (Team_id VARCHAR, Name VARCHAR) ###Answer: SELECT COUNT(DISTINCT T1.College) FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = ""Columbus Crew""" "convert the question into postgresql query using the context values ### Question: Show the players and years played for players from team ""Columbus Crew"". ### Context: CREATE TABLE player (Player VARCHAR, Years_Played VARCHAR, Team VARCHAR); CREATE TABLE team (Team_id VARCHAR, Name VARCHAR) ###Answer: SELECT T1.Player, T1.Years_Played FROM player AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = ""Columbus Crew""" "convert the question into postgresql query using the context values ### Question: Show the position of players and the corresponding number of players. ### Context: CREATE TABLE match_season (POSITION VARCHAR) ###Answer: SELECT POSITION, COUNT(*) FROM match_season GROUP BY POSITION" "convert the question into postgresql query using the context values ### Question: Show the country names and the corresponding number of players. ### Context: CREATE TABLE match_season (Country VARCHAR); CREATE TABLE country (Country_name VARCHAR, Country_id VARCHAR) ###Answer: SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name" "convert the question into postgresql query using the context values ### Question: Return all players sorted by college in ascending alphabetical order. ### Context: CREATE TABLE match_season (player VARCHAR, College VARCHAR) ###Answer: SELECT player FROM match_season ORDER BY College" "convert the question into postgresql query using the context values ### Question: Show the most common position of players in match seasons. ### Context: CREATE TABLE match_season (POSITION VARCHAR) ###Answer: SELECT POSITION FROM match_season GROUP BY POSITION ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the top 3 most common colleges of players in match seasons. ### Context: CREATE TABLE match_season (College VARCHAR) ###Answer: SELECT College FROM match_season GROUP BY College ORDER BY COUNT(*) DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Show the name of colleges that have at least two players. ### Context: CREATE TABLE match_season (College VARCHAR) ###Answer: SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the name of colleges that have at least two players in descending alphabetical order. ### Context: CREATE TABLE match_season (College VARCHAR) ###Answer: SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2 ORDER BY College DESC" "convert the question into postgresql query using the context values ### Question: What are the names of teams that do no have match season record? ### Context: CREATE TABLE match_season (Name VARCHAR, Team_id VARCHAR, Team VARCHAR); CREATE TABLE team (Name VARCHAR, Team_id VARCHAR, Team VARCHAR) ###Answer: SELECT Name FROM team WHERE NOT Team_id IN (SELECT Team FROM match_season)" "convert the question into postgresql query using the context values ### Question: What are the names of countries that have both players with position forward and players with position defender? ### Context: CREATE TABLE country (Country_name VARCHAR, Country_id VARCHAR); CREATE TABLE match_season (Country VARCHAR, Position VARCHAR) ###Answer: SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = ""Forward"" INTERSECT SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = ""Defender""" "convert the question into postgresql query using the context values ### Question: Which college have both players with position midfielder and players with position defender? ### Context: CREATE TABLE match_season (College VARCHAR, POSITION VARCHAR) ###Answer: SELECT College FROM match_season WHERE POSITION = ""Midfielder"" INTERSECT SELECT College FROM match_season WHERE POSITION = ""Defender""" "convert the question into postgresql query using the context values ### Question: How many climbers are there? ### Context: CREATE TABLE climber (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM climber" "convert the question into postgresql query using the context values ### Question: List the names of climbers in descending order of points. ### Context: CREATE TABLE climber (Name VARCHAR, Points VARCHAR) ###Answer: SELECT Name FROM climber ORDER BY Points DESC" "convert the question into postgresql query using the context values ### Question: List the names of climbers whose country is not Switzerland. ### Context: CREATE TABLE climber (Name VARCHAR, Country VARCHAR) ###Answer: SELECT Name FROM climber WHERE Country <> ""Switzerland""" "convert the question into postgresql query using the context values ### Question: What is the maximum point for climbers whose country is United Kingdom? ### Context: CREATE TABLE climber (Points INTEGER, Country VARCHAR) ###Answer: SELECT MAX(Points) FROM climber WHERE Country = ""United Kingdom""" "convert the question into postgresql query using the context values ### Question: How many distinct countries are the climbers from? ### Context: CREATE TABLE climber (Country VARCHAR) ###Answer: SELECT COUNT(DISTINCT Country) FROM climber" "convert the question into postgresql query using the context values ### Question: What are the names of mountains in ascending alphabetical order? ### Context: CREATE TABLE mountain (Name VARCHAR) ###Answer: SELECT Name FROM mountain ORDER BY Name" "convert the question into postgresql query using the context values ### Question: What are the countries of mountains with height bigger than 5000? ### Context: CREATE TABLE mountain (Country VARCHAR, Height INTEGER) ###Answer: SELECT Country FROM mountain WHERE Height > 5000" "convert the question into postgresql query using the context values ### Question: What is the name of the highest mountain? ### Context: CREATE TABLE mountain (Name VARCHAR, Height VARCHAR) ###Answer: SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the distinct ranges of the mountains with the top 3 prominence. ### Context: CREATE TABLE mountain (Range VARCHAR, Prominence VARCHAR) ###Answer: SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Show names of climbers and the names of mountains they climb. ### Context: CREATE TABLE mountain (Name VARCHAR, Mountain_ID VARCHAR); CREATE TABLE climber (Name VARCHAR, Mountain_ID VARCHAR) ###Answer: SELECT T1.Name, T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID" "convert the question into postgresql query using the context values ### Question: Show the names of climbers and the heights of mountains they climb. ### Context: CREATE TABLE mountain (Height VARCHAR, Mountain_ID VARCHAR); CREATE TABLE climber (Name VARCHAR, Mountain_ID VARCHAR) ###Answer: SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID" "convert the question into postgresql query using the context values ### Question: Show the height of the mountain climbed by the climber with the maximum points. ### Context: CREATE TABLE climber (Mountain_ID VARCHAR, Points VARCHAR); CREATE TABLE mountain (Height VARCHAR, Mountain_ID VARCHAR) ###Answer: SELECT T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID ORDER BY T1.Points DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the distinct names of mountains climbed by climbers from country ""West Germany"". ### Context: CREATE TABLE mountain (Name VARCHAR, Mountain_ID VARCHAR); CREATE TABLE climber (Mountain_ID VARCHAR, Country VARCHAR) ###Answer: SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = ""West Germany""" "convert the question into postgresql query using the context values ### Question: Show the times used by climbers to climb mountains in Country Uganda. ### Context: CREATE TABLE mountain (Mountain_ID VARCHAR, Country VARCHAR); CREATE TABLE climber (Time VARCHAR, Mountain_ID VARCHAR) ###Answer: SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = ""Uganda""" "convert the question into postgresql query using the context values ### Question: Please show the countries and the number of climbers from each country. ### Context: CREATE TABLE climber (Country VARCHAR) ###Answer: SELECT Country, COUNT(*) FROM climber GROUP BY Country" "convert the question into postgresql query using the context values ### Question: List the countries that have more than one mountain. ### Context: CREATE TABLE mountain (Country VARCHAR) ###Answer: SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: List the names of mountains that do not have any climber. ### Context: CREATE TABLE mountain (Name VARCHAR, Mountain_ID VARCHAR); CREATE TABLE climber (Name VARCHAR, Mountain_ID VARCHAR) ###Answer: SELECT Name FROM mountain WHERE NOT Mountain_ID IN (SELECT Mountain_ID FROM climber)" "convert the question into postgresql query using the context values ### Question: Show the countries that have mountains with height more than 5600 stories and mountains with height less than 5200. ### Context: CREATE TABLE mountain (Country VARCHAR, Height INTEGER) ###Answer: SELECT Country FROM mountain WHERE Height > 5600 INTERSECT SELECT Country FROM mountain WHERE Height < 5200" "convert the question into postgresql query using the context values ### Question: Show the range that has the most number of mountains. ### Context: CREATE TABLE mountain (Range VARCHAR) ###Answer: SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the names of mountains with height more than 5000 or prominence more than 1000. ### Context: CREATE TABLE mountain (Name VARCHAR, Height VARCHAR, Prominence VARCHAR) ###Answer: SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000" "convert the question into postgresql query using the context values ### Question: How many body builders are there? ### Context: CREATE TABLE body_builder (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM body_builder" "convert the question into postgresql query using the context values ### Question: List the total scores of body builders in ascending order. ### Context: CREATE TABLE body_builder (Total VARCHAR) ###Answer: SELECT Total FROM body_builder ORDER BY Total" "convert the question into postgresql query using the context values ### Question: List the snatch score and clean jerk score of body builders in ascending order of snatch score. ### Context: CREATE TABLE body_builder (Snatch VARCHAR, Clean_Jerk VARCHAR) ###Answer: SELECT Snatch, Clean_Jerk FROM body_builder ORDER BY Snatch" "convert the question into postgresql query using the context values ### Question: What is the average snatch score of body builders? ### Context: CREATE TABLE body_builder (Snatch INTEGER) ###Answer: SELECT AVG(Snatch) FROM body_builder" "convert the question into postgresql query using the context values ### Question: What are the clean and jerk score of the body builder with the highest total score? ### Context: CREATE TABLE body_builder (Clean_Jerk VARCHAR, Total VARCHAR) ###Answer: SELECT Clean_Jerk FROM body_builder ORDER BY Total DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the birthdays of people in ascending order of height? ### Context: CREATE TABLE People (Birth_Date VARCHAR, Height VARCHAR) ###Answer: SELECT Birth_Date FROM People ORDER BY Height" "convert the question into postgresql query using the context values ### Question: What are the names of body builders? ### Context: CREATE TABLE body_builder (People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID" "convert the question into postgresql query using the context values ### Question: What are the names of body builders whose total score is higher than 300? ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE body_builder (People_ID VARCHAR, Total INTEGER) ###Answer: SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total > 300" "convert the question into postgresql query using the context values ### Question: What is the name of the body builder with the greatest body weight? ### Context: CREATE TABLE body_builder (People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR, Weight VARCHAR) ###Answer: SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the birth date and birth place of the body builder with the highest total points? ### Context: CREATE TABLE body_builder (People_ID VARCHAR, Total VARCHAR); CREATE TABLE people (Birth_Date VARCHAR, Birth_Place VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Birth_Date, T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the heights of body builders with total score smaller than 315? ### Context: CREATE TABLE people (Height VARCHAR, People_ID VARCHAR); CREATE TABLE body_builder (People_ID VARCHAR, Total INTEGER) ###Answer: SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315" "convert the question into postgresql query using the context values ### Question: What is the average total score of body builders with height bigger than 200? ### Context: CREATE TABLE people (People_ID VARCHAR, Height INTEGER); CREATE TABLE body_builder (Total INTEGER, People_ID VARCHAR) ###Answer: SELECT AVG(T1.Total) FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 200" "convert the question into postgresql query using the context values ### Question: What are the names of body builders in descending order of total scores? ### Context: CREATE TABLE body_builder (People_ID VARCHAR, Total VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC" "convert the question into postgresql query using the context values ### Question: List each birth place along with the number of people from there. ### Context: CREATE TABLE people (Birth_Place VARCHAR) ###Answer: SELECT Birth_Place, COUNT(*) FROM people GROUP BY Birth_Place" "convert the question into postgresql query using the context values ### Question: What is the most common birth place of people? ### Context: CREATE TABLE people (Birth_Place VARCHAR) ###Answer: SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the birth places that are shared by at least two people? ### Context: CREATE TABLE people (Birth_Place VARCHAR) ###Answer: SELECT Birth_Place FROM people GROUP BY Birth_Place HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: List the height and weight of people in descending order of height. ### Context: CREATE TABLE people (Height VARCHAR, Weight VARCHAR) ###Answer: SELECT Height, Weight FROM people ORDER BY Height DESC" "convert the question into postgresql query using the context values ### Question: Show all information about each body builder. ### Context: CREATE TABLE body_builder (Id VARCHAR) ###Answer: SELECT * FROM body_builder" "convert the question into postgresql query using the context values ### Question: List the names and origins of people who are not body builders. ### Context: CREATE TABLE people (Name VARCHAR, birth_place VARCHAR, people_id VARCHAR); CREATE TABLE body_builder (people_id VARCHAR); CREATE TABLE people (Name VARCHAR, birth_place VARCHAR) ###Answer: SELECT Name, birth_place FROM people EXCEPT SELECT T1.Name, T1.birth_place FROM people AS T1 JOIN body_builder AS T2 ON T1.people_id = T2.people_id" "convert the question into postgresql query using the context values ### Question: How many distinct birth places are there? ### Context: CREATE TABLE people (Birth_Place VARCHAR) ###Answer: SELECT COUNT(DISTINCT Birth_Place) FROM people" "convert the question into postgresql query using the context values ### Question: How many persons are not body builders? ### Context: CREATE TABLE body_builder (people_id VARCHAR, People_ID VARCHAR); CREATE TABLE people (people_id VARCHAR, People_ID VARCHAR) ###Answer: SELECT COUNT(*) FROM people WHERE NOT people_id IN (SELECT People_ID FROM body_builder)" "convert the question into postgresql query using the context values ### Question: List the weight of the body builders who have snatch score higher than 140 or have the height greater than 200. ### Context: CREATE TABLE people (weight VARCHAR, people_id VARCHAR, height VARCHAR); CREATE TABLE body_builder (people_id VARCHAR, snatch VARCHAR) ###Answer: SELECT T2.weight FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T1.snatch > 140 OR T2.height > 200" "convert the question into postgresql query using the context values ### Question: What are the total scores of the body builders whose birthday contains the string ""January"" ? ### Context: CREATE TABLE people (people_id VARCHAR, Birth_Date VARCHAR); CREATE TABLE body_builder (total VARCHAR, people_id VARCHAR) ###Answer: SELECT T1.total FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T2.Birth_Date LIKE ""%January%""" "convert the question into postgresql query using the context values ### Question: What is the minimum snatch score? ### Context: CREATE TABLE body_builder (snatch INTEGER) ###Answer: SELECT MIN(snatch) FROM body_builder" "convert the question into postgresql query using the context values ### Question: How many elections are there? ### Context: CREATE TABLE election (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM election" "convert the question into postgresql query using the context values ### Question: List the votes of elections in descending order. ### Context: CREATE TABLE election (Votes VARCHAR) ###Answer: SELECT Votes FROM election ORDER BY Votes DESC" "convert the question into postgresql query using the context values ### Question: List the dates and vote percents of elections. ### Context: CREATE TABLE election (Date VARCHAR, Vote_Percent VARCHAR) ###Answer: SELECT Date, Vote_Percent FROM election" "convert the question into postgresql query using the context values ### Question: What are the minimum and maximum vote percents of elections? ### Context: CREATE TABLE election (Vote_Percent INTEGER) ###Answer: SELECT MIN(Vote_Percent), MAX(Vote_Percent) FROM election" "convert the question into postgresql query using the context values ### Question: What are the names and parties of representatives? ### Context: CREATE TABLE representative (Name VARCHAR, Party VARCHAR) ###Answer: SELECT Name, Party FROM representative" "convert the question into postgresql query using the context values ### Question: What are the names of representatives whose party is not ""Republican""? ### Context: CREATE TABLE Representative (Name VARCHAR, Party VARCHAR) ###Answer: SELECT Name FROM Representative WHERE Party <> ""Republican""" "convert the question into postgresql query using the context values ### Question: What are the life spans of representatives from New York state or Indiana state? ### Context: CREATE TABLE representative (Lifespan VARCHAR, State VARCHAR) ###Answer: SELECT Lifespan FROM representative WHERE State = ""New York"" OR State = ""Indiana""" "convert the question into postgresql query using the context values ### Question: What are the names of representatives and the dates of elections they participated in. ### Context: CREATE TABLE election (Date VARCHAR, Representative_ID VARCHAR); CREATE TABLE representative (Name VARCHAR, Representative_ID VARCHAR) ###Answer: SELECT T2.Name, T1.Date FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID" "convert the question into postgresql query using the context values ### Question: What are the names of representatives with more than 10000 votes in election? ### Context: CREATE TABLE representative (Name VARCHAR, Representative_ID VARCHAR); CREATE TABLE election (Representative_ID VARCHAR) ###Answer: SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE Votes > 10000" "convert the question into postgresql query using the context values ### Question: What are the names of representatives in descending order of votes? ### Context: CREATE TABLE representative (Name VARCHAR, Representative_ID VARCHAR); CREATE TABLE election (Representative_ID VARCHAR) ###Answer: SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes DESC" "convert the question into postgresql query using the context values ### Question: What is the party of the representative that has the smallest number of votes. ### Context: CREATE TABLE representative (Party VARCHAR, Representative_ID VARCHAR); CREATE TABLE election (Representative_ID VARCHAR) ###Answer: SELECT T2.Party FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the lifespans of representatives in descending order of vote percent? ### Context: CREATE TABLE election (Representative_ID VARCHAR); CREATE TABLE representative (Lifespan VARCHAR, Representative_ID VARCHAR) ###Answer: SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY Vote_Percent DESC" "convert the question into postgresql query using the context values ### Question: What is the average number of votes of representatives from party ""Republican""? ### Context: CREATE TABLE election (Votes INTEGER, Representative_ID VARCHAR); CREATE TABLE representative (Representative_ID VARCHAR, Party VARCHAR) ###Answer: SELECT AVG(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = ""Republican""" "convert the question into postgresql query using the context values ### Question: What are the different parties of representative? Show the party name and the number of representatives in each party. ### Context: CREATE TABLE representative (Party VARCHAR) ###Answer: SELECT Party, COUNT(*) FROM representative GROUP BY Party" "convert the question into postgresql query using the context values ### Question: What is the party that has the largest number of representatives? ### Context: CREATE TABLE representative (Party VARCHAR) ###Answer: SELECT Party, COUNT(*) FROM representative GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What parties have at least three representatives? ### Context: CREATE TABLE representative (Party VARCHAR) ###Answer: SELECT Party FROM representative GROUP BY Party HAVING COUNT(*) >= 3" "convert the question into postgresql query using the context values ### Question: What states have at least two representatives? ### Context: CREATE TABLE representative (State VARCHAR) ###Answer: SELECT State FROM representative GROUP BY State HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: List the names of representatives that have not participated in elections listed here. ### Context: CREATE TABLE election (Name VARCHAR, Representative_ID VARCHAR); CREATE TABLE representative (Name VARCHAR, Representative_ID VARCHAR) ###Answer: SELECT Name FROM representative WHERE NOT Representative_ID IN (SELECT Representative_ID FROM election)" "convert the question into postgresql query using the context values ### Question: Show the parties that have both representatives in New York state and representatives in Pennsylvania state. ### Context: CREATE TABLE representative (Party VARCHAR, State VARCHAR) ###Answer: SELECT Party FROM representative WHERE State = ""New York"" INTERSECT SELECT Party FROM representative WHERE State = ""Pennsylvania""" "convert the question into postgresql query using the context values ### Question: How many distinct parties are there for representatives? ### Context: CREATE TABLE representative (Party VARCHAR) ###Answer: SELECT COUNT(DISTINCT Party) FROM representative" "convert the question into postgresql query using the context values ### Question: How many apartment bookings are there in total? ### Context: CREATE TABLE Apartment_Bookings (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Apartment_Bookings" "convert the question into postgresql query using the context values ### Question: Show the start dates and end dates of all the apartment bookings. ### Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, booking_end_date VARCHAR) ###Answer: SELECT booking_start_date, booking_end_date FROM Apartment_Bookings" "convert the question into postgresql query using the context values ### Question: Show all distinct building descriptions. ### Context: CREATE TABLE Apartment_Buildings (building_description VARCHAR) ###Answer: SELECT DISTINCT building_description FROM Apartment_Buildings" "convert the question into postgresql query using the context values ### Question: Show the short names of the buildings managed by ""Emma"". ### Context: CREATE TABLE Apartment_Buildings (building_short_name VARCHAR, building_manager VARCHAR) ###Answer: SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = ""Emma""" "convert the question into postgresql query using the context values ### Question: Show the addresses and phones of all the buildings managed by ""Brenden"". ### Context: CREATE TABLE Apartment_Buildings (building_address VARCHAR, building_phone VARCHAR, building_manager VARCHAR) ###Answer: SELECT building_address, building_phone FROM Apartment_Buildings WHERE building_manager = ""Brenden""" "convert the question into postgresql query using the context values ### Question: What are the building full names that contain the word ""court""? ### Context: CREATE TABLE Apartment_Buildings (building_full_name VARCHAR) ###Answer: SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE ""%court%""" "convert the question into postgresql query using the context values ### Question: What is the minimum and maximum number of bathrooms of all the apartments? ### Context: CREATE TABLE Apartments (bathroom_count INTEGER) ###Answer: SELECT MIN(bathroom_count), MAX(bathroom_count) FROM Apartments" "convert the question into postgresql query using the context values ### Question: What is the average number of bedrooms of all apartments? ### Context: CREATE TABLE Apartments (bedroom_count INTEGER) ###Answer: SELECT AVG(bedroom_count) FROM Apartments" "convert the question into postgresql query using the context values ### Question: Return the apartment number and the number of rooms for each apartment. ### Context: CREATE TABLE Apartments (apt_number VARCHAR, room_count VARCHAR) ###Answer: SELECT apt_number, room_count FROM Apartments" "convert the question into postgresql query using the context values ### Question: What is the average number of rooms of apartments with type code ""Studio""? ### Context: CREATE TABLE Apartments (room_count INTEGER, apt_type_code VARCHAR) ###Answer: SELECT AVG(room_count) FROM Apartments WHERE apt_type_code = ""Studio""" "convert the question into postgresql query using the context values ### Question: Return the apartment numbers of the apartments with type code ""Flat"". ### Context: CREATE TABLE Apartments (apt_number VARCHAR, apt_type_code VARCHAR) ###Answer: SELECT apt_number FROM Apartments WHERE apt_type_code = ""Flat""" "convert the question into postgresql query using the context values ### Question: Return the first names and last names of all guests ### Context: CREATE TABLE Guests (guest_first_name VARCHAR, guest_last_name VARCHAR) ###Answer: SELECT guest_first_name, guest_last_name FROM Guests" "convert the question into postgresql query using the context values ### Question: Return the date of birth for all the guests with gender code ""Male"". ### Context: CREATE TABLE Guests (date_of_birth VARCHAR, gender_code VARCHAR) ###Answer: SELECT date_of_birth FROM Guests WHERE gender_code = ""Male""" "convert the question into postgresql query using the context values ### Question: Show the apartment numbers, start dates, and end dates of all the apartment bookings. ### Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR) ###Answer: SELECT T2.apt_number, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id" "convert the question into postgresql query using the context values ### Question: What are the booking start and end dates of the apartments with type code ""Duplex""? ### Context: CREATE TABLE Apartments (apt_id VARCHAR, apt_type_code VARCHAR); CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, apt_id VARCHAR) ###Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = ""Duplex""" "convert the question into postgresql query using the context values ### Question: What are the booking start and end dates of the apartments with more than 2 bedrooms? ### Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR, bedroom_count INTEGER) ###Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2" "convert the question into postgresql query using the context values ### Question: What is the booking status code of the apartment with apartment number ""Suite 634""? ### Context: CREATE TABLE Apartments (apt_id VARCHAR, apt_number VARCHAR); CREATE TABLE Apartment_Bookings (booking_status_code VARCHAR, apt_id VARCHAR) ###Answer: SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = ""Suite 634""" "convert the question into postgresql query using the context values ### Question: Show the distinct apartment numbers of the apartments that have bookings with status code ""Confirmed"". ### Context: CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR); CREATE TABLE Apartment_Bookings (apt_id VARCHAR, booking_status_code VARCHAR) ###Answer: SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = ""Confirmed""" "convert the question into postgresql query using the context values ### Question: Show the average room count of the apartments that have booking status code ""Provisional"". ### Context: CREATE TABLE Apartment_Bookings (apt_id VARCHAR, booking_status_code VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR) ###Answer: SELECT AVG(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = ""Provisional""" "convert the question into postgresql query using the context values ### Question: Show the guest first names, start dates, and end dates of all the apartment bookings. ### Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, guest_id VARCHAR); CREATE TABLE Guests (guest_first_name VARCHAR, guest_id VARCHAR) ###Answer: SELECT T2.guest_first_name, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id" "convert the question into postgresql query using the context values ### Question: Show the start dates and end dates of all the apartment bookings made by guests with gender code ""Female"". ### Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, guest_id VARCHAR); CREATE TABLE Guests (guest_id VARCHAR, gender_code VARCHAR) ###Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = ""Female""" "convert the question into postgresql query using the context values ### Question: Show the first names and last names of all the guests that have apartment bookings with status code ""Confirmed"". ### Context: CREATE TABLE Apartment_Bookings (guest_id VARCHAR, booking_status_code VARCHAR); CREATE TABLE Guests (guest_first_name VARCHAR, guest_last_name VARCHAR, guest_id VARCHAR) ###Answer: SELECT T2.guest_first_name, T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = ""Confirmed""" "convert the question into postgresql query using the context values ### Question: Show the facility codes of apartments with more than 4 bedrooms. ### Context: CREATE TABLE Apartment_Facilities (facility_code VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR, bedroom_count INTEGER) ###Answer: SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4" "convert the question into postgresql query using the context values ### Question: Show the total number of rooms of all apartments with facility code ""Gym"". ### Context: CREATE TABLE Apartments (room_count INTEGER, apt_id VARCHAR); CREATE TABLE Apartment_Facilities (apt_id VARCHAR, facility_code VARCHAR) ###Answer: SELECT SUM(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = ""Gym""" "convert the question into postgresql query using the context values ### Question: Show the total number of rooms of the apartments in the building with short name ""Columbus Square"". ### Context: CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_short_name VARCHAR); CREATE TABLE Apartments (room_count INTEGER, building_id VARCHAR) ###Answer: SELECT SUM(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = ""Columbus Square""" "convert the question into postgresql query using the context values ### Question: Show the addresses of the buildings that have apartments with more than 2 bathrooms. ### Context: CREATE TABLE Apartment_Buildings (building_address VARCHAR, building_id VARCHAR); CREATE TABLE Apartments (building_id VARCHAR, bathroom_count INTEGER) ###Answer: SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2" "convert the question into postgresql query using the context values ### Question: Show the apartment type codes and apartment numbers in the buildings managed by ""Kyle"". ### Context: CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_manager VARCHAR); CREATE TABLE Apartments (apt_type_code VARCHAR, apt_number VARCHAR, building_id VARCHAR) ###Answer: SELECT T2.apt_type_code, T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = ""Kyle""" "convert the question into postgresql query using the context values ### Question: Show the booking status code and the corresponding number of bookings. ### Context: CREATE TABLE Apartment_Bookings (booking_status_code VARCHAR) ###Answer: SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code" "convert the question into postgresql query using the context values ### Question: Return all the apartment numbers sorted by the room count in ascending order. ### Context: CREATE TABLE Apartments (apt_number VARCHAR, room_count VARCHAR) ###Answer: SELECT apt_number FROM Apartments ORDER BY room_count" "convert the question into postgresql query using the context values ### Question: Return the apartment number with the largest number of bedrooms. ### Context: CREATE TABLE Apartments (apt_number VARCHAR, bedroom_count VARCHAR) ###Answer: SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order. ### Context: CREATE TABLE Apartments (apt_type_code VARCHAR) ###Answer: SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)" "convert the question into postgresql query using the context values ### Question: Show the top 3 apartment type codes sorted by the average number of rooms in descending order. ### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, room_count INTEGER) ###Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY AVG(room_count) DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms. ### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_count VARCHAR, bedroom_count VARCHAR, room_count INTEGER) ###Answer: SELECT apt_type_code, bathroom_count, bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY SUM(room_count) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the most common apartment type code. ### Context: CREATE TABLE Apartments (apt_type_code VARCHAR) ###Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the most common apartment type code among apartments with more than 1 bathroom. ### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_count INTEGER) ###Answer: SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show each apartment type code, and the maximum and minimum number of rooms for each type. ### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, room_count INTEGER) ###Answer: SELECT apt_type_code, MAX(room_count), MIN(room_count) FROM Apartments GROUP BY apt_type_code" "convert the question into postgresql query using the context values ### Question: Show each gender code and the corresponding count of guests sorted by the count in descending order. ### Context: CREATE TABLE Guests (gender_code VARCHAR) ###Answer: SELECT gender_code, COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC" "convert the question into postgresql query using the context values ### Question: How many apartments do not have any facility? ### Context: CREATE TABLE Apartment_Facilities (apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR) ###Answer: SELECT COUNT(*) FROM Apartments WHERE NOT apt_id IN (SELECT apt_id FROM Apartment_Facilities)" "convert the question into postgresql query using the context values ### Question: Show the apartment numbers of apartments with bookings that have status code both ""Provisional"" and ""Confirmed"" ### Context: CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR); CREATE TABLE Apartment_Bookings (apt_id VARCHAR, booking_status_code VARCHAR) ###Answer: SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = ""Confirmed"" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = ""Provisional""" "convert the question into postgresql query using the context values ### Question: Show the apartment numbers of apartments with unit status availability of both 0 and 1. ### Context: CREATE TABLE View_Unit_Status (apt_id VARCHAR, available_yn VARCHAR); CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR) ###Answer: SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1" "convert the question into postgresql query using the context values ### Question: How many games are held after season 2007? ### Context: CREATE TABLE game (season INTEGER) ###Answer: SELECT COUNT(*) FROM game WHERE season > 2007" "convert the question into postgresql query using the context values ### Question: List the dates of games by the home team name in descending order. ### Context: CREATE TABLE game (Date VARCHAR, home_team VARCHAR) ###Answer: SELECT Date FROM game ORDER BY home_team DESC" "convert the question into postgresql query using the context values ### Question: List the season, home team, away team of all the games. ### Context: CREATE TABLE game (season VARCHAR, home_team VARCHAR, away_team VARCHAR) ###Answer: SELECT season, home_team, away_team FROM game" "convert the question into postgresql query using the context values ### Question: What are the maximum, minimum and average home games each stadium held? ### Context: CREATE TABLE stadium (home_games INTEGER) ###Answer: SELECT MAX(home_games), MIN(home_games), AVG(home_games) FROM stadium" "convert the question into postgresql query using the context values ### Question: What is the average attendance of stadiums with capacity percentage higher than 100%? ### Context: CREATE TABLE stadium (average_attendance VARCHAR, capacity_percentage INTEGER) ###Answer: SELECT average_attendance FROM stadium WHERE capacity_percentage > 100" "convert the question into postgresql query using the context values ### Question: What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'? ### Context: CREATE TABLE injury_accident (player VARCHAR, number_of_matches VARCHAR, SOURCE VARCHAR, injury VARCHAR) ###Answer: SELECT player, number_of_matches, SOURCE FROM injury_accident WHERE injury <> 'Knee problem'" "convert the question into postgresql query using the context values ### Question: What is the season of the game which causes the player 'Walter Samuel' to get injured? ### Context: CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR); CREATE TABLE game (season VARCHAR, id VARCHAR) ###Answer: SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'" "convert the question into postgresql query using the context values ### Question: What are the ids, scores, and dates of the games which caused at least two injury accidents? ### Context: CREATE TABLE game (id VARCHAR, score VARCHAR, date VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR) ###Answer: SELECT T1.id, T1.score, T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What are the id and name of the stadium where the most injury accidents happened? ### Context: CREATE TABLE stadium (id VARCHAR, name VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR) ###Answer: SELECT T1.id, T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'? ### Context: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, injury VARCHAR); CREATE TABLE game (season VARCHAR, stadium_id VARCHAR, id VARCHAR) ###Answer: SELECT T1.season, T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'" "convert the question into postgresql query using the context values ### Question: How many different kinds of information sources are there for injury accidents? ### Context: CREATE TABLE injury_accident (SOURCE VARCHAR) ###Answer: SELECT COUNT(DISTINCT SOURCE) FROM injury_accident" "convert the question into postgresql query using the context values ### Question: How many games are free of injury accidents? ### Context: CREATE TABLE injury_accident (id VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, game_id VARCHAR) ###Answer: SELECT COUNT(*) FROM game WHERE NOT id IN (SELECT game_id FROM injury_accident)" "convert the question into postgresql query using the context values ### Question: How many distinct kinds of injuries happened after season 2010? ### Context: CREATE TABLE injury_accident (injury VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, season INTEGER) ###Answer: SELECT COUNT(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010" "convert the question into postgresql query using the context values ### Question: List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured. ### Context: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR) ###Answer: SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'" "convert the question into postgresql query using the context values ### Question: Show the name, average attendance, total attendance for stadiums where no accidents happened. ### Context: CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR, id VARCHAR); CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR) ###Answer: SELECT name, average_attendance, total_attendance FROM stadium EXCEPT SELECT T2.name, T2.average_attendance, T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id" "convert the question into postgresql query using the context values ### Question: Which stadium name contains the substring ""Bank""? ### Context: CREATE TABLE stadium (name VARCHAR) ###Answer: SELECT name FROM stadium WHERE name LIKE ""%Bank%""" "convert the question into postgresql query using the context values ### Question: How many games has each stadium held? ### Context: CREATE TABLE stadium (id VARCHAR); CREATE TABLE game (stadium_id VARCHAR) ###Answer: SELECT T1.id, COUNT(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id" "convert the question into postgresql query using the context values ### Question: For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season. ### Context: CREATE TABLE game (date VARCHAR, id VARCHAR, season VARCHAR); CREATE TABLE injury_accident (player VARCHAR, game_id VARCHAR) ###Answer: SELECT T1.date, T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC" "convert the question into postgresql query using the context values ### Question: List all country and league names. ### Context: CREATE TABLE League (name VARCHAR, country_id VARCHAR); CREATE TABLE Country (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name, T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id" "convert the question into postgresql query using the context values ### Question: How many leagues are there in England? ### Context: CREATE TABLE League (country_id VARCHAR); CREATE TABLE Country (id VARCHAR, name VARCHAR) ###Answer: SELECT COUNT(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = ""England""" "convert the question into postgresql query using the context values ### Question: What is the average weight of all players? ### Context: CREATE TABLE Player (weight INTEGER) ###Answer: SELECT AVG(weight) FROM Player" "convert the question into postgresql query using the context values ### Question: What is the maximum and minimum height of all players? ### Context: CREATE TABLE Player (weight INTEGER) ###Answer: SELECT MAX(weight), MIN(weight) FROM Player" "convert the question into postgresql query using the context values ### Question: List all player names who have an overall rating higher than the average. ### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating INTEGER) ###Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating > (SELECT AVG(overall_rating) FROM Player_Attributes)" "convert the question into postgresql query using the context values ### Question: What are the names of players who have the best dribbling? ### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, dribbling VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER) ###Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = (SELECT MAX(overall_rating) FROM Player_Attributes)" "convert the question into postgresql query using the context values ### Question: List the names of all players who have a crossing score higher than 90 and prefer their right foot. ### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, crossing VARCHAR, preferred_foot VARCHAR) ###Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing > 90 AND T2.preferred_foot = ""right""" "convert the question into postgresql query using the context values ### Question: List the names of all left-footed players who have overall rating between 85 and 90. ### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating VARCHAR, preferred_foot VARCHAR) ###Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = ""left"" AND T2.overall_rating >= 85 AND T2.overall_rating <= 90" "convert the question into postgresql query using the context values ### Question: What is the average rating for right-footed players and left-footed players? ### Context: CREATE TABLE Player_Attributes (preferred_foot VARCHAR, overall_rating INTEGER) ###Answer: SELECT preferred_foot, AVG(overall_rating) FROM Player_Attributes GROUP BY preferred_foot" "convert the question into postgresql query using the context values ### Question: Of all players with an overall rating greater than 80, how many are right-footed and left-footed? ### Context: CREATE TABLE Player_Attributes (preferred_foot VARCHAR, overall_rating INTEGER) ###Answer: SELECT preferred_foot, COUNT(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot" "convert the question into postgresql query using the context values ### Question: List all of the player ids with a height of at least 180cm and an overall rating higher than 85. ### Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER); CREATE TABLE Player (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER) ###Answer: SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85" "convert the question into postgresql query using the context values ### Question: List all of the ids for left-footed players with a height between 180cm and 190cm. ### Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR); CREATE TABLE Player (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR) ###Answer: SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = ""left""" "convert the question into postgresql query using the context values ### Question: Who are the top 3 players in terms of overall rating? ### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR) ###Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: List the names and birthdays of the top five players in terms of potential. ### Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR); CREATE TABLE Player (player_name VARCHAR, birthday VARCHAR, player_api_id VARCHAR) ###Answer: SELECT DISTINCT T1.player_name, T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: How many performances are there? ### Context: CREATE TABLE performance (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM performance" "convert the question into postgresql query using the context values ### Question: List the hosts of performances in ascending order of attendance. ### Context: CREATE TABLE performance (HOST VARCHAR, Attendance VARCHAR) ###Answer: SELECT HOST FROM performance ORDER BY Attendance" "convert the question into postgresql query using the context values ### Question: What are the dates and locations of performances? ### Context: CREATE TABLE performance (Date VARCHAR, LOCATION VARCHAR) ###Answer: SELECT Date, LOCATION FROM performance" "convert the question into postgresql query using the context values ### Question: Show the attendances of the performances at location ""TD Garden"" or ""Bell Centre"" ### Context: CREATE TABLE performance (Attendance VARCHAR, LOCATION VARCHAR) ###Answer: SELECT Attendance FROM performance WHERE LOCATION = ""TD Garden"" OR LOCATION = ""Bell Centre""" "convert the question into postgresql query using the context values ### Question: What is the average number of attendees for performances? ### Context: CREATE TABLE performance (Attendance INTEGER) ###Answer: SELECT AVG(Attendance) FROM performance" "convert the question into postgresql query using the context values ### Question: What is the date of the performance with the highest number of attendees? ### Context: CREATE TABLE performance (Date VARCHAR, Attendance VARCHAR) ###Answer: SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show different locations and the number of performances at each location. ### Context: CREATE TABLE performance (LOCATION VARCHAR) ###Answer: SELECT LOCATION, COUNT(*) FROM performance GROUP BY LOCATION" "convert the question into postgresql query using the context values ### Question: Show the most common location of performances. ### Context: CREATE TABLE performance (LOCATION VARCHAR) ###Answer: SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the locations that have at least two performances. ### Context: CREATE TABLE performance (LOCATION VARCHAR) ###Answer: SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the locations that have both performances with more than 2000 attendees and performances with less than 1000 attendees. ### Context: CREATE TABLE performance (LOCATION VARCHAR, Attendance INTEGER) ###Answer: SELECT LOCATION FROM performance WHERE Attendance > 2000 INTERSECT SELECT LOCATION FROM performance WHERE Attendance < 1000" "convert the question into postgresql query using the context values ### Question: Show the names of members and the location of the performances they attended. ### Context: CREATE TABLE performance (Location VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ###Answer: SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID" "convert the question into postgresql query using the context values ### Question: Show the names of members and the location of performances they attended in ascending alphabetical order of their names. ### Context: CREATE TABLE performance (Location VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ###Answer: SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T2.Name" "convert the question into postgresql query using the context values ### Question: Show the dates of performances with attending members whose roles are ""Violin"". ### Context: CREATE TABLE performance (Date VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Member_ID VARCHAR, Role VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ###Answer: SELECT T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = ""Violin""" "convert the question into postgresql query using the context values ### Question: Show the names of members and the dates of performances they attended in descending order of attendance of the performances. ### Context: CREATE TABLE performance (Date VARCHAR, Performance_ID VARCHAR, Attendance VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ###Answer: SELECT T2.Name, T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T3.Attendance DESC" "convert the question into postgresql query using the context values ### Question: List the names of members who did not attend any performance. ### Context: CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Name VARCHAR, Member_ID VARCHAR) ###Answer: SELECT Name FROM member WHERE NOT Member_ID IN (SELECT Member_ID FROM member_attendance)" "convert the question into postgresql query using the context values ### Question: Find the buildings which have rooms with capacity more than 50. ### Context: CREATE TABLE classroom (building VARCHAR, capacity INTEGER) ###Answer: SELECT DISTINCT building FROM classroom WHERE capacity > 50" "convert the question into postgresql query using the context values ### Question: Count the number of rooms that are not in the Lamberton building. ### Context: CREATE TABLE classroom (building VARCHAR) ###Answer: SELECT COUNT(*) FROM classroom WHERE building <> 'Lamberton'" "convert the question into postgresql query using the context values ### Question: What is the name and building of the departments whose budget is more than the average budget? ### Context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget INTEGER) ###Answer: SELECT dept_name, building FROM department WHERE budget > (SELECT AVG(budget) FROM department)" "convert the question into postgresql query using the context values ### Question: Find the room number of the rooms which can sit 50 to 100 students and their buildings. ### Context: CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity INTEGER) ###Answer: SELECT building, room_number FROM classroom WHERE capacity BETWEEN 50 AND 100" "convert the question into postgresql query using the context values ### Question: Find the name and building of the department with the highest budget. ### Context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget VARCHAR) ###Answer: SELECT dept_name, building FROM department ORDER BY budget DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the name of the student who has the highest total credits in the History department. ### Context: CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred VARCHAR) ###Answer: SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many rooms does the Lamberton building have? ### Context: CREATE TABLE classroom (building VARCHAR) ###Answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton'" "convert the question into postgresql query using the context values ### Question: How many students have advisors? ### Context: CREATE TABLE advisor (s_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT s_id) FROM advisor" "convert the question into postgresql query using the context values ### Question: How many departments offer courses? ### Context: CREATE TABLE course (dept_name VARCHAR) ###Answer: SELECT COUNT(DISTINCT dept_name) FROM course" "convert the question into postgresql query using the context values ### Question: How many different courses offered by Physics department? ### Context: CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR) ###Answer: SELECT COUNT(DISTINCT course_id) FROM course WHERE dept_name = 'Physics'" "convert the question into postgresql query using the context values ### Question: Find the title of courses that have two prerequisites? ### Context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR) ###Answer: SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) = 2" "convert the question into postgresql query using the context values ### Question: Find the title, credit, and department name of courses that have more than one prerequisites? ### Context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title VARCHAR, credits VARCHAR, dept_name VARCHAR, course_id VARCHAR) ###Answer: SELECT T1.title, T1.credits, T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: How many courses that do not have prerequisite? ### Context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (course_id VARCHAR) ###Answer: SELECT COUNT(*) FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)" "convert the question into postgresql query using the context values ### Question: Find the name of the courses that do not have any prerequisite? ### Context: CREATE TABLE prereq (title VARCHAR, course_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR) ###Answer: SELECT title FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)" "convert the question into postgresql query using the context values ### Question: How many different instructors have taught some course? ### Context: CREATE TABLE teaches (id VARCHAR) ###Answer: SELECT COUNT(DISTINCT id) FROM teaches" "convert the question into postgresql query using the context values ### Question: Find the total budgets of the Marketing or Finance department. ### Context: CREATE TABLE department (budget INTEGER, dept_name VARCHAR) ###Answer: SELECT SUM(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'" "convert the question into postgresql query using the context values ### Question: Find the department name of the instructor whose name contains 'Soisalon'. ### Context: CREATE TABLE instructor (dept_name VARCHAR, name VARCHAR) ###Answer: SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'" "convert the question into postgresql query using the context values ### Question: How many rooms whose capacity is less than 50 does the Lamberton building have? ### Context: CREATE TABLE classroom (building VARCHAR, capacity VARCHAR) ###Answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50" "convert the question into postgresql query using the context values ### Question: Find the name and budget of departments whose budgets are more than the average budget. ### Context: CREATE TABLE department (dept_name VARCHAR, budget INTEGER) ###Answer: SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department)" "convert the question into postgresql query using the context values ### Question: what is the name of the instructor who is in Statistics department and earns the lowest salary? ### Context: CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR, salary VARCHAR) ###Answer: SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the title of course that is provided by both Statistics and Psychology departments. ### Context: CREATE TABLE course (title VARCHAR, dept_name VARCHAR) ###Answer: SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'" "convert the question into postgresql query using the context values ### Question: Find the title of course that is provided by Statistics but not Psychology departments. ### Context: CREATE TABLE course (title VARCHAR, dept_name VARCHAR) ###Answer: SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'" "convert the question into postgresql query using the context values ### Question: Find the id of instructors who taught a class in Fall 2009 but not in Spring 2010. ### Context: CREATE TABLE teaches (id VARCHAR, semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT id FROM teaches WHERE semester = 'Spring' AND YEAR = 2010" "convert the question into postgresql query using the context values ### Question: Find the name of students who took any class in the years of 2009 and 2010. ### Context: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE takes (id VARCHAR) ###Answer: SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR YEAR = 2010" "convert the question into postgresql query using the context values ### Question: Find the names of the top 3 departments that provide the largest amount of courses? ### Context: CREATE TABLE course (dept_name VARCHAR) ###Answer: SELECT dept_name FROM course GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Find the name of the department that offers the highest total credits? ### Context: CREATE TABLE course (dept_name VARCHAR, credits INTEGER) ###Answer: SELECT dept_name FROM course GROUP BY dept_name ORDER BY SUM(credits) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the names of all courses ordered by their titles and credits. ### Context: CREATE TABLE course (title VARCHAR, credits VARCHAR) ###Answer: SELECT title FROM course ORDER BY title, credits" "convert the question into postgresql query using the context values ### Question: Which department has the lowest budget? ### Context: CREATE TABLE department (dept_name VARCHAR, budget VARCHAR) ###Answer: SELECT dept_name FROM department ORDER BY budget LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the names and buildings of all departments sorted by the budget from large to small. ### Context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget VARCHAR) ###Answer: SELECT dept_name, building FROM department ORDER BY budget DESC" "convert the question into postgresql query using the context values ### Question: Who is the instructor with the highest salary? ### Context: CREATE TABLE instructor (name VARCHAR, salary VARCHAR) ###Answer: SELECT name FROM instructor ORDER BY salary DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the information of all instructors ordered by their salary in ascending order. ### Context: CREATE TABLE instructor (salary VARCHAR) ###Answer: SELECT * FROM instructor ORDER BY salary" "convert the question into postgresql query using the context values ### Question: Find the name of the students and their department names sorted by their total credits in ascending order. ### Context: CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred VARCHAR) ###Answer: SELECT name, dept_name FROM student ORDER BY tot_cred" "convert the question into postgresql query using the context values ### Question: list in alphabetic order all course names and their instructors' names in year 2008. ### Context: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE teaches (course_id VARCHAR, id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.title, T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 ORDER BY T1.title" "convert the question into postgresql query using the context values ### Question: Find the name of instructors who are advising more than one student. ### Context: CREATE TABLE advisor (i_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Find the name of the students who have more than one advisor? ### Context: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE advisor (s_id VARCHAR) ###Answer: SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Find the number of rooms with more than 50 capacity for each building. ### Context: CREATE TABLE classroom (building VARCHAR, capacity INTEGER) ###Answer: SELECT COUNT(*), building FROM classroom WHERE capacity > 50 GROUP BY building" "convert the question into postgresql query using the context values ### Question: Find the maximum and average capacity among rooms in each building. ### Context: CREATE TABLE classroom (building VARCHAR, capacity INTEGER) ###Answer: SELECT MAX(capacity), AVG(capacity), building FROM classroom GROUP BY building" "convert the question into postgresql query using the context values ### Question: Find the title of the course that is offered by more than one department. ### Context: CREATE TABLE course (title VARCHAR) ###Answer: SELECT title FROM course GROUP BY title HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Find the total credits of courses provided by different department. ### Context: CREATE TABLE course (dept_name VARCHAR, credits INTEGER) ###Answer: SELECT SUM(credits), dept_name FROM course GROUP BY dept_name" "convert the question into postgresql query using the context values ### Question: Find the minimum salary for the departments whose average salary is above the average payment of all instructors. ### Context: CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) ###Answer: SELECT MIN(salary), dept_name FROM instructor GROUP BY dept_name HAVING AVG(salary) > (SELECT AVG(salary) FROM instructor)" "convert the question into postgresql query using the context values ### Question: Find the number of courses provided in each semester and year. ### Context: CREATE TABLE SECTION (semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT COUNT(*), semester, YEAR FROM SECTION GROUP BY semester, YEAR" "convert the question into postgresql query using the context values ### Question: Find the year which offers the largest number of courses. ### Context: CREATE TABLE SECTION (YEAR VARCHAR) ###Answer: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the year and semester when offers the largest number of courses. ### Context: CREATE TABLE SECTION (semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT semester, YEAR FROM SECTION GROUP BY semester, YEAR ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of department has the highest amount of students? ### Context: CREATE TABLE student (dept_name VARCHAR) ###Answer: SELECT dept_name FROM student GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the total number of students in each department. ### Context: CREATE TABLE student (dept_name VARCHAR) ###Answer: SELECT COUNT(*), dept_name FROM student GROUP BY dept_name" "convert the question into postgresql query using the context values ### Question: Find the semester and year which has the least number of student taking any class. ### Context: CREATE TABLE takes (semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT semester, YEAR FROM takes GROUP BY semester, YEAR ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the id of the instructor who advises of all students from History department? ### Context: CREATE TABLE advisor (s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) ###Answer: SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History'" "convert the question into postgresql query using the context values ### Question: Find the name and salary of the instructors who are advisors of any student from History department? ### Context: CREATE TABLE instructor (name VARCHAR, salary VARCHAR, id VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) ###Answer: SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'History'" "convert the question into postgresql query using the context values ### Question: Find the id of the courses that do not have any prerequisite? ### Context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (course_id VARCHAR) ###Answer: SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq" "convert the question into postgresql query using the context values ### Question: What is the title of the prerequisite class of International Finance course? ### Context: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) ###Answer: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'International Finance')" "convert the question into postgresql query using the context values ### Question: Find the title of course whose prerequisite is course Differential Geometry. ### Context: CREATE TABLE prereq (course_id VARCHAR, prereq_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) ###Answer: SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry')" "convert the question into postgresql query using the context values ### Question: Find the names of students who have taken any course in the fall semester of year 2003. ### Context: CREATE TABLE student (name VARCHAR, id VARCHAR, semester VARCHAR, YEAR VARCHAR); CREATE TABLE takes (name VARCHAR, id VARCHAR, semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003)" "convert the question into postgresql query using the context values ### Question: What is the title of the course that was offered at building Chandler during the fall semester in the year of 2010? ### Context: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE SECTION (course_id VARCHAR) ###Answer: SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE building = 'Chandler' AND semester = 'Fall' AND YEAR = 2010" "convert the question into postgresql query using the context values ### Question: Find the name of the instructors who taught C Programming course before. ### Context: CREATE TABLE teaches (id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming'" "convert the question into postgresql query using the context values ### Question: Find the name and salary of instructors who are advisors of the students from the Math department. ### Context: CREATE TABLE instructor (name VARCHAR, salary VARCHAR, id VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR) ###Answer: SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math'" "convert the question into postgresql query using the context values ### Question: Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit. ### Context: CREATE TABLE student (id VARCHAR, dept_name VARCHAR, tot_cred VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) ###Answer: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred" "convert the question into postgresql query using the context values ### Question: What is the course title of the prerequisite of course Mobile Computing? ### Context: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR) ###Answer: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'Mobile Computing')" "convert the question into postgresql query using the context values ### Question: Find the name of instructor who is the advisor of the student who has the highest number of total credits. ### Context: CREATE TABLE student (id VARCHAR, tot_cred VARCHAR); CREATE TABLE advisor (i_id VARCHAR, s_id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) ###Answer: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id ORDER BY T3.tot_cred DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of instructors who didn't teach any courses? ### Context: CREATE TABLE teaches (name VARCHAR, id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) ###Answer: SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches)" "convert the question into postgresql query using the context values ### Question: Find the id of instructors who didn't teach any courses? ### Context: CREATE TABLE teaches (id VARCHAR); CREATE TABLE instructor (id VARCHAR) ###Answer: SELECT id FROM instructor EXCEPT SELECT id FROM teaches" "convert the question into postgresql query using the context values ### Question: Find the names of instructors who didn't each any courses in any Spring semester. ### Context: CREATE TABLE teaches (name VARCHAR, id VARCHAR, semester VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR, semester VARCHAR) ###Answer: SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches WHERE semester = 'Spring')" "convert the question into postgresql query using the context values ### Question: Find the name of the department which has the highest average salary of professors. ### Context: CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) ###Answer: SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY AVG(salary) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the number and averaged salary of all instructors who are in the department with the highest budget. ### Context: CREATE TABLE department (dept_name VARCHAR, budget VARCHAR); CREATE TABLE instructor (salary INTEGER, dept_name VARCHAR) ###Answer: SELECT AVG(T1.salary), COUNT(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)? ### Context: CREATE TABLE SECTION (course_id VARCHAR, building VARCHAR, room_number VARCHAR); CREATE TABLE course (title VARCHAR, credits VARCHAR, course_id VARCHAR); CREATE TABLE classroom (capacity INTEGER, building VARCHAR, room_number VARCHAR); CREATE TABLE classroom (capacity INTEGER) ###Answer: SELECT T3.title, T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT MAX(capacity) FROM classroom)" "convert the question into postgresql query using the context values ### Question: Find the name of students who didn't take any course from Biology department. ### Context: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR); CREATE TABLE takes (id VARCHAR, course_id VARCHAR) ###Answer: SELECT name FROM student WHERE NOT id IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology')" "convert the question into postgresql query using the context values ### Question: Find the total number of students and total number of instructors for each department. ### Context: CREATE TABLE department (dept_name VARCHAR); CREATE TABLE student (id VARCHAR, dept_name VARCHAR); CREATE TABLE instructor (dept_name VARCHAR, id VARCHAR) ###Answer: SELECT COUNT(DISTINCT T2.id), COUNT(DISTINCT T3.id), T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name" "convert the question into postgresql query using the context values ### Question: Find the name of students who have taken the prerequisite course of the course with title International Finance. ### Context: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, title VARCHAR); CREATE TABLE prereq (prereq_id VARCHAR, course_id VARCHAR); CREATE TABLE takes (id VARCHAR, course_id VARCHAR) ###Answer: SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance')" "convert the question into postgresql query using the context values ### Question: Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department. ### Context: CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) ###Answer: SELECT name, salary FROM instructor WHERE salary < (SELECT AVG(salary) FROM instructor WHERE dept_name = 'Physics')" "convert the question into postgresql query using the context values ### Question: Find the name of students who took some course offered by Statistics department. ### Context: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE takes (course_id VARCHAR, id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR) ###Answer: SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics'" "convert the question into postgresql query using the context values ### Question: Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles. ### Context: CREATE TABLE SECTION (building VARCHAR, room_number VARCHAR, semester VARCHAR, year VARCHAR, course_id VARCHAR); CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR, title VARCHAR) ###Answer: SELECT T2.building, T2.room_number, T2.semester, T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title" "convert the question into postgresql query using the context values ### Question: Find the names of all instructors in computer science department ### Context: CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR) ###Answer: SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.'" "convert the question into postgresql query using the context values ### Question: Find the names of all instructors in Comp. Sci. department with salary > 80000. ### Context: CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR, salary VARCHAR) ###Answer: SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000" "convert the question into postgresql query using the context values ### Question: Find the names of all instructors who have taught some course and the course_id. ### Context: CREATE TABLE instructor (ID VARCHAR); CREATE TABLE teaches (ID VARCHAR) ###Answer: SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID" "convert the question into postgresql query using the context values ### Question: Find the names of all instructors in the Art department who have taught some course and the course_id. ### Context: CREATE TABLE instructor (ID VARCHAR, dept_name VARCHAR); CREATE TABLE teaches (ID VARCHAR) ###Answer: SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art'" "convert the question into postgresql query using the context values ### Question: Find the names of all instructors whose name includes the substring “dar”. ### Context: CREATE TABLE instructor (name VARCHAR) ###Answer: SELECT name FROM instructor WHERE name LIKE '%dar%'" "convert the question into postgresql query using the context values ### Question: List in alphabetic order the names of all distinct instructors. ### Context: CREATE TABLE instructor (name VARCHAR) ###Answer: SELECT DISTINCT name FROM instructor ORDER BY name" "convert the question into postgresql query using the context values ### Question: Find courses that ran in Fall 2009 or in Spring 2010. ### Context: CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010" "convert the question into postgresql query using the context values ### Question: Find courses that ran in Fall 2009 and in Spring 2010. ### Context: CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010" "convert the question into postgresql query using the context values ### Question: Find courses that ran in Fall 2009 but not in Spring 2010. ### Context: CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010" "convert the question into postgresql query using the context values ### Question: Find the salaries of all distinct instructors that are less than the largest salary. ### Context: CREATE TABLE instructor (salary INTEGER) ###Answer: SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT MAX(salary) FROM instructor)" "convert the question into postgresql query using the context values ### Question: Find the total number of instructors who teach a course in the Spring 2010 semester. ### Context: CREATE TABLE teaches (ID VARCHAR, semester VARCHAR, YEAR VARCHAR) ###Answer: SELECT COUNT(DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010" "convert the question into postgresql query using the context values ### Question: Find the names and average salaries of all departments whose average salary is greater than 42000. ### Context: CREATE TABLE instructor (dept_name VARCHAR, salary INTEGER) ###Answer: SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name HAVING AVG(salary) > 42000" "convert the question into postgresql query using the context values ### Question: Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department. ### Context: CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) ###Answer: SELECT name FROM instructor WHERE salary > (SELECT MIN(salary) FROM instructor WHERE dept_name = 'Biology')" "convert the question into postgresql query using the context values ### Question: Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department. ### Context: CREATE TABLE instructor (name VARCHAR, salary INTEGER, dept_name VARCHAR) ###Answer: SELECT name FROM instructor WHERE salary > (SELECT MAX(salary) FROM instructor WHERE dept_name = 'Biology')" "convert the question into postgresql query using the context values ### Question: How many debates are there? ### Context: CREATE TABLE debate (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM debate" "convert the question into postgresql query using the context values ### Question: List the venues of debates in ascending order of the number of audience. ### Context: CREATE TABLE debate (Venue VARCHAR, Num_of_Audience VARCHAR) ###Answer: SELECT Venue FROM debate ORDER BY Num_of_Audience" "convert the question into postgresql query using the context values ### Question: What are the date and venue of each debate? ### Context: CREATE TABLE debate (Date VARCHAR, Venue VARCHAR) ###Answer: SELECT Date, Venue FROM debate" "convert the question into postgresql query using the context values ### Question: List the dates of debates with number of audience bigger than 150 ### Context: CREATE TABLE debate (Date VARCHAR, Num_of_Audience INTEGER) ###Answer: SELECT Date FROM debate WHERE Num_of_Audience > 150" "convert the question into postgresql query using the context values ### Question: Show the names of people aged either 35 or 36. ### Context: CREATE TABLE people (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM people WHERE Age = 35 OR Age = 36" "convert the question into postgresql query using the context values ### Question: What is the party of the youngest people? ### Context: CREATE TABLE people (Party VARCHAR, Age VARCHAR) ###Answer: SELECT Party FROM people ORDER BY Age LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show different parties of people along with the number of people in each party. ### Context: CREATE TABLE people (Party VARCHAR) ###Answer: SELECT Party, COUNT(*) FROM people GROUP BY Party" "convert the question into postgresql query using the context values ### Question: Show the party that has the most people. ### Context: CREATE TABLE people (Party VARCHAR) ###Answer: SELECT Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the distinct venues of debates ### Context: CREATE TABLE debate (Venue VARCHAR) ###Answer: SELECT DISTINCT Venue FROM debate" "convert the question into postgresql query using the context values ### Question: Show the names of people, and dates and venues of debates they are on the affirmative side. ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Date VARCHAR, Venue VARCHAR, Debate_ID VARCHAR); CREATE TABLE debate_people (Debate_ID VARCHAR, Affirmative VARCHAR) ###Answer: SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID" "convert the question into postgresql query using the context values ### Question: Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name. ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Date VARCHAR, Venue VARCHAR, Debate_ID VARCHAR); CREATE TABLE debate_people (Debate_ID VARCHAR, Negative VARCHAR) ###Answer: SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID ORDER BY T3.Name" "convert the question into postgresql query using the context values ### Question: Show the names of people that are on affirmative side of debates with number of audience bigger than 200. ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate (Debate_ID VARCHAR, Num_of_Audience INTEGER); CREATE TABLE debate_people (Debate_ID VARCHAR, Affirmative VARCHAR) ###Answer: SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID WHERE T2.Num_of_Audience > 200" "convert the question into postgresql query using the context values ### Question: Show the names of people and the number of times they have been on the affirmative side of debates. ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE debate_people (Affirmative VARCHAR) ###Answer: SELECT T2.Name, COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name" "convert the question into postgresql query using the context values ### Question: Show the names of people who have been on the negative side of debates at least twice. ### Context: CREATE TABLE debate_people (Negative VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative = T2.People_ID GROUP BY T2.Name HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: List the names of people that have not been on the affirmative side of debates. ### Context: CREATE TABLE debate_people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR); CREATE TABLE people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR) ###Answer: SELECT Name FROM people WHERE NOT People_id IN (SELECT Affirmative FROM debate_people)" "convert the question into postgresql query using the context values ### Question: List the names of all the customers in alphabetical order. ### Context: CREATE TABLE customers (customer_details VARCHAR) ###Answer: SELECT customer_details FROM customers ORDER BY customer_details" "convert the question into postgresql query using the context values ### Question: Find all the policy type codes associated with the customer ""Dayana Robel"" ### Context: CREATE TABLE customers (customer_id VARCHAR, customer_details VARCHAR); CREATE TABLE policies (customer_id VARCHAR) ###Answer: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = ""Dayana Robel""" "convert the question into postgresql query using the context values ### Question: Which type of policy is most frequently used? Give me the policy type code. ### Context: CREATE TABLE policies (policy_type_code VARCHAR) ###Answer: SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find all the policy types that are used by more than 2 customers. ### Context: CREATE TABLE policies (policy_type_code VARCHAR) ###Answer: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: Find the total and average amount paid in claim headers. ### Context: CREATE TABLE claim_headers (amount_piad INTEGER) ###Answer: SELECT SUM(amount_piad), AVG(amount_piad) FROM claim_headers" "convert the question into postgresql query using the context values ### Question: Find the total amount claimed in the most recently created document. ### Context: CREATE TABLE claim_headers (amount_claimed INTEGER, claim_header_id VARCHAR); CREATE TABLE claims_documents (claim_id VARCHAR, created_date VARCHAR); CREATE TABLE claims_documents (created_date VARCHAR) ###Answer: SELECT SUM(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)" "convert the question into postgresql query using the context values ### Question: What is the name of the customer who has made the largest amount of claim in a single claim? ### Context: CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (amount_claimed INTEGER); CREATE TABLE policies (policy_id VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (policy_id VARCHAR, amount_claimed INTEGER) ###Answer: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT MAX(amount_claimed) FROM claim_headers)" "convert the question into postgresql query using the context values ### Question: What is the name of the customer who has made the minimum amount of payment in one claim? ### Context: CREATE TABLE claim_headers (amount_piad INTEGER); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (policy_id VARCHAR, customer_id VARCHAR); CREATE TABLE claim_headers (policy_id VARCHAR, amount_piad INTEGER) ###Answer: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT MIN(amount_piad) FROM claim_headers)" "convert the question into postgresql query using the context values ### Question: Find the names of customers who have no policies associated. ### Context: CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_details VARCHAR); CREATE TABLE policies (customer_id VARCHAR) ###Answer: SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id" "convert the question into postgresql query using the context values ### Question: How many claim processing stages are there in total? ### Context: CREATE TABLE claims_processing_stages (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM claims_processing_stages" "convert the question into postgresql query using the context values ### Question: What is the name of the claim processing stage that most of the claims are on? ### Context: CREATE TABLE claims_processing (claim_stage_id VARCHAR); CREATE TABLE claims_processing_stages (claim_status_name VARCHAR, claim_stage_id VARCHAR) ###Answer: SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names of customers whose name contains ""Diana"". ### Context: CREATE TABLE customers (customer_details VARCHAR) ###Answer: SELECT customer_details FROM customers WHERE customer_details LIKE ""%Diana%""" "convert the question into postgresql query using the context values ### Question: Find the names of the customers who have an deputy policy. ### Context: CREATE TABLE policies (customer_id VARCHAR, policy_type_code VARCHAR); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR) ###Answer: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = ""Deputy""" "convert the question into postgresql query using the context values ### Question: Find the names of customers who either have an deputy policy or uniformed policy. ### Context: CREATE TABLE policies (customer_id VARCHAR, policy_type_code VARCHAR); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR) ###Answer: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = ""Deputy"" OR t1.policy_type_code = ""Uniform""" "convert the question into postgresql query using the context values ### Question: Find the names of all the customers and staff members. ### Context: CREATE TABLE staff (customer_details VARCHAR, staff_details VARCHAR); CREATE TABLE customers (customer_details VARCHAR, staff_details VARCHAR) ###Answer: SELECT customer_details FROM customers UNION SELECT staff_details FROM staff" "convert the question into postgresql query using the context values ### Question: Find the number of records of each policy type and its type code. ### Context: CREATE TABLE policies (policy_type_code VARCHAR) ###Answer: SELECT policy_type_code, COUNT(*) FROM policies GROUP BY policy_type_code" "convert the question into postgresql query using the context values ### Question: Find the name of the customer that has been involved in the most policies. ### Context: CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (customer_id VARCHAR) ###Answer: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the description of the claim status ""Open""? ### Context: CREATE TABLE claims_processing_stages (claim_status_description VARCHAR, claim_status_name VARCHAR) ###Answer: SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = ""Open""" "convert the question into postgresql query using the context values ### Question: How many distinct claim outcome codes are there? ### Context: CREATE TABLE claims_processing (claim_outcome_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT claim_outcome_code) FROM claims_processing" "convert the question into postgresql query using the context values ### Question: Which customer is associated with the latest policy? ### Context: CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR); CREATE TABLE policies (start_date INTEGER); CREATE TABLE policies (customer_id VARCHAR, start_date INTEGER) ###Answer: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT MAX(start_date) FROM policies)" "convert the question into postgresql query using the context values ### Question: Show the id, the date of account opened, the account name, and other account detail for all accounts. ### Context: CREATE TABLE Accounts (account_id VARCHAR, date_account_opened VARCHAR, account_name VARCHAR, other_account_details VARCHAR) ###Answer: SELECT account_id, date_account_opened, account_name, other_account_details FROM Accounts" "convert the question into postgresql query using the context values ### Question: Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'. ### Context: CREATE TABLE Accounts (account_id VARCHAR, date_account_opened VARCHAR, account_name VARCHAR, other_account_details VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR) ###Answer: SELECT T1.account_id, T1.date_account_opened, T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'" "convert the question into postgresql query using the context values ### Question: Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling. ### Context: CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, customer_last_name VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, other_account_details VARCHAR, customer_id VARCHAR) ###Answer: SELECT T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = ""Meaghan"" AND T2.customer_last_name = ""Keeling""" "convert the question into postgresql query using the context values ### Question: Show the first name and last name for the customer with account name 900. ### Context: CREATE TABLE Accounts (customer_id VARCHAR, account_name VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = ""900""" "convert the question into postgresql query using the context values ### Question: Show the unique first names, last names, and phone numbers for all customers with any account. ### Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR) ###Answer: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id" "convert the question into postgresql query using the context values ### Question: Show customer ids who don't have an account. ### Context: CREATE TABLE Customers (customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) ###Answer: SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts" "convert the question into postgresql query using the context values ### Question: How many accounts does each customer have? List the number and customer id. ### Context: CREATE TABLE Accounts (customer_id VARCHAR) ###Answer: SELECT COUNT(*), customer_id FROM Accounts GROUP BY customer_id" "convert the question into postgresql query using the context values ### Question: What is the customer id, first and last name with most number of accounts. ### Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show id, first name and last name for all customers and the number of accounts. ### Context: CREATE TABLE Accounts (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id" "convert the question into postgresql query using the context values ### Question: Show first name and id for all customers with at least 2 accounts. ### Context: CREATE TABLE Customers (customer_first_name VARCHAR, customer_id VARCHAR); CREATE TABLE Accounts (customer_id VARCHAR) ###Answer: SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the number of customers for each gender. ### Context: CREATE TABLE Customers (gender VARCHAR) ###Answer: SELECT gender, COUNT(*) FROM Customers GROUP BY gender" "convert the question into postgresql query using the context values ### Question: How many transactions do we have? ### Context: CREATE TABLE Financial_transactions (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Financial_transactions" "convert the question into postgresql query using the context values ### Question: How many transaction does each account have? Show the number and account id. ### Context: CREATE TABLE Financial_transactions (account_id VARCHAR) ###Answer: SELECT COUNT(*), account_id FROM Financial_transactions" "convert the question into postgresql query using the context values ### Question: How many transaction does account with name 337 have? ### Context: CREATE TABLE Accounts (account_id VARCHAR, account_name VARCHAR); CREATE TABLE Financial_transactions (account_id VARCHAR) ###Answer: SELECT COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = ""337""" "convert the question into postgresql query using the context values ### Question: What is the average, minimum, maximum, and total transaction amount? ### Context: CREATE TABLE Financial_transactions (transaction_amount INTEGER) ###Answer: SELECT AVG(transaction_amount), MIN(transaction_amount), MAX(transaction_amount), SUM(transaction_amount) FROM Financial_transactions" "convert the question into postgresql query using the context values ### Question: Show ids for all transactions whose amounts are greater than the average. ### Context: CREATE TABLE Financial_transactions (transaction_id VARCHAR, transaction_amount INTEGER) ###Answer: SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT AVG(transaction_amount) FROM Financial_transactions)" "convert the question into postgresql query using the context values ### Question: Show the transaction types and the total amount of transactions. ### Context: CREATE TABLE Financial_transactions (transaction_type VARCHAR, transaction_amount INTEGER) ###Answer: SELECT transaction_type, SUM(transaction_amount) FROM Financial_transactions GROUP BY transaction_type" "convert the question into postgresql query using the context values ### Question: Show the account name, id and the number of transactions for each account. ### Context: CREATE TABLE Financial_transactions (account_id VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, account_id VARCHAR) ###Answer: SELECT T2.account_name, T1.account_id, COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id" "convert the question into postgresql query using the context values ### Question: Show the account id with most number of transactions. ### Context: CREATE TABLE Financial_transactions (account_id VARCHAR) ###Answer: SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the account id and name with at least 4 transactions. ### Context: CREATE TABLE Financial_transactions (account_id VARCHAR); CREATE TABLE Accounts (account_name VARCHAR, account_id VARCHAR) ###Answer: SELECT T1.account_id, T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING COUNT(*) >= 4" "convert the question into postgresql query using the context values ### Question: Show all product sizes. ### Context: CREATE TABLE Products (product_size VARCHAR) ###Answer: SELECT DISTINCT product_size FROM Products" "convert the question into postgresql query using the context values ### Question: Show all product colors. ### Context: CREATE TABLE Products (product_color VARCHAR) ###Answer: SELECT DISTINCT product_color FROM Products" "convert the question into postgresql query using the context values ### Question: Show the invoice number and the number of transactions for each invoice. ### Context: CREATE TABLE Financial_transactions (invoice_number VARCHAR) ###Answer: SELECT invoice_number, COUNT(*) FROM Financial_transactions GROUP BY invoice_number" "convert the question into postgresql query using the context values ### Question: What is the invoice number and invoice date for the invoice with most number of transactions? ### Context: CREATE TABLE Invoices (invoice_number VARCHAR, invoice_date VARCHAR); CREATE TABLE Financial_transactions (invoice_number VARCHAR) ###Answer: SELECT T2.invoice_number, T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many invoices do we have? ### Context: CREATE TABLE Invoices (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Invoices" "convert the question into postgresql query using the context values ### Question: Show invoice dates and order id and details for all invoices. ### Context: CREATE TABLE Invoices (invoice_date VARCHAR, order_id VARCHAR); CREATE TABLE Orders (order_details VARCHAR, order_id VARCHAR) ###Answer: SELECT T1.invoice_date, T1.order_id, T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id" "convert the question into postgresql query using the context values ### Question: Show the order ids and the number of invoices for each order. ### Context: CREATE TABLE Invoices (order_id VARCHAR) ###Answer: SELECT order_id, COUNT(*) FROM Invoices GROUP BY order_id" "convert the question into postgresql query using the context values ### Question: What is the order id and order details for the order more than two invoices. ### Context: CREATE TABLE Orders (order_id VARCHAR, order_details VARCHAR); CREATE TABLE Invoices (order_id VARCHAR) ###Answer: SELECT T2.order_id, T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: What is the customer last name, id and phone number with most number of orders? ### Context: CREATE TABLE Orders (customer_id VARCHAR); CREATE TABLE Customers (customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR) ###Answer: SELECT T2.customer_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show all product names without an order. ### Context: CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE Order_items (product_id VARCHAR); CREATE TABLE Products (product_name VARCHAR) ###Answer: SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id" "convert the question into postgresql query using the context values ### Question: Show all product names and the total quantity ordered for each product name. ### Context: CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE Order_items (product_quantity INTEGER, product_id VARCHAR) ###Answer: SELECT T2.product_name, SUM(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name" "convert the question into postgresql query using the context values ### Question: Show the order ids and the number of items in each order. ### Context: CREATE TABLE Order_items (order_id VARCHAR) ###Answer: SELECT order_id, COUNT(*) FROM Order_items GROUP BY order_id" "convert the question into postgresql query using the context values ### Question: Show the product ids and the number of unique orders containing each product. ### Context: CREATE TABLE Order_items (product_id VARCHAR, order_id VARCHAR) ###Answer: SELECT product_id, COUNT(DISTINCT order_id) FROM Order_items GROUP BY product_id" "convert the question into postgresql query using the context values ### Question: Show all product names and the number of customers having an order on each product. ### Context: CREATE TABLE Order_items (product_id VARCHAR, order_id VARCHAR); CREATE TABLE Orders (order_id VARCHAR); CREATE TABLE Products (product_name VARCHAR, product_id VARCHAR) ###Answer: SELECT T2.product_name, COUNT(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name" "convert the question into postgresql query using the context values ### Question: Show order ids and the number of products in each order. ### Context: CREATE TABLE Order_items (order_id VARCHAR, product_id VARCHAR) ###Answer: SELECT order_id, COUNT(DISTINCT product_id) FROM Order_items GROUP BY order_id" "convert the question into postgresql query using the context values ### Question: Show order ids and the total quantity in each order. ### Context: CREATE TABLE Order_items (order_id VARCHAR, product_quantity INTEGER) ###Answer: SELECT order_id, SUM(product_quantity) FROM Order_items GROUP BY order_id" "convert the question into postgresql query using the context values ### Question: How many products were not included in any order? ### Context: CREATE TABLE products (product_id VARCHAR); CREATE TABLE Order_items (product_id VARCHAR) ###Answer: SELECT COUNT(*) FROM products WHERE NOT product_id IN (SELECT product_id FROM Order_items)" "convert the question into postgresql query using the context values ### Question: How many churches opened before 1850 are there? ### Context: CREATE TABLE Church (Open_Date INTEGER) ###Answer: SELECT COUNT(*) FROM Church WHERE Open_Date < 1850" "convert the question into postgresql query using the context values ### Question: Show the name, open date, and organizer for all churches. ### Context: CREATE TABLE Church (name VARCHAR, open_date VARCHAR, organized_by VARCHAR) ###Answer: SELECT name, open_date, organized_by FROM Church" "convert the question into postgresql query using the context values ### Question: List all church names in descending order of opening date. ### Context: CREATE TABLE church (name VARCHAR, open_date VARCHAR) ###Answer: SELECT name FROM church ORDER BY open_date DESC" "convert the question into postgresql query using the context values ### Question: Show the opening year in whcih at least two churches opened. ### Context: CREATE TABLE church (open_date VARCHAR) ###Answer: SELECT open_date FROM church GROUP BY open_date HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the organizer and name for churches that opened between 1830 and 1840. ### Context: CREATE TABLE church (organized_by VARCHAR, name VARCHAR, open_date INTEGER) ###Answer: SELECT organized_by, name FROM church WHERE open_date BETWEEN 1830 AND 1840" "convert the question into postgresql query using the context values ### Question: Show all opening years and the number of churches that opened in that year. ### Context: CREATE TABLE church (open_date VARCHAR) ###Answer: SELECT open_date, COUNT(*) FROM church GROUP BY open_date" "convert the question into postgresql query using the context values ### Question: Show the name and opening year for three churches that opened most recently. ### Context: CREATE TABLE church (name VARCHAR, open_date VARCHAR) ###Answer: SELECT name, open_date FROM church ORDER BY open_date DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: How many female people are older than 30 in our record? ### Context: CREATE TABLE people (is_male VARCHAR, age VARCHAR) ###Answer: SELECT COUNT(*) FROM people WHERE is_male = 'F' AND age > 30" "convert the question into postgresql query using the context values ### Question: Show the country where people older than 30 and younger than 25 are from. ### Context: CREATE TABLE people (country VARCHAR, age INTEGER) ###Answer: SELECT country FROM people WHERE age < 25 INTERSECT SELECT country FROM people WHERE age > 30" "convert the question into postgresql query using the context values ### Question: Show the minimum, maximum, and average age for all people. ### Context: CREATE TABLE people (age INTEGER) ###Answer: SELECT MIN(age), MAX(age), AVG(age) FROM people" "convert the question into postgresql query using the context values ### Question: Show the name and country for all people whose age is smaller than the average. ### Context: CREATE TABLE people (name VARCHAR, country VARCHAR, age INTEGER) ###Answer: SELECT name, country FROM people WHERE age < (SELECT AVG(age) FROM people)" "convert the question into postgresql query using the context values ### Question: Show the pair of male and female names in all weddings after year 2014 ### Context: CREATE TABLE wedding (male_id VARCHAR, female_id VARCHAR, year INTEGER); CREATE TABLE people (name VARCHAR, people_id VARCHAR) ###Answer: SELECT T2.name, T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id WHERE T1.year > 2014" "convert the question into postgresql query using the context values ### Question: Show the name and age for all male people who don't have a wedding. ### Context: CREATE TABLE wedding (name VARCHAR, age VARCHAR, is_male VARCHAR, people_id VARCHAR, male_id VARCHAR); CREATE TABLE people (name VARCHAR, age VARCHAR, is_male VARCHAR, people_id VARCHAR, male_id VARCHAR) ###Answer: SELECT name, age FROM people WHERE is_male = 'T' AND NOT people_id IN (SELECT male_id FROM wedding)" "convert the question into postgresql query using the context values ### Question: Show all church names except for those that had a wedding in year 2015. ### Context: CREATE TABLE church (name VARCHAR); CREATE TABLE wedding (church_id VARCHAR, year VARCHAR); CREATE TABLE church (name VARCHAR, church_id VARCHAR) ###Answer: SELECT name FROM church EXCEPT SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id WHERE T2.year = 2015" "convert the question into postgresql query using the context values ### Question: Show all church names that have hosted least two weddings. ### Context: CREATE TABLE wedding (church_id VARCHAR); CREATE TABLE church (name VARCHAR, church_id VARCHAR) ###Answer: SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id GROUP BY T1.church_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the names for all females from Canada having a wedding in year 2016. ### Context: CREATE TABLE people (name VARCHAR, people_id VARCHAR, country VARCHAR, is_male VARCHAR); CREATE TABLE wedding (female_id VARCHAR, year VARCHAR) ###Answer: SELECT T2.name FROM wedding AS T1 JOIN people AS T2 ON T1.female_id = T2.people_id WHERE T1.year = 2016 AND T2.is_male = 'F' AND T2.country = 'Canada'" "convert the question into postgresql query using the context values ### Question: How many weddings are there in year 2016? ### Context: CREATE TABLE wedding (YEAR VARCHAR) ###Answer: SELECT COUNT(*) FROM wedding WHERE YEAR = 2016" "convert the question into postgresql query using the context values ### Question: Show the church names for the weddings of all people older than 30. ### Context: CREATE TABLE church (name VARCHAR, church_id VARCHAR); CREATE TABLE people (people_id VARCHAR, age VARCHAR); CREATE TABLE wedding (male_id VARCHAR, female_id VARCHAR, church_id VARCHAR) ###Answer: SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30" "convert the question into postgresql query using the context values ### Question: Show all countries and the number of people from each country. ### Context: CREATE TABLE people (country VARCHAR) ###Answer: SELECT country, COUNT(*) FROM people GROUP BY country" "convert the question into postgresql query using the context values ### Question: How many churches have a wedding in year 2016? ### Context: CREATE TABLE wedding (church_id VARCHAR, YEAR VARCHAR) ###Answer: SELECT COUNT(DISTINCT church_id) FROM wedding WHERE YEAR = 2016" "convert the question into postgresql query using the context values ### Question: How many artists do we have? ### Context: CREATE TABLE artist (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM artist" "convert the question into postgresql query using the context values ### Question: Show all artist name, age, and country ordered by the yeared they joined. ### Context: CREATE TABLE artist (name VARCHAR, age VARCHAR, country VARCHAR, Year_Join VARCHAR) ###Answer: SELECT name, age, country FROM artist ORDER BY Year_Join" "convert the question into postgresql query using the context values ### Question: What are all distinct country for artists? ### Context: CREATE TABLE artist (country VARCHAR) ###Answer: SELECT DISTINCT country FROM artist" "convert the question into postgresql query using the context values ### Question: Show all artist names and the year joined who are not from United States. ### Context: CREATE TABLE artist (name VARCHAR, year_join VARCHAR, country VARCHAR) ###Answer: SELECT name, year_join FROM artist WHERE country <> 'United States'" "convert the question into postgresql query using the context values ### Question: How many artists are above age 46 and joined after 1990? ### Context: CREATE TABLE artist (age VARCHAR, year_join VARCHAR) ###Answer: SELECT COUNT(*) FROM artist WHERE age > 46 AND year_join > 1990" "convert the question into postgresql query using the context values ### Question: What is the average and minimum age of all artists from United States. ### Context: CREATE TABLE artist (age INTEGER, country VARCHAR) ###Answer: SELECT AVG(age), MIN(age) FROM artist WHERE country = 'United States'" "convert the question into postgresql query using the context values ### Question: What is the name of the artist who joined latest? ### Context: CREATE TABLE artist (name VARCHAR, year_join VARCHAR) ###Answer: SELECT name FROM artist ORDER BY year_join DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many exhibition are there in year 2005 or after? ### Context: CREATE TABLE exhibition (YEAR VARCHAR) ###Answer: SELECT COUNT(*) FROM exhibition WHERE YEAR >= 2005" "convert the question into postgresql query using the context values ### Question: Show theme and year for all exhibitions with ticket prices lower than 15. ### Context: CREATE TABLE exhibition (theme VARCHAR, YEAR VARCHAR, ticket_price INTEGER) ###Answer: SELECT theme, YEAR FROM exhibition WHERE ticket_price < 15" "convert the question into postgresql query using the context values ### Question: Show all artist names and the number of exhibitions for each artist. ### Context: CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (artist_id VARCHAR) ###Answer: SELECT T2.name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id" "convert the question into postgresql query using the context values ### Question: What is the name and country for the artist with most number of exhibitions? ### Context: CREATE TABLE exhibition (artist_id VARCHAR); CREATE TABLE artist (name VARCHAR, country VARCHAR, artist_id VARCHAR) ###Answer: SELECT T2.name, T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show names for artists without any exhibition. ### Context: CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (name VARCHAR, artist_id VARCHAR) ###Answer: SELECT name FROM artist WHERE NOT artist_id IN (SELECT artist_id FROM exhibition)" "convert the question into postgresql query using the context values ### Question: What is the theme and artist name for the exhibition with a ticket price higher than the average? ### Context: CREATE TABLE exhibition (ticket_price INTEGER); CREATE TABLE exhibition (theme VARCHAR, artist_id VARCHAR, ticket_price INTEGER); CREATE TABLE artist (name VARCHAR, artist_id VARCHAR) ###Answer: SELECT T1.theme, T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT AVG(ticket_price) FROM exhibition)" "convert the question into postgresql query using the context values ### Question: Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009. ### Context: CREATE TABLE exhibition (ticket_price INTEGER, YEAR INTEGER) ###Answer: SELECT AVG(ticket_price), MIN(ticket_price), MAX(ticket_price) FROM exhibition WHERE YEAR < 2009" "convert the question into postgresql query using the context values ### Question: Show theme and year for all exhibitions in an descending order of ticket price. ### Context: CREATE TABLE exhibition (theme VARCHAR, YEAR VARCHAR, ticket_price VARCHAR) ###Answer: SELECT theme, YEAR FROM exhibition ORDER BY ticket_price DESC" "convert the question into postgresql query using the context values ### Question: What is the theme, date, and attendance for the exhibition in year 2004? ### Context: CREATE TABLE exhibition_record (date VARCHAR, attendance VARCHAR, exhibition_id VARCHAR); CREATE TABLE exhibition (theme VARCHAR, exhibition_id VARCHAR, year VARCHAR) ###Answer: SELECT T2.theme, T1.date, T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004" "convert the question into postgresql query using the context values ### Question: Show all artist names who didn't have an exhibition in 2004. ### Context: CREATE TABLE exhibition (artist_id VARCHAR, year VARCHAR); CREATE TABLE artist (name VARCHAR); CREATE TABLE artist (name VARCHAR, artist_id VARCHAR) ###Answer: SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004" "convert the question into postgresql query using the context values ### Question: Show the theme for exhibitions with both records of an attendance below 100 and above 500. ### Context: CREATE TABLE exhibition (theme VARCHAR, exhibition_id VARCHAR); CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance INTEGER) ###Answer: SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500" "convert the question into postgresql query using the context values ### Question: How many exhibitions have a attendance more than 100 or have a ticket price below 10? ### Context: CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance VARCHAR); CREATE TABLE exhibition (exhibition_id VARCHAR, ticket_price VARCHAR) ###Answer: SELECT COUNT(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10" "convert the question into postgresql query using the context values ### Question: Show all artist names with an average exhibition attendance over 200. ### Context: CREATE TABLE artist (name VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition (exhibition_id VARCHAR, artist_id VARCHAR); CREATE TABLE exhibition_record (exhibition_id VARCHAR, attendance INTEGER) ###Answer: SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id JOIN artist AS T3 ON T3.artist_id = T2.artist_id GROUP BY T3.artist_id HAVING AVG(T1.attendance) > 200" "convert the question into postgresql query using the context values ### Question: Find the id of the item whose title is ""orange"". ### Context: CREATE TABLE item (i_id VARCHAR, title VARCHAR) ###Answer: SELECT i_id FROM item WHERE title = ""orange""" "convert the question into postgresql query using the context values ### Question: List all information in the item table. ### Context: CREATE TABLE item (Id VARCHAR) ###Answer: SELECT * FROM item" "convert the question into postgresql query using the context values ### Question: Find the number of reviews. ### Context: CREATE TABLE review (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM review" "convert the question into postgresql query using the context values ### Question: How many users are there? ### Context: CREATE TABLE useracct (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM useracct" "convert the question into postgresql query using the context values ### Question: Find the average and maximum rating of all reviews. ### Context: CREATE TABLE review (rating INTEGER) ###Answer: SELECT AVG(rating), MAX(rating) FROM review" "convert the question into postgresql query using the context values ### Question: Find the highest rank of all reviews. ### Context: CREATE TABLE review (rank INTEGER) ###Answer: SELECT MIN(rank) FROM review" "convert the question into postgresql query using the context values ### Question: How many different users wrote some reviews? ### Context: CREATE TABLE review (u_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT u_id) FROM review" "convert the question into postgresql query using the context values ### Question: How many different items were reviewed by some users? ### Context: CREATE TABLE review (i_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT i_id) FROM review" "convert the question into postgresql query using the context values ### Question: Find the number of items that did not receive any review. ### Context: CREATE TABLE review (i_id VARCHAR); CREATE TABLE item (i_id VARCHAR) ###Answer: SELECT COUNT(*) FROM item WHERE NOT i_id IN (SELECT i_id FROM review)" "convert the question into postgresql query using the context values ### Question: Find the names of users who did not leave any review. ### Context: CREATE TABLE review (name VARCHAR, u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR) ###Answer: SELECT name FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)" "convert the question into postgresql query using the context values ### Question: Find the names of goods that receive a rating of 10. ### Context: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating VARCHAR) ###Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10" "convert the question into postgresql query using the context values ### Question: Find the titles of items whose rating is higher than the average review rating of all items. ### Context: CREATE TABLE review (rating INTEGER); CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER) ###Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > (SELECT AVG(rating) FROM review)" "convert the question into postgresql query using the context values ### Question: Find the titles of items that received any rating below 5. ### Context: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER) ###Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5" "convert the question into postgresql query using the context values ### Question: Find the titles of items that received both a rating higher than 8 and a rating below 5. ### Context: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER) ###Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5" "convert the question into postgresql query using the context values ### Question: Find the names of items whose rank is higher than 3 and whose average rating is above 5. ### Context: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rank INTEGER, rating INTEGER) ###Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id HAVING AVG(T2.rating) > 5" "convert the question into postgresql query using the context values ### Question: Find the name of the item with the lowest average rating. ### Context: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER) ###Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rating) LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the titles of all items in alphabetic order . ### Context: CREATE TABLE item (title VARCHAR) ###Answer: SELECT title FROM item ORDER BY title" "convert the question into postgresql query using the context values ### Question: Find the name of the user who gives the most reviews. ### Context: CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE review (u_id VARCHAR) ###Answer: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name and id of the item with the highest average rating. ### Context: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (i_id VARCHAR, rating INTEGER) ###Answer: SELECT T1.title, T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rating) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name and id of the good with the highest average rank. ### Context: CREATE TABLE review (i_id VARCHAR, rank INTEGER); CREATE TABLE item (title VARCHAR, i_id VARCHAR) ###Answer: SELECT T1.title, T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rank) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: For each user, return the name and the average rating of reviews given by them. ### Context: CREATE TABLE review (rating INTEGER, u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR) ###Answer: SELECT T1.name, AVG(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id" "convert the question into postgresql query using the context values ### Question: For each user, find their name and the number of reviews written by them. ### Context: CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE review (u_id VARCHAR) ###Answer: SELECT T1.name, COUNT(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id" "convert the question into postgresql query using the context values ### Question: Find the name of the user who gave the highest rating. ### Context: CREATE TABLE review (u_id VARCHAR, rating VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR) ###Answer: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id ORDER BY T2.rating DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of the source user with the highest average trust score. ### Context: CREATE TABLE useracct (name VARCHAR, u_id VARCHAR); CREATE TABLE trust (source_u_id VARCHAR) ###Answer: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.source_u_id GROUP BY T2.source_u_id ORDER BY AVG(trust) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find each target user's name and average trust score. ### Context: CREATE TABLE trust (target_u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR) ###Answer: SELECT T1.name, AVG(trust) FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id GROUP BY T2.target_u_id" "convert the question into postgresql query using the context values ### Question: Find the name of the target user with the lowest trust score. ### Context: CREATE TABLE trust (target_u_id VARCHAR); CREATE TABLE useracct (name VARCHAR, u_id VARCHAR) ###Answer: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names of the items that did not receive any review. ### Context: CREATE TABLE item (title VARCHAR, i_id VARCHAR); CREATE TABLE review (title VARCHAR, i_id VARCHAR) ###Answer: SELECT title FROM item WHERE NOT i_id IN (SELECT i_id FROM review)" "convert the question into postgresql query using the context values ### Question: Find the number of users who did not write any review. ### Context: CREATE TABLE review (u_id VARCHAR); CREATE TABLE useracct (u_id VARCHAR) ###Answer: SELECT COUNT(*) FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)" "convert the question into postgresql query using the context values ### Question: How many players are there? ### Context: CREATE TABLE player (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM player" "convert the question into postgresql query using the context values ### Question: List the names of players in ascending order of votes. ### Context: CREATE TABLE player (Player_name VARCHAR, Votes VARCHAR) ###Answer: SELECT Player_name FROM player ORDER BY Votes" "convert the question into postgresql query using the context values ### Question: What are the gender and occupation of players? ### Context: CREATE TABLE player (Gender VARCHAR, Occupation VARCHAR) ###Answer: SELECT Gender, Occupation FROM player" "convert the question into postgresql query using the context values ### Question: List the name and residence for players whose occupation is not ""Researcher"". ### Context: CREATE TABLE player (Player_name VARCHAR, residence VARCHAR, Occupation VARCHAR) ###Answer: SELECT Player_name, residence FROM player WHERE Occupation <> ""Researcher""" "convert the question into postgresql query using the context values ### Question: Show the names of sponsors of players whose residence is either ""Brandon"" or ""Birtle"". ### Context: CREATE TABLE player (Sponsor_name VARCHAR, Residence VARCHAR) ###Answer: SELECT Sponsor_name FROM player WHERE Residence = ""Brandon"" OR Residence = ""Birtle""" "convert the question into postgresql query using the context values ### Question: What is the name of the player with the largest number of votes? ### Context: CREATE TABLE player (Player_name VARCHAR, Votes VARCHAR) ###Answer: SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show different occupations along with the number of players in each occupation. ### Context: CREATE TABLE player (Occupation VARCHAR) ###Answer: SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation" "convert the question into postgresql query using the context values ### Question: Please show the most common occupation of players. ### Context: CREATE TABLE player (Occupation VARCHAR) ###Answer: SELECT Occupation FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the residences that have at least two players. ### Context: CREATE TABLE player (Residence VARCHAR) ###Answer: SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the names of players and names of their coaches. ### Context: CREATE TABLE player (Player_name VARCHAR, Player_ID VARCHAR); CREATE TABLE coach (coach_name VARCHAR, Coach_ID VARCHAR); CREATE TABLE player_coach (Coach_ID VARCHAR, Player_ID VARCHAR) ###Answer: SELECT T3.Player_name, T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID" "convert the question into postgresql query using the context values ### Question: Show the names of players coached by the rank 1 coach. ### Context: CREATE TABLE player (Player_name VARCHAR, Player_ID VARCHAR); CREATE TABLE coach (Coach_ID VARCHAR, Rank VARCHAR); CREATE TABLE player_coach (Coach_ID VARCHAR, Player_ID VARCHAR) ###Answer: SELECT T3.Player_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T2.Rank = 1" "convert the question into postgresql query using the context values ### Question: Show the names and genders of players with a coach starting after 2011. ### Context: CREATE TABLE player (Player_name VARCHAR, gender VARCHAR, Player_ID VARCHAR); CREATE TABLE player_coach (Coach_ID VARCHAR, Player_ID VARCHAR, Starting_year INTEGER); CREATE TABLE coach (Coach_ID VARCHAR) ###Answer: SELECT T3.Player_name, T3.gender FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T1.Starting_year > 2011" "convert the question into postgresql query using the context values ### Question: Show the names of players and names of their coaches in descending order of the votes of players. ### Context: CREATE TABLE coach (coach_name VARCHAR, Coach_ID VARCHAR); CREATE TABLE player_coach (Coach_ID VARCHAR, Player_ID VARCHAR); CREATE TABLE player (Player_name VARCHAR, Player_ID VARCHAR, Votes VARCHAR) ###Answer: SELECT T3.Player_name, T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID ORDER BY T3.Votes DESC" "convert the question into postgresql query using the context values ### Question: List the names of players that do not have coaches. ### Context: CREATE TABLE player (Player_name VARCHAR, Player_ID VARCHAR); CREATE TABLE player_coach (Player_name VARCHAR, Player_ID VARCHAR) ###Answer: SELECT Player_name FROM player WHERE NOT Player_ID IN (SELECT Player_ID FROM player_coach)" "convert the question into postgresql query using the context values ### Question: Show the residences that have both a player of gender ""M"" and a player of gender ""F"". ### Context: CREATE TABLE player (Residence VARCHAR, gender VARCHAR) ###Answer: SELECT Residence FROM player WHERE gender = ""M"" INTERSECT SELECT Residence FROM player WHERE gender = ""F""" "convert the question into postgresql query using the context values ### Question: How many coaches does each club has? List the club id, name and the number of coaches. ### Context: CREATE TABLE club (club_id VARCHAR, club_name VARCHAR); CREATE TABLE coach (club_id VARCHAR) ###Answer: SELECT T1.club_id, T1.club_name, COUNT(*) FROM club AS T1 JOIN coach AS T2 ON T1.club_id = T2.club_id GROUP BY T1.club_id" "convert the question into postgresql query using the context values ### Question: How many gold medals has the club with the most coaches won? ### Context: CREATE TABLE match_result (club_id VARCHAR, gold VARCHAR); CREATE TABLE coach (club_id VARCHAR) ###Answer: SELECT T1.club_id, T1.gold FROM match_result AS T1 JOIN coach AS T2 ON T1.club_id = T2.club_id GROUP BY T1.club_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many gymnasts are there? ### Context: CREATE TABLE gymnast (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM gymnast" "convert the question into postgresql query using the context values ### Question: List the total points of gymnasts in descending order. ### Context: CREATE TABLE gymnast (Total_Points VARCHAR) ###Answer: SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC" "convert the question into postgresql query using the context values ### Question: List the total points of gymnasts in descending order of floor exercise points. ### Context: CREATE TABLE gymnast (Total_Points VARCHAR, Floor_Exercise_Points VARCHAR) ###Answer: SELECT Total_Points FROM gymnast ORDER BY Floor_Exercise_Points DESC" "convert the question into postgresql query using the context values ### Question: What is the average horizontal bar points for all gymnasts? ### Context: CREATE TABLE gymnast (Horizontal_Bar_Points INTEGER) ###Answer: SELECT AVG(Horizontal_Bar_Points) FROM gymnast" "convert the question into postgresql query using the context values ### Question: What are the names of people in ascending alphabetical order? ### Context: CREATE TABLE People (Name VARCHAR) ###Answer: SELECT Name FROM People ORDER BY Name" "convert the question into postgresql query using the context values ### Question: What are the names of gymnasts? ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID" "convert the question into postgresql query using the context values ### Question: What are the names of gymnasts whose hometown is not ""Santo Domingo""? ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR, Hometown VARCHAR) ###Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T2.Hometown <> ""Santo Domingo""" "convert the question into postgresql query using the context values ### Question: What is the age of the tallest person? ### Context: CREATE TABLE people (Age VARCHAR, Height VARCHAR) ###Answer: SELECT Age FROM people ORDER BY Height DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the names of the top 5 oldest people. ### Context: CREATE TABLE People (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM People ORDER BY Age DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: What is the total point count of the youngest gymnast? ### Context: CREATE TABLE people (People_ID VARCHAR, Age VARCHAR); CREATE TABLE gymnast (Total_Points VARCHAR, Gymnast_ID VARCHAR) ###Answer: SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Age LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the average age of all gymnasts? ### Context: CREATE TABLE people (Age INTEGER, People_ID VARCHAR); CREATE TABLE gymnast (Gymnast_ID VARCHAR) ###Answer: SELECT AVG(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID" "convert the question into postgresql query using the context values ### Question: What are the distinct hometowns of gymnasts with total points more than 57.5? ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR, Total_Points INTEGER); CREATE TABLE people (Hometown VARCHAR, People_ID VARCHAR) ###Answer: SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T1.Total_Points > 57.5" "convert the question into postgresql query using the context values ### Question: What are the hometowns of gymnasts and the corresponding number of gymnasts? ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR); CREATE TABLE people (Hometown VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Hometown, COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown" "convert the question into postgresql query using the context values ### Question: What is the most common hometown of gymnasts? ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR); CREATE TABLE people (Hometown VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the hometowns that are shared by at least two gymnasts? ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR); CREATE TABLE people (Hometown VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: List the names of gymnasts in ascending order by their heights. ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR, Height VARCHAR) ###Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Height" "convert the question into postgresql query using the context values ### Question: List the distinct hometowns that are not associated with any gymnast. ### Context: CREATE TABLE gymnast (Gymnast_ID VARCHAR); CREATE TABLE people (Hometown VARCHAR, People_ID VARCHAR); CREATE TABLE people (Hometown VARCHAR) ###Answer: SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID" "convert the question into postgresql query using the context values ### Question: Show the hometowns shared by people older than 23 and younger than 20. ### Context: CREATE TABLE people (Hometown VARCHAR, Age INTEGER) ###Answer: SELECT Hometown FROM people WHERE Age > 23 INTERSECT SELECT Hometown FROM people WHERE Age < 20" "convert the question into postgresql query using the context values ### Question: How many distinct hometowns did these people have? ### Context: CREATE TABLE people (Hometown VARCHAR) ###Answer: SELECT COUNT(DISTINCT Hometown) FROM people" "convert the question into postgresql query using the context values ### Question: Show the ages of gymnasts in descending order of total points. ### Context: CREATE TABLE people (Age VARCHAR, People_ID VARCHAR); CREATE TABLE gymnast (Gymnast_ID VARCHAR, Total_Points VARCHAR) ###Answer: SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC" "convert the question into postgresql query using the context values ### Question: Find the total savings balance of all accounts except the account with name ‘Brown’. ### Context: CREATE TABLE accounts (custid VARCHAR, name VARCHAR); CREATE TABLE savings (balance INTEGER, custid VARCHAR) ###Answer: SELECT SUM(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name <> 'Brown'" "convert the question into postgresql query using the context values ### Question: How many accounts are there in total? ### Context: CREATE TABLE accounts (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM accounts" "convert the question into postgresql query using the context values ### Question: What is the total checking balance in all accounts? ### Context: CREATE TABLE checking (balance INTEGER) ###Answer: SELECT SUM(balance) FROM checking" "convert the question into postgresql query using the context values ### Question: Find the average checking balance. ### Context: CREATE TABLE checking (balance INTEGER) ###Answer: SELECT AVG(balance) FROM checking" "convert the question into postgresql query using the context values ### Question: How many accounts have a savings balance above the average savings balance? ### Context: CREATE TABLE savings (balance INTEGER) ###Answer: SELECT COUNT(*) FROM savings WHERE balance > (SELECT AVG(balance) FROM savings)" "convert the question into postgresql query using the context values ### Question: Find the name and id of accounts whose checking balance is below the maximum checking balance. ### Context: CREATE TABLE accounts (custid VARCHAR, name VARCHAR); CREATE TABLE checking (balance INTEGER); CREATE TABLE checking (custid VARCHAR, balance INTEGER) ###Answer: SELECT T1.custid, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT MAX(balance) FROM checking)" "convert the question into postgresql query using the context values ### Question: What is the checking balance of the account whose owner’s name contains the substring ‘ee’? ### Context: CREATE TABLE checking (balance VARCHAR, custid VARCHAR); CREATE TABLE accounts (custid VARCHAR, name VARCHAR) ###Answer: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name LIKE '%ee%'" "convert the question into postgresql query using the context values ### Question: Find the checking balance and saving balance in the Brown’s account. ### Context: CREATE TABLE checking (balance VARCHAR, custid VARCHAR); CREATE TABLE accounts (custid VARCHAR, name VARCHAR); CREATE TABLE savings (balance VARCHAR, custid VARCHAR) ###Answer: SELECT T2.balance, T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T1.name = 'Brown'" "convert the question into postgresql query using the context values ### Question: Find the names of accounts whose checking balance is above the average checking balance, but savings balance is below the average savings balance. ### Context: CREATE TABLE checking (custid VARCHAR, balance INTEGER); CREATE TABLE savings (custid VARCHAR, balance INTEGER); CREATE TABLE savings (balance INTEGER); CREATE TABLE checking (balance INTEGER); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT AVG(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT AVG(balance) FROM savings)" "convert the question into postgresql query using the context values ### Question: Find the checking balance of the accounts whose savings balance is higher than the average savings balance. ### Context: CREATE TABLE accounts (custid VARCHAR, name VARCHAR); CREATE TABLE checking (balance INTEGER, custid VARCHAR); CREATE TABLE savings (balance INTEGER, custid VARCHAR); CREATE TABLE savings (balance INTEGER) ###Answer: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT AVG(balance) FROM savings))" "convert the question into postgresql query using the context values ### Question: List all customers’ names in the alphabetical order. ### Context: CREATE TABLE accounts (name VARCHAR) ###Answer: SELECT name FROM accounts ORDER BY name" "convert the question into postgresql query using the context values ### Question: Find the name of account that has the lowest total checking and saving balance. ### Context: CREATE TABLE checking (custid VARCHAR, balance VARCHAR); CREATE TABLE savings (custid VARCHAR, balance VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance. ### Context: CREATE TABLE checking (balance INTEGER, custid VARCHAR); CREATE TABLE savings (balance INTEGER, custid VARCHAR); CREATE TABLE savings (balance INTEGER); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T1.name, T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance > (SELECT AVG(balance) FROM savings)" "convert the question into postgresql query using the context values ### Question: Find the name and checking balance of the account with the lowest savings balance. ### Context: CREATE TABLE checking (balance VARCHAR, custid VARCHAR); CREATE TABLE savings (custid VARCHAR, balance VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T1.name, T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the number of checking accounts for each account name. ### Context: CREATE TABLE checking (custid VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT COUNT(*), T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid GROUP BY T1.name" "convert the question into postgresql query using the context values ### Question: Find the total saving balance for each account name. ### Context: CREATE TABLE savings (balance INTEGER, custid VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT SUM(T2.balance), T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid GROUP BY T1.name" "convert the question into postgresql query using the context values ### Question: Find the name of accounts whose checking balance is below the average checking balance. ### Context: CREATE TABLE accounts (name VARCHAR, custid VARCHAR); CREATE TABLE checking (balance INTEGER); CREATE TABLE checking (custid VARCHAR, balance INTEGER) ###Answer: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT AVG(balance) FROM checking)" "convert the question into postgresql query using the context values ### Question: Find the saving balance of the account with the highest checking balance. ### Context: CREATE TABLE savings (balance VARCHAR, custid VARCHAR); CREATE TABLE checking (custid VARCHAR, balance VARCHAR); CREATE TABLE accounts (custid VARCHAR) ###Answer: SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the total checking and saving balance of all accounts sorted by the total balance in ascending order. ### Context: CREATE TABLE checking (balance VARCHAR, custid VARCHAR); CREATE TABLE savings (balance VARCHAR, custid VARCHAR) ###Answer: SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T1.balance + T2.balance" "convert the question into postgresql query using the context values ### Question: Find the name and checking balance of the account with the lowest saving balance. ### Context: CREATE TABLE checking (balance VARCHAR, custid VARCHAR); CREATE TABLE savings (custid VARCHAR, balance VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T2.balance, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name, checking balance and saving balance of all accounts in the bank. ### Context: CREATE TABLE checking (balance VARCHAR, custid VARCHAR); CREATE TABLE savings (balance VARCHAR, custid VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T2.balance, T3.balance, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid" "convert the question into postgresql query using the context values ### Question: Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order. ### Context: CREATE TABLE checking (balance VARCHAR, custid VARCHAR); CREATE TABLE savings (balance VARCHAR, custid VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T2.balance, T3.balance, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance DESC" "convert the question into postgresql query using the context values ### Question: Find the name of accounts whose checking balance is higher than corresponding saving balance. ### Context: CREATE TABLE savings (custid VARCHAR, balance INTEGER); CREATE TABLE accounts (name VARCHAR, custid VARCHAR); CREATE TABLE checking (custid VARCHAR, balance INTEGER) ###Answer: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T2.balance > T3.balance" "convert the question into postgresql query using the context values ### Question: Find the name and total checking and savings balance of the accounts whose savings balance is lower than corresponding checking balance. ### Context: CREATE TABLE checking (balance INTEGER, custid VARCHAR); CREATE TABLE savings (balance INTEGER, custid VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T1.name, T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance" "convert the question into postgresql query using the context values ### Question: Find the name and savings balance of the top 3 accounts with the highest saving balance sorted by savings balance in descending order. ### Context: CREATE TABLE savings (balance VARCHAR, custid VARCHAR); CREATE TABLE accounts (name VARCHAR, custid VARCHAR) ###Answer: SELECT T1.name, T2.balance FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T2.balance DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: How many main stream browsers whose market share is at least 5 exist? ### Context: CREATE TABLE browser (market_share VARCHAR) ###Answer: SELECT COUNT(*) FROM browser WHERE market_share >= 5" "convert the question into postgresql query using the context values ### Question: List the name of browsers in descending order by market share. ### Context: CREATE TABLE browser (name VARCHAR, market_share VARCHAR) ###Answer: SELECT name FROM browser ORDER BY market_share DESC" "convert the question into postgresql query using the context values ### Question: List the ids, names and market shares of all browsers. ### Context: CREATE TABLE browser (id VARCHAR, name VARCHAR, market_share VARCHAR) ###Answer: SELECT id, name, market_share FROM browser" "convert the question into postgresql query using the context values ### Question: What is the maximum, minimum and average market share of the listed browsers? ### Context: CREATE TABLE browser (market_share INTEGER) ###Answer: SELECT MAX(market_share), MIN(market_share), AVG(market_share) FROM browser" "convert the question into postgresql query using the context values ### Question: What is the id and market share of the browser Safari? ### Context: CREATE TABLE browser (id VARCHAR, market_share VARCHAR, name VARCHAR) ###Answer: SELECT id, market_share FROM browser WHERE name = 'Safari'" "convert the question into postgresql query using the context values ### Question: What are the name and os of web client accelerators that do not work with only a 'Broadband' type connection? ### Context: CREATE TABLE web_client_accelerator (name VARCHAR, operating_system VARCHAR, CONNECTION VARCHAR) ###Answer: SELECT name, operating_system FROM web_client_accelerator WHERE CONNECTION <> 'Broadband'" "convert the question into postgresql query using the context values ### Question: What is the name of the browser that became compatible with the accelerator 'CProxy' after year 1998 ? ### Context: CREATE TABLE accelerator_compatible_browser (browser_id VARCHAR, accelerator_id VARCHAR, compatible_since_year VARCHAR); CREATE TABLE web_client_accelerator (id VARCHAR, name VARCHAR); CREATE TABLE browser (name VARCHAR, id VARCHAR) ###Answer: SELECT T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id JOIN web_client_accelerator AS T3 ON T2.accelerator_id = T3.id WHERE T3.name = 'CProxy' AND T2.compatible_since_year > 1998" "convert the question into postgresql query using the context values ### Question: What are the ids and names of the web accelerators that are compatible with two or more browsers? ### Context: CREATE TABLE accelerator_compatible_browser (accelerator_id VARCHAR); CREATE TABLE web_client_accelerator (id VARCHAR, Name VARCHAR) ###Answer: SELECT T1.id, T1.Name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What is the id and name of the browser that is compatible with the most web accelerators? ### Context: CREATE TABLE browser (id VARCHAR, name VARCHAR); CREATE TABLE accelerator_compatible_browser (browser_id VARCHAR) ###Answer: SELECT T1.id, T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: When did the web accelerator 'CACHEbox' and browser 'Internet Explorer' become compatible? ### Context: CREATE TABLE accelerator_compatible_browser (compatible_since_year VARCHAR, browser_id VARCHAR, accelerator_id VARCHAR); CREATE TABLE browser (id VARCHAR, name VARCHAR); CREATE TABLE web_client_accelerator (id VARCHAR, name VARCHAR) ###Answer: SELECT T1.compatible_since_year FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id WHERE T3.name = 'CACHEbox' AND T2.name = 'Internet Explorer'" "convert the question into postgresql query using the context values ### Question: How many different kinds of clients are supported by the web clients accelerators? ### Context: CREATE TABLE web_client_accelerator (client VARCHAR) ###Answer: SELECT COUNT(DISTINCT client) FROM web_client_accelerator" "convert the question into postgresql query using the context values ### Question: How many accelerators are not compatible with the browsers listed ? ### Context: CREATE TABLE accelerator_compatible_browser (id VARCHAR, accelerator_id VARCHAR); CREATE TABLE web_client_accelerator (id VARCHAR, accelerator_id VARCHAR) ###Answer: SELECT COUNT(*) FROM web_client_accelerator WHERE NOT id IN (SELECT accelerator_id FROM accelerator_compatible_browser)" "convert the question into postgresql query using the context values ### Question: What distinct accelerator names are compatible with the browswers that have market share higher than 15? ### Context: CREATE TABLE web_client_accelerator (name VARCHAR, id VARCHAR); CREATE TABLE accelerator_compatible_browser (accelerator_id VARCHAR, browser_id VARCHAR); CREATE TABLE browser (id VARCHAR, market_share INTEGER) ###Answer: SELECT DISTINCT T1.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.market_share > 15" "convert the question into postgresql query using the context values ### Question: List the names of the browser that are compatible with both 'CACHEbox' and 'Fasterfox'. ### Context: CREATE TABLE accelerator_compatible_browser (accelerator_id VARCHAR, browser_id VARCHAR); CREATE TABLE web_client_accelerator (id VARCHAR, name VARCHAR); CREATE TABLE browser (name VARCHAR, id VARCHAR) ###Answer: SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'CACHEbox' INTERSECT SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'Fasterfox'" "convert the question into postgresql query using the context values ### Question: Show the accelerator names and supporting operating systems that are not compatible with the browser named 'Opera'. ### Context: CREATE TABLE browser (id VARCHAR, name VARCHAR); CREATE TABLE web_client_accelerator (name VARCHAR, operating_system VARCHAR); CREATE TABLE accelerator_compatible_browser (accelerator_id VARCHAR, browser_id VARCHAR); CREATE TABLE web_client_accelerator (name VARCHAR, operating_system VARCHAR, id VARCHAR) ###Answer: SELECT name, operating_system FROM web_client_accelerator EXCEPT SELECT T1.name, T1.operating_system FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.name = 'Opera'" "convert the question into postgresql query using the context values ### Question: Which accelerator name contains substring ""Opera""? ### Context: CREATE TABLE web_client_accelerator (name VARCHAR) ###Answer: SELECT name FROM web_client_accelerator WHERE name LIKE ""%Opera%""" "convert the question into postgresql query using the context values ### Question: Find the number of web accelerators used for each Operating system. ### Context: CREATE TABLE web_client_accelerator (Operating_system VARCHAR) ###Answer: SELECT Operating_system, COUNT(*) FROM web_client_accelerator GROUP BY Operating_system" "convert the question into postgresql query using the context values ### Question: give me names of all compatible browsers and accelerators in the descending order of compatible year ### Context: CREATE TABLE accelerator_compatible_browser (browser_id VARCHAR, accelerator_id VARCHAR, compatible_since_year VARCHAR); CREATE TABLE web_client_accelerator (name VARCHAR, id VARCHAR); CREATE TABLE browser (name VARCHAR, id VARCHAR) ###Answer: SELECT T2.name, T3.name FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id ORDER BY T1.compatible_since_year DESC" "convert the question into postgresql query using the context values ### Question: How many wrestlers are there? ### Context: CREATE TABLE wrestler (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM wrestler" "convert the question into postgresql query using the context values ### Question: List the names of wrestlers in descending order of days held. ### Context: CREATE TABLE wrestler (Name VARCHAR, Days_held VARCHAR) ###Answer: SELECT Name FROM wrestler ORDER BY Days_held DESC" "convert the question into postgresql query using the context values ### Question: What is the name of the wrestler with the fewest days held? ### Context: CREATE TABLE wrestler (Name VARCHAR, Days_held VARCHAR) ###Answer: SELECT Name FROM wrestler ORDER BY Days_held LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the distinct reigns of wrestlers whose location is not ""Tokyo,Japan"" ? ### Context: CREATE TABLE wrestler (Reign VARCHAR, LOCATION VARCHAR) ###Answer: SELECT DISTINCT Reign FROM wrestler WHERE LOCATION <> ""Tokyo , Japan""" "convert the question into postgresql query using the context values ### Question: What are the names and location of the wrestlers? ### Context: CREATE TABLE wrestler (Name VARCHAR, LOCATION VARCHAR) ###Answer: SELECT Name, LOCATION FROM wrestler" "convert the question into postgresql query using the context values ### Question: What are the elimination moves of wrestlers whose team is ""Team Orton""? ### Context: CREATE TABLE Elimination (Elimination_Move VARCHAR, Team VARCHAR) ###Answer: SELECT Elimination_Move FROM Elimination WHERE Team = ""Team Orton""" "convert the question into postgresql query using the context values ### Question: What are the names of wrestlers and the elimination moves? ### Context: CREATE TABLE wrestler (Name VARCHAR, Wrestler_ID VARCHAR); CREATE TABLE elimination (Elimination_Move VARCHAR, Wrestler_ID VARCHAR) ###Answer: SELECT T2.Name, T1.Elimination_Move FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID" "convert the question into postgresql query using the context values ### Question: List the names of wrestlers and the teams in elimination in descending order of days held. ### Context: CREATE TABLE elimination (Team VARCHAR, Wrestler_ID VARCHAR); CREATE TABLE wrestler (Name VARCHAR, Wrestler_ID VARCHAR, Days_held VARCHAR) ###Answer: SELECT T2.Name, T1.Team FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC" "convert the question into postgresql query using the context values ### Question: List the time of elimination of the wrestlers with largest days held. ### Context: CREATE TABLE wrestler (Wrestler_ID VARCHAR, Days_held VARCHAR); CREATE TABLE elimination (Time VARCHAR, Wrestler_ID VARCHAR) ###Answer: SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show times of elimination of wrestlers with days held more than 50. ### Context: CREATE TABLE wrestler (Wrestler_ID VARCHAR, Days_held INTEGER); CREATE TABLE elimination (Time VARCHAR, Wrestler_ID VARCHAR) ###Answer: SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID WHERE T2.Days_held > 50" "convert the question into postgresql query using the context values ### Question: Show different teams in eliminations and the number of eliminations from each team. ### Context: CREATE TABLE elimination (Team VARCHAR) ###Answer: SELECT Team, COUNT(*) FROM elimination GROUP BY Team" "convert the question into postgresql query using the context values ### Question: Show teams that have suffered more than three eliminations. ### Context: CREATE TABLE elimination (Team VARCHAR) ###Answer: SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*) > 3" "convert the question into postgresql query using the context values ### Question: Show the reign and days held of wrestlers. ### Context: CREATE TABLE wrestler (Reign VARCHAR, Days_held VARCHAR) ###Answer: SELECT Reign, Days_held FROM wrestler" "convert the question into postgresql query using the context values ### Question: What are the names of wrestlers days held less than 100? ### Context: CREATE TABLE wrestler (Name VARCHAR, Days_held INTEGER) ###Answer: SELECT Name FROM wrestler WHERE Days_held < 100" "convert the question into postgresql query using the context values ### Question: Please show the most common reigns of wrestlers. ### Context: CREATE TABLE wrestler (Reign VARCHAR) ###Answer: SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the locations that are shared by more than two wrestlers. ### Context: CREATE TABLE wrestler (LOCATION VARCHAR) ###Answer: SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: List the names of wrestlers that have not been eliminated. ### Context: CREATE TABLE elimination (Name VARCHAR, Wrestler_ID VARCHAR); CREATE TABLE wrestler (Name VARCHAR, Wrestler_ID VARCHAR) ###Answer: SELECT Name FROM wrestler WHERE NOT Wrestler_ID IN (SELECT Wrestler_ID FROM elimination)" "convert the question into postgresql query using the context values ### Question: Show the teams that have both wrestlers eliminated by ""Orton"" and wrestlers eliminated by ""Benjamin"". ### Context: CREATE TABLE Elimination (Team VARCHAR, Eliminated_By VARCHAR) ###Answer: SELECT Team FROM Elimination WHERE Eliminated_By = ""Orton"" INTERSECT SELECT Team FROM Elimination WHERE Eliminated_By = ""Benjamin""" "convert the question into postgresql query using the context values ### Question: What is the number of distinct teams that suffer elimination? ### Context: CREATE TABLE elimination (team VARCHAR) ###Answer: SELECT COUNT(DISTINCT team) FROM elimination" "convert the question into postgresql query using the context values ### Question: Show the times of elimination by ""Punk"" or ""Orton"". ### Context: CREATE TABLE elimination (TIME VARCHAR, Eliminated_By VARCHAR) ###Answer: SELECT TIME FROM elimination WHERE Eliminated_By = ""Punk"" OR Eliminated_By = ""Orton""" "convert the question into postgresql query using the context values ### Question: How many schools are there? ### Context: CREATE TABLE school (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM school" "convert the question into postgresql query using the context values ### Question: Show all school names in alphabetical order. ### Context: CREATE TABLE school (school_name VARCHAR) ###Answer: SELECT school_name FROM school ORDER BY school_name" "convert the question into postgresql query using the context values ### Question: List the name, location, mascot for all schools. ### Context: CREATE TABLE school (school_name VARCHAR, LOCATION VARCHAR, mascot VARCHAR) ###Answer: SELECT school_name, LOCATION, mascot FROM school" "convert the question into postgresql query using the context values ### Question: What are the total and average enrollment of all schools? ### Context: CREATE TABLE school (enrollment INTEGER) ###Answer: SELECT SUM(enrollment), AVG(enrollment) FROM school" "convert the question into postgresql query using the context values ### Question: What are the mascots for schools with enrollments above the average? ### Context: CREATE TABLE school (mascot VARCHAR, enrollment INTEGER) ###Answer: SELECT mascot FROM school WHERE enrollment > (SELECT AVG(enrollment) FROM school)" "convert the question into postgresql query using the context values ### Question: List the name of the school with the smallest enrollment. ### Context: CREATE TABLE school (school_name VARCHAR, enrollment VARCHAR) ###Answer: SELECT school_name FROM school ORDER BY enrollment LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the average, maximum, minimum enrollment of all schools. ### Context: CREATE TABLE school (enrollment INTEGER) ###Answer: SELECT AVG(enrollment), MAX(enrollment), MIN(enrollment) FROM school" "convert the question into postgresql query using the context values ### Question: Show each county along with the number of schools and total enrollment in each county. ### Context: CREATE TABLE school (county VARCHAR, enrollment INTEGER) ###Answer: SELECT county, COUNT(*), SUM(enrollment) FROM school GROUP BY county" "convert the question into postgresql query using the context values ### Question: How many donors have endowment for school named ""Glenn""? ### Context: CREATE TABLE school (school_id VARCHAR, school_name VARCHAR); CREATE TABLE endowment (donator_name VARCHAR, school_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT T1.donator_name) FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = ""Glenn""" "convert the question into postgresql query using the context values ### Question: List each donator name and the amount of endowment in descending order of the amount of endowment. ### Context: CREATE TABLE endowment (donator_name VARCHAR, amount INTEGER) ###Answer: SELECT donator_name, SUM(amount) FROM endowment GROUP BY donator_name ORDER BY SUM(amount) DESC" "convert the question into postgresql query using the context values ### Question: List the names of the schools without any endowment. ### Context: CREATE TABLE endowment (school_name VARCHAR, school_id VARCHAR); CREATE TABLE school (school_name VARCHAR, school_id VARCHAR) ###Answer: SELECT school_name FROM school WHERE NOT school_id IN (SELECT school_id FROM endowment)" "convert the question into postgresql query using the context values ### Question: List all the names of schools with an endowment amount smaller than or equal to 10. ### Context: CREATE TABLE school (school_name VARCHAR, school_id VARCHAR); CREATE TABLE endowment (school_id VARCHAR, amount INTEGER) ###Answer: SELECT T2.school_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T1.school_id HAVING SUM(T1.amount) <= 10" "convert the question into postgresql query using the context values ### Question: Show the names of donors who donated to both school ""Glenn"" and ""Triton."" ### Context: CREATE TABLE school (school_id VARCHAR, school_name VARCHAR); CREATE TABLE endowment (donator_name VARCHAR, school_id VARCHAR) ###Answer: SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn' INTERSECT SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Triton'" "convert the question into postgresql query using the context values ### Question: Show the names of all the donors except those whose donation amount less than 9. ### Context: CREATE TABLE endowment (donator_name VARCHAR, amount INTEGER) ###Answer: SELECT donator_name FROM endowment EXCEPT SELECT donator_name FROM endowment WHERE amount < 9" "convert the question into postgresql query using the context values ### Question: List the amount and donor name for the largest amount of donation. ### Context: CREATE TABLE endowment (amount VARCHAR, donator_name VARCHAR) ###Answer: SELECT amount, donator_name FROM endowment ORDER BY amount DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many budgets are above 3000 in year 2001 or before? ### Context: CREATE TABLE budget (budgeted VARCHAR, YEAR VARCHAR) ###Answer: SELECT COUNT(*) FROM budget WHERE budgeted > 3000 AND YEAR <= 2001" "convert the question into postgresql query using the context values ### Question: Show each school name, its budgeted amount, and invested amount in year 2002 or after. ### Context: CREATE TABLE budget (budgeted VARCHAR, invested VARCHAR, school_id VARCHAR, year VARCHAR); CREATE TABLE school (school_name VARCHAR, school_id VARCHAR) ###Answer: SELECT T2.school_name, T1.budgeted, T1.invested FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.year >= 2002" "convert the question into postgresql query using the context values ### Question: Show all donor names. ### Context: CREATE TABLE endowment (donator_name VARCHAR) ###Answer: SELECT DISTINCT donator_name FROM endowment" "convert the question into postgresql query using the context values ### Question: How many budget record has a budget amount smaller than the invested amount? ### Context: CREATE TABLE budget (budgeted INTEGER, invested VARCHAR) ###Answer: SELECT COUNT(*) FROM budget WHERE budgeted < invested" "convert the question into postgresql query using the context values ### Question: What is the total budget amount for school ""Glenn"" in all years? ### Context: CREATE TABLE budget (budgeted INTEGER, school_id VARCHAR); CREATE TABLE school (school_id VARCHAR, school_name VARCHAR) ###Answer: SELECT SUM(T1.budgeted) FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn'" "convert the question into postgresql query using the context values ### Question: Show the names of schools with a total budget amount greater than 100 or a total endowment greater than 10. ### Context: CREATE TABLE endowment (school_id VARCHAR, amount INTEGER); CREATE TABLE budget (school_id VARCHAR, budgeted INTEGER); CREATE TABLE school (school_name VARCHAR, school_id VARCHAR) ###Answer: SELECT T2.school_name FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN endowment AS T3 ON T2.school_id = T3.school_id GROUP BY T2.school_name HAVING SUM(T1.budgeted) > 100 OR SUM(T3.amount) > 10" "convert the question into postgresql query using the context values ### Question: Find the names of schools that have more than one donator with donation amount above 8.5. ### Context: CREATE TABLE school (School_name VARCHAR, school_id VARCHAR); CREATE TABLE endowment (school_id VARCHAR, amount INTEGER) ###Answer: SELECT T2.School_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.amount > 8.5 GROUP BY T1.school_id HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Find the number of schools that have more than one donator whose donation amount is less than 8.5. ### Context: CREATE TABLE endowment (school_id VARCHAR, amount INTEGER) ###Answer: SELECT COUNT(*) FROM (SELECT * FROM endowment WHERE amount > 8.5 GROUP BY school_id HAVING COUNT(*) > 1)" "convert the question into postgresql query using the context values ### Question: List the name, IHSAA Football Class, and Mascot of the schools that have more than 6000 of budgeted amount or were founded before 2003, in the order of percent of total invested budget and total budgeted budget. ### Context: CREATE TABLE school (School_name VARCHAR, Mascot VARCHAR, IHSAA_Football_Class VARCHAR, school_id VARCHAR); CREATE TABLE budget (school_id VARCHAR, total_budget_percent_invested VARCHAR, total_budget_percent_budgeted VARCHAR) ###Answer: SELECT T1.School_name, T1.Mascot, T1.IHSAA_Football_Class FROM school AS T1 JOIN budget AS T2 ON T1.school_id = T2.school_id WHERE Budgeted > 6000 OR YEAR < 2003 ORDER BY T2.total_budget_percent_invested, T2.total_budget_percent_budgeted" "convert the question into postgresql query using the context values ### Question: How many buildings are there? ### Context: CREATE TABLE building (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM building" "convert the question into postgresql query using the context values ### Question: Show the name, street address, and number of floors for all buildings ordered by the number of floors. ### Context: CREATE TABLE building (name VARCHAR, street_address VARCHAR, floors VARCHAR) ###Answer: SELECT name, street_address, floors FROM building ORDER BY floors" "convert the question into postgresql query using the context values ### Question: What is the name of the tallest building? ### Context: CREATE TABLE building (name VARCHAR, height_feet VARCHAR) ###Answer: SELECT name FROM building ORDER BY height_feet DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the average, maximum, and minimum number of floors for all buildings? ### Context: CREATE TABLE building (floors INTEGER) ###Answer: SELECT AVG(floors), MAX(floors), MIN(floors) FROM building" "convert the question into postgresql query using the context values ### Question: Show the number of buildings with a height above the average or a number of floors above the average. ### Context: CREATE TABLE building (height_feet INTEGER, floors INTEGER) ###Answer: SELECT COUNT(*) FROM building WHERE height_feet > (SELECT AVG(height_feet) FROM building) OR floors > (SELECT AVG(floors) FROM building)" "convert the question into postgresql query using the context values ### Question: List the names of buildings with at least 200 feet of height and with at least 20 floors. ### Context: CREATE TABLE building (name VARCHAR, height_feet VARCHAR, floors VARCHAR) ###Answer: SELECT name FROM building WHERE height_feet >= 200 AND floors >= 20" "convert the question into postgresql query using the context values ### Question: Show the names and locations of institutions that are founded after 1990 and have the type ""Private"". ### Context: CREATE TABLE institution (institution VARCHAR, LOCATION VARCHAR, founded VARCHAR, TYPE VARCHAR) ###Answer: SELECT institution, LOCATION FROM institution WHERE founded > 1990 AND TYPE = 'Private'" "convert the question into postgresql query using the context values ### Question: Show institution types, along with the number of institutions and total enrollment for each type. ### Context: CREATE TABLE institution (TYPE VARCHAR, enrollment INTEGER) ###Answer: SELECT TYPE, COUNT(*), SUM(enrollment) FROM institution GROUP BY TYPE" "convert the question into postgresql query using the context values ### Question: Show the institution type with the largest number of institutions. ### Context: CREATE TABLE institution (TYPE VARCHAR) ###Answer: SELECT TYPE FROM institution GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the institution type with an institution founded after 1990 and an institution with at least 1000 enrollment. ### Context: CREATE TABLE institution (TYPE VARCHAR, founded VARCHAR, enrollment VARCHAR) ###Answer: SELECT TYPE FROM institution WHERE founded > 1990 AND enrollment >= 1000" "convert the question into postgresql query using the context values ### Question: Show the name of buildings that do not have any institution. ### Context: CREATE TABLE building (name VARCHAR, building_id VARCHAR); CREATE TABLE institution (name VARCHAR, building_id VARCHAR) ###Answer: SELECT name FROM building WHERE NOT building_id IN (SELECT building_id FROM institution)" "convert the question into postgresql query using the context values ### Question: Show the names of buildings except for those having an institution founded in 2003. ### Context: CREATE TABLE building (name VARCHAR, building_id VARCHAR); CREATE TABLE building (name VARCHAR); CREATE TABLE institution (building_id VARCHAR, founded VARCHAR) ###Answer: SELECT name FROM building EXCEPT SELECT T1.name FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded = 2003" "convert the question into postgresql query using the context values ### Question: For each building, show the name of the building and the number of institutions in it. ### Context: CREATE TABLE building (name VARCHAR, building_id VARCHAR); CREATE TABLE institution (building_id VARCHAR) ###Answer: SELECT T1.name, COUNT(*) FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id" "convert the question into postgresql query using the context values ### Question: Show the names and heights of buildings with at least two institutions founded after 1880. ### Context: CREATE TABLE building (name VARCHAR, height_feet VARCHAR, building_id VARCHAR); CREATE TABLE institution (building_id VARCHAR, founded INTEGER) ###Answer: SELECT T1.name, T1.height_feet FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded > 1880 GROUP BY T1.building_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show all the distinct institution types. ### Context: CREATE TABLE institution (TYPE VARCHAR) ###Answer: SELECT DISTINCT TYPE FROM institution" "convert the question into postgresql query using the context values ### Question: Show institution names along with the number of proteins for each institution. ### Context: CREATE TABLE institution (institution VARCHAR, institution_id VARCHAR); CREATE TABLE protein (institution_id VARCHAR) ###Answer: SELECT T1.institution, COUNT(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id GROUP BY T1.institution_id" "convert the question into postgresql query using the context values ### Question: How many proteins are associated with an institution founded after 1880 or an institution with type ""Private""? ### Context: CREATE TABLE institution (institution_id VARCHAR, founded VARCHAR, type VARCHAR); CREATE TABLE protein (institution_id VARCHAR) ###Answer: SELECT COUNT(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id WHERE T1.founded > 1880 OR T1.type = 'Private'" "convert the question into postgresql query using the context values ### Question: Show the protein name and the institution name. ### Context: CREATE TABLE institution (institution VARCHAR, institution_id VARCHAR); CREATE TABLE protein (protein_name VARCHAR, institution_id VARCHAR) ###Answer: SELECT T2.protein_name, T1.institution FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id" "convert the question into postgresql query using the context values ### Question: How many proteins are associated with an institution in a building with at least 20 floors? ### Context: CREATE TABLE institution (institution_id VARCHAR, building_id VARCHAR); CREATE TABLE building (building_id VARCHAR, floors VARCHAR); CREATE TABLE protein (institution_id VARCHAR) ###Answer: SELECT COUNT(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id JOIN building AS T3 ON T3.building_id = T1.building_id WHERE T3.floors >= 20" "convert the question into postgresql query using the context values ### Question: How many institutions do not have an associated protein in our record? ### Context: CREATE TABLE protein (institution_id VARCHAR); CREATE TABLE institution (institution_id VARCHAR) ###Answer: SELECT COUNT(*) FROM institution WHERE NOT institution_id IN (SELECT institution_id FROM protein)" "convert the question into postgresql query using the context values ### Question: Show all the locations where no cinema has capacity over 800. ### Context: CREATE TABLE cinema (LOCATION VARCHAR, capacity INTEGER) ###Answer: SELECT LOCATION FROM cinema EXCEPT SELECT LOCATION FROM cinema WHERE capacity > 800" "convert the question into postgresql query using the context values ### Question: Show all the locations where some cinemas were opened in both year 2010 and year 2011. ### Context: CREATE TABLE cinema (LOCATION VARCHAR, openning_year VARCHAR) ###Answer: SELECT LOCATION FROM cinema WHERE openning_year = 2010 INTERSECT SELECT LOCATION FROM cinema WHERE openning_year = 2011" "convert the question into postgresql query using the context values ### Question: How many cinema do we have? ### Context: CREATE TABLE cinema (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM cinema" "convert the question into postgresql query using the context values ### Question: Show name, opening year, and capacity for each cinema. ### Context: CREATE TABLE cinema (name VARCHAR, openning_year VARCHAR, capacity VARCHAR) ###Answer: SELECT name, openning_year, capacity FROM cinema" "convert the question into postgresql query using the context values ### Question: Show the cinema name and location for cinemas with capacity above average. ### Context: CREATE TABLE cinema (name VARCHAR, LOCATION VARCHAR, capacity INTEGER) ###Answer: SELECT name, LOCATION FROM cinema WHERE capacity > (SELECT AVG(capacity) FROM cinema)" "convert the question into postgresql query using the context values ### Question: What are all the locations with a cinema? ### Context: CREATE TABLE cinema (LOCATION VARCHAR) ###Answer: SELECT DISTINCT LOCATION FROM cinema" "convert the question into postgresql query using the context values ### Question: Show all the cinema names and opening years in descending order of opening year. ### Context: CREATE TABLE cinema (name VARCHAR, openning_year VARCHAR) ###Answer: SELECT name, openning_year FROM cinema ORDER BY openning_year DESC" "convert the question into postgresql query using the context values ### Question: What are the name and location of the cinema with the largest capacity? ### Context: CREATE TABLE cinema (name VARCHAR, LOCATION VARCHAR, capacity VARCHAR) ###Answer: SELECT name, LOCATION FROM cinema ORDER BY capacity DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the average, minimum, and maximum capacity for all the cinemas opened in year 2011 or later. ### Context: CREATE TABLE cinema (capacity INTEGER, openning_year VARCHAR) ###Answer: SELECT AVG(capacity), MIN(capacity), MAX(capacity) FROM cinema WHERE openning_year >= 2011" "convert the question into postgresql query using the context values ### Question: Show each location and the number of cinemas there. ### Context: CREATE TABLE cinema (LOCATION VARCHAR) ###Answer: SELECT LOCATION, COUNT(*) FROM cinema GROUP BY LOCATION" "convert the question into postgresql query using the context values ### Question: What is the location with the most cinemas opened in year 2010 or later? ### Context: CREATE TABLE cinema (LOCATION VARCHAR, openning_year VARCHAR) ###Answer: SELECT LOCATION FROM cinema WHERE openning_year >= 2010 GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show all the locations with at least two cinemas with capacity above 300. ### Context: CREATE TABLE cinema (LOCATION VARCHAR, capacity INTEGER) ###Answer: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the title and director for all films. ### Context: CREATE TABLE film (title VARCHAR, directed_by VARCHAR) ###Answer: SELECT title, directed_by FROM film" "convert the question into postgresql query using the context values ### Question: Show all directors. ### Context: CREATE TABLE film (directed_by VARCHAR) ###Answer: SELECT DISTINCT directed_by FROM film" "convert the question into postgresql query using the context values ### Question: List all directors along with the number of films directed by each director. ### Context: CREATE TABLE film (directed_by VARCHAR) ###Answer: SELECT directed_by, COUNT(*) FROM film GROUP BY directed_by" "convert the question into postgresql query using the context values ### Question: What is total number of show times per dat for each cinema? ### Context: CREATE TABLE schedule (show_times_per_day INTEGER, cinema_id VARCHAR); CREATE TABLE cinema (name VARCHAR, cinema_id VARCHAR) ###Answer: SELECT T2.name, SUM(T1.show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.cinema_id = T2.cinema_id GROUP BY T1.cinema_id" "convert the question into postgresql query using the context values ### Question: What are the title and maximum price of each film? ### Context: CREATE TABLE film (title VARCHAR, film_id VARCHAR); CREATE TABLE schedule (price INTEGER, film_id VARCHAR) ###Answer: SELECT T2.title, MAX(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id" "convert the question into postgresql query using the context values ### Question: Show cinema name, film title, date, and price for each record in schedule. ### Context: CREATE TABLE schedule (date VARCHAR, price VARCHAR, film_id VARCHAR, cinema_id VARCHAR); CREATE TABLE cinema (name VARCHAR, cinema_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VARCHAR) ###Answer: SELECT T3.name, T2.title, T1.date, T1.price FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN cinema AS T3 ON T1.cinema_id = T3.cinema_id" "convert the question into postgresql query using the context values ### Question: What are the title and director of the films without any schedule? ### Context: CREATE TABLE schedule (title VARCHAR, directed_by VARCHAR, film_id VARCHAR); CREATE TABLE film (title VARCHAR, directed_by VARCHAR, film_id VARCHAR) ###Answer: SELECT title, directed_by FROM film WHERE NOT film_id IN (SELECT film_id FROM schedule)" "convert the question into postgresql query using the context values ### Question: Show director with the largest number of show times in total. ### Context: CREATE TABLE schedule (film_id VARCHAR, show_times_per_day INTEGER); CREATE TABLE film (directed_by VARCHAR, film_id VARCHAR) ###Answer: SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.directed_by ORDER BY SUM(T1.show_times_per_day) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the locations that have more than one movie theater with capacity above 300. ### Context: CREATE TABLE cinema (LOCATION VARCHAR, capacity INTEGER) ###Answer: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: How many films have the word 'Dummy' in their titles? ### Context: CREATE TABLE film (title VARCHAR) ###Answer: SELECT COUNT(*) FROM film WHERE title LIKE ""%Dummy%""" "convert the question into postgresql query using the context values ### Question: Are the customers holding coupons with amount 500 bad or good? ### Context: CREATE TABLE discount_coupons (coupon_id VARCHAR, coupon_amount VARCHAR); CREATE TABLE customers (good_or_bad_customer VARCHAR, coupon_id VARCHAR) ###Answer: SELECT T1.good_or_bad_customer FROM customers AS T1 JOIN discount_coupons AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.coupon_amount = 500" "convert the question into postgresql query using the context values ### Question: How many bookings did each customer make? List the customer id, first name, and the count. ### Context: CREATE TABLE bookings (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR) ###Answer: SELECT T1.customer_id, T1.first_name, COUNT(*) FROM Customers AS T1 JOIN bookings AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id" "convert the question into postgresql query using the context values ### Question: What is the maximum total amount paid by a customer? List the customer id and amount. ### Context: CREATE TABLE Payments (customer_id VARCHAR, amount_paid INTEGER) ###Answer: SELECT customer_id, SUM(amount_paid) FROM Payments GROUP BY customer_id ORDER BY SUM(amount_paid) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the id and the amount of refund of the booking that incurred the most times of payments? ### Context: CREATE TABLE Payments (booking_id VARCHAR); CREATE TABLE Bookings (booking_id VARCHAR, amount_of_refund VARCHAR) ###Answer: SELECT T1.booking_id, T1.amount_of_refund FROM Bookings AS T1 JOIN Payments AS T2 ON T1.booking_id = T2.booking_id GROUP BY T1.booking_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the id of the product that is booked for 3 times? ### Context: CREATE TABLE products_booked (product_id VARCHAR) ###Answer: SELECT product_id FROM products_booked GROUP BY product_id HAVING COUNT(*) = 3" "convert the question into postgresql query using the context values ### Question: What is the product description of the product booked with an amount of 102.76? ### Context: CREATE TABLE products_for_hire (product_description VARCHAR, product_id VARCHAR); CREATE TABLE products_booked (product_id VARCHAR, booked_amount VARCHAR) ###Answer: SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = 102.76" "convert the question into postgresql query using the context values ### Question: What are the start date and end date of the booking that has booked the product named 'Book collection A'? ### Context: CREATE TABLE bookings (booking_start_date VARCHAR, booking_end_date VARCHAR, booking_id VARCHAR); CREATE TABLE products_booked (product_id VARCHAR, booking_id VARCHAR); CREATE TABLE Products_for_hire (product_id VARCHAR, product_name VARCHAR) ###Answer: SELECT T3.booking_start_date, T3.booking_end_date FROM Products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id = T2.product_id JOIN bookings AS T3 ON T2.booking_id = T3.booking_id WHERE T1.product_name = 'Book collection A'" "convert the question into postgresql query using the context values ### Question: What are the names of products whose availability equals to 1? ### Context: CREATE TABLE view_product_availability (product_id VARCHAR, available_yn VARCHAR); CREATE TABLE products_for_hire (product_name VARCHAR, product_id VARCHAR) ###Answer: SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.available_yn = 1" "convert the question into postgresql query using the context values ### Question: How many different product types are there? ### Context: CREATE TABLE products_for_hire (product_type_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT product_type_code) FROM products_for_hire" "convert the question into postgresql query using the context values ### Question: What are the first name, last name, and gender of all the good customers? Order by their last name. ### Context: CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, gender_mf VARCHAR, good_or_bad_customer VARCHAR) ###Answer: SELECT first_name, last_name, gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name" "convert the question into postgresql query using the context values ### Question: What is the average amount due for all the payments? ### Context: CREATE TABLE payments (amount_due INTEGER) ###Answer: SELECT AVG(amount_due) FROM payments" "convert the question into postgresql query using the context values ### Question: What are the maximum, minimum, and average booked count for the products booked? ### Context: CREATE TABLE products_booked (booked_count INTEGER) ###Answer: SELECT MAX(booked_count), MIN(booked_count), AVG(booked_count) FROM products_booked" "convert the question into postgresql query using the context values ### Question: What are all the distinct payment types? ### Context: CREATE TABLE payments (payment_type_code VARCHAR) ###Answer: SELECT DISTINCT payment_type_code FROM payments" "convert the question into postgresql query using the context values ### Question: What are the daily hire costs for the products with substring 'Book' in its name? ### Context: CREATE TABLE Products_for_hire (daily_hire_cost VARCHAR, product_name VARCHAR) ###Answer: SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%'" "convert the question into postgresql query using the context values ### Question: How many products are never booked with amount higher than 200? ### Context: CREATE TABLE products_booked (product_id VARCHAR, booked_amount INTEGER); CREATE TABLE Products_for_hire (product_id VARCHAR, booked_amount INTEGER) ###Answer: SELECT COUNT(*) FROM Products_for_hire WHERE NOT product_id IN (SELECT product_id FROM products_booked WHERE booked_amount > 200)" "convert the question into postgresql query using the context values ### Question: What are the coupon amount of the coupons owned by both good and bad customers? ### Context: CREATE TABLE Discount_Coupons (coupon_amount VARCHAR, coupon_id VARCHAR); CREATE TABLE customers (coupon_id VARCHAR, good_or_bad_customer VARCHAR) ###Answer: SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'" "convert the question into postgresql query using the context values ### Question: What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check' ### Context: CREATE TABLE payments (payment_date VARCHAR, amount_paid VARCHAR, payment_type_code VARCHAR) ###Answer: SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'" "convert the question into postgresql query using the context values ### Question: What are the names and descriptions of the products that are of 'Cutlery' type and have daily hire cost lower than 20? ### Context: CREATE TABLE products_for_hire (product_name VARCHAR, product_description VARCHAR, product_type_code VARCHAR, daily_hire_cost VARCHAR) ###Answer: SELECT product_name, product_description FROM products_for_hire WHERE product_type_code = 'Cutlery' AND daily_hire_cost < 20" "convert the question into postgresql query using the context values ### Question: How many phones are there? ### Context: CREATE TABLE phone (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM phone" "convert the question into postgresql query using the context values ### Question: List the names of phones in ascending order of price. ### Context: CREATE TABLE phone (Name VARCHAR, Price VARCHAR) ###Answer: SELECT Name FROM phone ORDER BY Price" "convert the question into postgresql query using the context values ### Question: What are the memories and carriers of phones? ### Context: CREATE TABLE phone (Memory_in_G VARCHAR, Carrier VARCHAR) ###Answer: SELECT Memory_in_G, Carrier FROM phone" "convert the question into postgresql query using the context values ### Question: List the distinct carriers of phones with memories bigger than 32. ### Context: CREATE TABLE phone (Carrier VARCHAR, Memory_in_G INTEGER) ###Answer: SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G > 32" "convert the question into postgresql query using the context values ### Question: Show the names of phones with carrier either ""Sprint"" or ""TMobile"". ### Context: CREATE TABLE phone (Name VARCHAR, Carrier VARCHAR) ###Answer: SELECT Name FROM phone WHERE Carrier = ""Sprint"" OR Carrier = ""TMobile""" "convert the question into postgresql query using the context values ### Question: What is the carrier of the most expensive phone? ### Context: CREATE TABLE phone (Carrier VARCHAR, Price VARCHAR) ###Answer: SELECT Carrier FROM phone ORDER BY Price DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show different carriers of phones together with the number of phones with each carrier. ### Context: CREATE TABLE phone (Carrier VARCHAR) ###Answer: SELECT Carrier, COUNT(*) FROM phone GROUP BY Carrier" "convert the question into postgresql query using the context values ### Question: Show the most frequently used carrier of the phones. ### Context: CREATE TABLE phone (Carrier VARCHAR) ###Answer: SELECT Carrier FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64. ### Context: CREATE TABLE phone (Carrier VARCHAR, Memory_in_G INTEGER) ###Answer: SELECT Carrier FROM phone WHERE Memory_in_G < 32 INTERSECT SELECT Carrier FROM phone WHERE Memory_in_G > 64" "convert the question into postgresql query using the context values ### Question: Show the names of phones and the districts of markets they are on. ### Context: CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE market (District VARCHAR, Market_ID VARCHAR); CREATE TABLE phone_market (Market_ID VARCHAR, Phone_ID VARCHAR) ###Answer: SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID" "convert the question into postgresql query using the context values ### Question: Show the names of phones and the districts of markets they are on, in ascending order of the ranking of the market. ### Context: CREATE TABLE market (District VARCHAR, Market_ID VARCHAR, Ranking VARCHAR); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Market_ID VARCHAR, Phone_ID VARCHAR) ###Answer: SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID ORDER BY T2.Ranking" "convert the question into postgresql query using the context values ### Question: Show the names of phones that are on market with number of shops greater than 50. ### Context: CREATE TABLE market (Market_ID VARCHAR, Num_of_shops INTEGER); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Market_ID VARCHAR, Phone_ID VARCHAR) ###Answer: SELECT T3.Name FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID WHERE T2.Num_of_shops > 50" "convert the question into postgresql query using the context values ### Question: For each phone, show its names and total number of stocks. ### Context: CREATE TABLE phone_market (Num_of_stock INTEGER, Phone_ID VARCHAR); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR) ###Answer: SELECT T2.Name, SUM(T1.Num_of_stock) FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name" "convert the question into postgresql query using the context values ### Question: Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks. ### Context: CREATE TABLE phone_market (Phone_ID VARCHAR, Num_of_stock INTEGER); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR) ###Answer: SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name HAVING SUM(T1.Num_of_stock) >= 2000 ORDER BY SUM(T1.Num_of_stock) DESC" "convert the question into postgresql query using the context values ### Question: List the names of phones that are not on any market. ### Context: CREATE TABLE phone (Name VARCHAR, Phone_id VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Name VARCHAR, Phone_id VARCHAR, Phone_ID VARCHAR) ###Answer: SELECT Name FROM phone WHERE NOT Phone_id IN (SELECT Phone_ID FROM phone_market)" "convert the question into postgresql query using the context values ### Question: How many gas companies are there? ### Context: CREATE TABLE company (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM company" "convert the question into postgresql query using the context values ### Question: List the company name and rank for all companies in the decreasing order of their sales. ### Context: CREATE TABLE company (company VARCHAR, rank VARCHAR, Sales_billion VARCHAR) ###Answer: SELECT company, rank FROM company ORDER BY Sales_billion DESC" "convert the question into postgresql query using the context values ### Question: Show the company name and the main industry for all companies whose headquarters are not from USA. ### Context: CREATE TABLE company (company VARCHAR, main_industry VARCHAR, headquarters VARCHAR) ###Answer: SELECT company, main_industry FROM company WHERE headquarters <> 'USA'" "convert the question into postgresql query using the context values ### Question: Show all company names and headquarters in the descending order of market value. ### Context: CREATE TABLE company (company VARCHAR, headquarters VARCHAR, market_value VARCHAR) ###Answer: SELECT company, headquarters FROM company ORDER BY market_value DESC" "convert the question into postgresql query using the context values ### Question: Show minimum, maximum, and average market value for all companies. ### Context: CREATE TABLE company (market_value INTEGER) ###Answer: SELECT MIN(market_value), MAX(market_value), AVG(market_value) FROM company" "convert the question into postgresql query using the context values ### Question: Show all main industry for all companies. ### Context: CREATE TABLE company (main_industry VARCHAR) ###Answer: SELECT DISTINCT main_industry FROM company" "convert the question into postgresql query using the context values ### Question: List all headquarters and the number of companies in each headquarter. ### Context: CREATE TABLE company (headquarters VARCHAR) ###Answer: SELECT headquarters, COUNT(*) FROM company GROUP BY headquarters" "convert the question into postgresql query using the context values ### Question: Show all main industry and total market value in each industry. ### Context: CREATE TABLE company (main_industry VARCHAR, market_value INTEGER) ###Answer: SELECT main_industry, SUM(market_value) FROM company GROUP BY main_industry" "convert the question into postgresql query using the context values ### Question: List the main industry with highest total market value and its number of companies. ### Context: CREATE TABLE company (main_industry VARCHAR, market_value INTEGER) ###Answer: SELECT main_industry, COUNT(*) FROM company GROUP BY main_industry ORDER BY SUM(market_value) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show headquarters with at least two companies in the banking industry. ### Context: CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR) ###Answer: SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show gas station id, location, and manager_name for all gas stations ordered by open year. ### Context: CREATE TABLE gas_station (station_id VARCHAR, LOCATION VARCHAR, manager_name VARCHAR, open_year VARCHAR) ###Answer: SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year" "convert the question into postgresql query using the context values ### Question: How many gas station are opened between 2000 and 2005? ### Context: CREATE TABLE gas_station (open_year INTEGER) ###Answer: SELECT COUNT(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005" "convert the question into postgresql query using the context values ### Question: Show all locations and the number of gas stations in each location ordered by the count. ### Context: CREATE TABLE gas_station (LOCATION VARCHAR) ###Answer: SELECT LOCATION, COUNT(*) FROM gas_station GROUP BY LOCATION ORDER BY COUNT(*)" "convert the question into postgresql query using the context values ### Question: Show all headquarters with both a company in banking industry and a company in Oil and gas. ### Context: CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR) ###Answer: SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'" "convert the question into postgresql query using the context values ### Question: Show all headquarters without a company in banking industry. ### Context: CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR) ###Answer: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'" "convert the question into postgresql query using the context values ### Question: Show the company name with the number of gas station. ### Context: CREATE TABLE station_company (company_id VARCHAR); CREATE TABLE company (company VARCHAR, company_id VARCHAR) ###Answer: SELECT T2.company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id" "convert the question into postgresql query using the context values ### Question: Show company name and main industry without a gas station. ### Context: CREATE TABLE station_company (company VARCHAR, main_industry VARCHAR, company_id VARCHAR); CREATE TABLE company (company VARCHAR, main_industry VARCHAR, company_id VARCHAR) ###Answer: SELECT company, main_industry FROM company WHERE NOT company_id IN (SELECT company_id FROM station_company)" "convert the question into postgresql query using the context values ### Question: Show the manager name for gas stations belonging to the ExxonMobil company. ### Context: CREATE TABLE gas_station (manager_name VARCHAR, station_id VARCHAR); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, company VARCHAR) ###Answer: SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil'" "convert the question into postgresql query using the context values ### Question: Show all locations where a gas station for company with market value greater than 100 is located. ### Context: CREATE TABLE gas_station (location VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, market_value INTEGER); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR) ###Answer: SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100" "convert the question into postgresql query using the context values ### Question: Show the manager name with most number of gas stations opened after 2000. ### Context: CREATE TABLE gas_station (manager_name VARCHAR, open_year INTEGER) ###Answer: SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: order all gas station locations by the opening year. ### Context: CREATE TABLE gas_station (LOCATION VARCHAR, open_year VARCHAR) ###Answer: SELECT LOCATION FROM gas_station ORDER BY open_year" "convert the question into postgresql query using the context values ### Question: find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion. ### Context: CREATE TABLE company (rank VARCHAR, company VARCHAR, market_value VARCHAR, main_industry VARCHAR, sales_billion VARCHAR, profits_billion VARCHAR) ###Answer: SELECT rank, company, market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion, profits_billion" "convert the question into postgresql query using the context values ### Question: find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts. ### Context: CREATE TABLE gas_station (location VARCHAR, Representative_Name VARCHAR, station_id VARCHAR); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, Assets_billion VARCHAR) ###Answer: SELECT T3.location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: How many regions do we have? ### Context: CREATE TABLE region (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM region" "convert the question into postgresql query using the context values ### Question: Show all distinct region names ordered by their labels. ### Context: CREATE TABLE region (region_name VARCHAR, Label VARCHAR) ###Answer: SELECT DISTINCT region_name FROM region ORDER BY Label" "convert the question into postgresql query using the context values ### Question: How many parties do we have? ### Context: CREATE TABLE party (party_name VARCHAR) ###Answer: SELECT COUNT(DISTINCT party_name) FROM party" "convert the question into postgresql query using the context values ### Question: Show the ministers and the time they took and left office, listed by the time they left office. ### Context: CREATE TABLE party (minister VARCHAR, took_office VARCHAR, left_office VARCHAR) ###Answer: SELECT minister, took_office, left_office FROM party ORDER BY left_office" "convert the question into postgresql query using the context values ### Question: Show the minister who took office after 1961 or before 1959. ### Context: CREATE TABLE party (minister VARCHAR, took_office VARCHAR) ###Answer: SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959" "convert the question into postgresql query using the context values ### Question: Show all ministers who do not belong to Progress Party. ### Context: CREATE TABLE party (minister VARCHAR, party_name VARCHAR) ###Answer: SELECT minister FROM party WHERE party_name <> 'Progress Party'" "convert the question into postgresql query using the context values ### Question: Show all ministers and parties they belong to in descending order of the time they took office. ### Context: CREATE TABLE party (minister VARCHAR, party_name VARCHAR, took_office VARCHAR) ###Answer: SELECT minister, party_name FROM party ORDER BY took_office DESC" "convert the question into postgresql query using the context values ### Question: Return the minister who left office at the latest time. ### Context: CREATE TABLE party (minister VARCHAR, left_office VARCHAR) ###Answer: SELECT minister FROM party ORDER BY left_office DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List member names and their party names. ### Context: CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (member_name VARCHAR, party_id VARCHAR) ###Answer: SELECT T1.member_name, T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id" "convert the question into postgresql query using the context values ### Question: Show all party names and the number of members in each party. ### Context: CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_id VARCHAR) ###Answer: SELECT T2.party_name, COUNT(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id" "convert the question into postgresql query using the context values ### Question: What is the name of party with most number of members? ### Context: CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_id VARCHAR) ###Answer: SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show all party names and their region names. ### Context: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE party (party_name VARCHAR, region_id VARCHAR) ###Answer: SELECT T1.party_name, T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id" "convert the question into postgresql query using the context values ### Question: Show names of parties that does not have any members. ### Context: CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_name VARCHAR, party_id VARCHAR) ###Answer: SELECT party_name FROM party WHERE NOT party_id IN (SELECT party_id FROM Member)" "convert the question into postgresql query using the context values ### Question: Show the member names which are in both the party with id 3 and the party with id 1. ### Context: CREATE TABLE member (member_name VARCHAR, party_id VARCHAR) ###Answer: SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1" "convert the question into postgresql query using the context values ### Question: Show member names that are not in the Progress Party. ### Context: CREATE TABLE party (party_id VARCHAR, Party_name VARCHAR); CREATE TABLE Member (member_name VARCHAR, party_id VARCHAR) ###Answer: SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name <> ""Progress Party""" "convert the question into postgresql query using the context values ### Question: How many party events do we have? ### Context: CREATE TABLE party_events (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM party_events" "convert the question into postgresql query using the context values ### Question: Show party names and the number of events for each party. ### Context: CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE party_events (party_id VARCHAR) ###Answer: SELECT T2.party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id" "convert the question into postgresql query using the context values ### Question: Show all member names who are not in charge of any event. ### Context: CREATE TABLE member (member_name VARCHAR); CREATE TABLE party_events (member_in_charge_id VARCHAR); CREATE TABLE member (member_name VARCHAR, member_id VARCHAR) ###Answer: SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id" "convert the question into postgresql query using the context values ### Question: What are the names of parties with at least 2 events? ### Context: CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE party_events (party_id VARCHAR) ###Answer: SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What is the name of member in charge of greatest number of events? ### Context: CREATE TABLE party_events (member_in_charge_id VARCHAR); CREATE TABLE member (member_name VARCHAR, member_id VARCHAR) ###Answer: SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: find the event names that have more than 2 records. ### Context: CREATE TABLE party_events (event_name VARCHAR) ###Answer: SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: How many Annual Meeting events happened in the United Kingdom region? ### Context: CREATE TABLE party_events (party_id VARCHAR, Event_Name VARCHAR); CREATE TABLE region (region_id VARCHAR, region_name VARCHAR); CREATE TABLE party (region_id VARCHAR, party_id VARCHAR) ###Answer: SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = ""United Kingdom"" AND t3.Event_Name = ""Annaual Meeting""" "convert the question into postgresql query using the context values ### Question: How many pilots are there? ### Context: CREATE TABLE pilot (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM pilot" "convert the question into postgresql query using the context values ### Question: List the names of pilots in ascending order of rank. ### Context: CREATE TABLE pilot (Pilot_name VARCHAR, Rank VARCHAR) ###Answer: SELECT Pilot_name FROM pilot ORDER BY Rank" "convert the question into postgresql query using the context values ### Question: What are the positions and teams of pilots? ### Context: CREATE TABLE pilot (POSITION VARCHAR, Team VARCHAR) ###Answer: SELECT POSITION, Team FROM pilot" "convert the question into postgresql query using the context values ### Question: List the distinct positions of pilots older than 30. ### Context: CREATE TABLE pilot (POSITION VARCHAR, Age INTEGER) ###Answer: SELECT DISTINCT POSITION FROM pilot WHERE Age > 30" "convert the question into postgresql query using the context values ### Question: Show the names of pilots from team ""Bradley"" or ""Fordham"". ### Context: CREATE TABLE pilot (Pilot_name VARCHAR, Team VARCHAR) ###Answer: SELECT Pilot_name FROM pilot WHERE Team = ""Bradley"" OR Team = ""Fordham""" "convert the question into postgresql query using the context values ### Question: What is the joined year of the pilot of the highest rank? ### Context: CREATE TABLE pilot (Join_Year VARCHAR, Rank VARCHAR) ###Answer: SELECT Join_Year FROM pilot ORDER BY Rank LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality. ### Context: CREATE TABLE pilot (Nationality VARCHAR) ###Answer: SELECT Nationality, COUNT(*) FROM pilot GROUP BY Nationality" "convert the question into postgresql query using the context values ### Question: Show the most common nationality of pilots. ### Context: CREATE TABLE pilot (Nationality VARCHAR) ###Answer: SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000. ### Context: CREATE TABLE pilot (POSITION VARCHAR, Join_Year INTEGER) ###Answer: SELECT POSITION FROM pilot WHERE Join_Year < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year > 2005" "convert the question into postgresql query using the context values ### Question: Show the names of pilots and models of aircrafts they have flied with. ### Context: CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR); CREATE TABLE aircraft (Model VARCHAR, Aircraft_ID VARCHAR) ###Answer: SELECT T3.Pilot_name, T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID" "convert the question into postgresql query using the context values ### Question: Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot. ### Context: CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR, Rank VARCHAR); CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE aircraft (Fleet_Series VARCHAR, Aircraft_ID VARCHAR) ###Answer: SELECT T3.Pilot_name, T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank" "convert the question into postgresql query using the context values ### Question: Show the fleet series of the aircrafts flied by pilots younger than 34 ### Context: CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_ID VARCHAR, Age INTEGER); CREATE TABLE aircraft (Fleet_Series VARCHAR, Aircraft_ID VARCHAR) ###Answer: SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34" "convert the question into postgresql query using the context values ### Question: Show the names of pilots and the number of records they have. ### Context: CREATE TABLE pilot (Pilot_name VARCHAR, pilot_ID VARCHAR); CREATE TABLE pilot_record (pilot_ID VARCHAR) ###Answer: SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name" "convert the question into postgresql query using the context values ### Question: Show names of pilots that have more than one record. ### Context: CREATE TABLE pilot (Pilot_name VARCHAR, pilot_ID VARCHAR); CREATE TABLE pilot_record (pilot_ID VARCHAR) ###Answer: SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: List the names of pilots that do not have any record. ### Context: CREATE TABLE pilot_record (Pilot_name VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR) ###Answer: SELECT Pilot_name FROM pilot WHERE NOT Pilot_ID IN (SELECT Pilot_ID FROM pilot_record)" "convert the question into postgresql query using the context values ### Question: What document status codes do we have? ### Context: CREATE TABLE Ref_Document_Status (document_status_code VARCHAR) ###Answer: SELECT document_status_code FROM Ref_Document_Status" "convert the question into postgresql query using the context values ### Question: What is the description of document status code 'working'? ### Context: CREATE TABLE Ref_Document_Status (document_status_description VARCHAR, document_status_code VARCHAR) ###Answer: SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = ""working""" "convert the question into postgresql query using the context values ### Question: What document type codes do we have? ### Context: CREATE TABLE Ref_Document_Types (document_type_code VARCHAR) ###Answer: SELECT document_type_code FROM Ref_Document_Types" "convert the question into postgresql query using the context values ### Question: What is the description of document type 'Paper'? ### Context: CREATE TABLE Ref_Document_Types (document_type_description VARCHAR, document_type_code VARCHAR) ###Answer: SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = ""Paper""" "convert the question into postgresql query using the context values ### Question: What are the shipping agent names? ### Context: CREATE TABLE Ref_Shipping_Agents (shipping_agent_name VARCHAR) ###Answer: SELECT shipping_agent_name FROM Ref_Shipping_Agents" "convert the question into postgresql query using the context values ### Question: What is the shipping agent code of shipping agent UPS? ### Context: CREATE TABLE Ref_Shipping_Agents (shipping_agent_code VARCHAR, shipping_agent_name VARCHAR) ###Answer: SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = ""UPS""" "convert the question into postgresql query using the context values ### Question: What are all role codes? ### Context: CREATE TABLE ROLES (role_code VARCHAR) ###Answer: SELECT role_code FROM ROLES" "convert the question into postgresql query using the context values ### Question: What is the description of role code ED? ### Context: CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR) ###Answer: SELECT role_description FROM ROLES WHERE role_code = ""ED""" "convert the question into postgresql query using the context values ### Question: How many employees do we have? ### Context: CREATE TABLE Employees (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Employees" "convert the question into postgresql query using the context values ### Question: What is the role of the employee named Koby? ### Context: CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR); CREATE TABLE Employees (role_code VARCHAR, employee_name VARCHAR) ###Answer: SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = ""Koby""" "convert the question into postgresql query using the context values ### Question: List all document ids and receipt dates of documents. ### Context: CREATE TABLE Documents (document_id VARCHAR, receipt_date VARCHAR) ###Answer: SELECT document_id, receipt_date FROM Documents" "convert the question into postgresql query using the context values ### Question: How many employees does each role have? List role description, id and number of employees. ### Context: CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR); CREATE TABLE Employees (role_code VARCHAR) ###Answer: SELECT T1.role_description, T2.role_code, COUNT(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code" "convert the question into postgresql query using the context values ### Question: List roles that have more than one employee. List the role description and number of employees. ### Context: CREATE TABLE ROLES (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR) ###Answer: SELECT Roles.role_description, COUNT(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING COUNT(Employees.employee_id) > 1" "convert the question into postgresql query using the context values ### Question: What is the document status description of the document with id 1? ### Context: CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Document_Status (Id VARCHAR) ###Answer: SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1" "convert the question into postgresql query using the context values ### Question: How many documents have the status code done? ### Context: CREATE TABLE Documents (document_status_code VARCHAR) ###Answer: SELECT COUNT(*) FROM Documents WHERE document_status_code = ""done""" "convert the question into postgresql query using the context values ### Question: List the document type code for the document with the id 2. ### Context: CREATE TABLE Documents (document_type_code VARCHAR, document_id VARCHAR) ###Answer: SELECT document_type_code FROM Documents WHERE document_id = 2" "convert the question into postgresql query using the context values ### Question: List the document ids for any documents with the status code done and the type code paper. ### Context: CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR) ###Answer: SELECT document_id FROM Documents WHERE document_status_code = ""done"" AND document_type_code = ""Paper""" "convert the question into postgresql query using the context values ### Question: What is the name of the shipping agent of the document with id 2? ### Context: CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR) ###Answer: SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2" "convert the question into postgresql query using the context values ### Question: How many documents were shipped by USPS? ### Context: CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = ""USPS""" "convert the question into postgresql query using the context values ### Question: Which shipping agent shipped the most documents? List the shipping agent name and the number of documents. ### Context: CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR) ###Answer: SELECT Ref_Shipping_Agents.shipping_agent_name, COUNT(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code ORDER BY COUNT(Documents.document_id) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the receipt date of the document with id 3? ### Context: CREATE TABLE Documents (receipt_date VARCHAR, document_id VARCHAR) ###Answer: SELECT receipt_date FROM Documents WHERE document_id = 3" "convert the question into postgresql query using the context values ### Question: What address was the document with id 4 mailed to? ### Context: CREATE TABLE Addresses (document_id VARCHAR); CREATE TABLE Documents_Mailed (document_id VARCHAR) ###Answer: SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4" "convert the question into postgresql query using the context values ### Question: What is the mail date of the document with id 7? ### Context: CREATE TABLE Documents_Mailed (mailing_date VARCHAR, document_id VARCHAR) ###Answer: SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7" "convert the question into postgresql query using the context values ### Question: List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS. ### Context: CREATE TABLE Ref_Shipping_Agents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR) ###Answer: SELECT document_id FROM Documents WHERE document_status_code = ""done"" AND document_type_code = ""Paper"" EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = ""USPS""" "convert the question into postgresql query using the context values ### Question: List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS. ### Context: CREATE TABLE Ref_Shipping_Agents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR) ###Answer: SELECT document_id FROM Documents WHERE document_status_code = ""done"" AND document_type_code = ""Paper"" INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = ""USPS""" "convert the question into postgresql query using the context values ### Question: What is draft detail of the document with id 7? ### Context: CREATE TABLE Document_Drafts (draft_details VARCHAR, document_id VARCHAR) ###Answer: SELECT draft_details FROM Document_Drafts WHERE document_id = 7" "convert the question into postgresql query using the context values ### Question: How many draft copies does the document with id 2 have? ### Context: CREATE TABLE Draft_Copies (document_id VARCHAR) ###Answer: SELECT COUNT(*) FROM Draft_Copies WHERE document_id = 2" "convert the question into postgresql query using the context values ### Question: Which document has the most draft copies? List its document id and number of draft copies. ### Context: CREATE TABLE Draft_Copies (document_id VARCHAR, copy_number VARCHAR) ###Answer: SELECT document_id, COUNT(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY COUNT(copy_number) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which documents have more than 1 draft copies? List document id and number of draft copies. ### Context: CREATE TABLE Draft_Copies (document_id VARCHAR) ###Answer: SELECT document_id, COUNT(*) FROM Draft_Copies GROUP BY document_id HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: List all employees in the circulation history of the document with id 1. List the employee's name. ### Context: CREATE TABLE Circulation_History (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR) ###Answer: SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1" "convert the question into postgresql query using the context values ### Question: List the employees who have not showed up in any circulation history of documents. List the employee's name. ### Context: CREATE TABLE Circulation_History (employee_name VARCHAR); CREATE TABLE Employees (employee_name VARCHAR) ###Answer: SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id" "convert the question into postgresql query using the context values ### Question: Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies. ### Context: CREATE TABLE Circulation_History (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR) ###Answer: SELECT Employees.employee_name, COUNT(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id, Circulation_History.draft_number, Circulation_History.copy_number ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees. ### Context: CREATE TABLE Circulation_History (document_id VARCHAR, employee_id VARCHAR) ###Answer: SELECT document_id, COUNT(DISTINCT employee_id) FROM Circulation_History GROUP BY document_id" "convert the question into postgresql query using the context values ### Question: List all department names ordered by their starting date. ### Context: CREATE TABLE department (dname VARCHAR, mgr_start_date VARCHAR) ###Answer: SELECT dname FROM department ORDER BY mgr_start_date" "convert the question into postgresql query using the context values ### Question: find all dependent names who have a spouse relation with some employee. ### Context: CREATE TABLE dependent (Dependent_name VARCHAR, relationship VARCHAR) ###Answer: SELECT Dependent_name FROM dependent WHERE relationship = 'Spouse'" "convert the question into postgresql query using the context values ### Question: how many female dependents are there? ### Context: CREATE TABLE dependent (sex VARCHAR) ###Answer: SELECT COUNT(*) FROM dependent WHERE sex = 'F'" "convert the question into postgresql query using the context values ### Question: Find the names of departments that are located in Houston. ### Context: CREATE TABLE dept_locations (dnumber VARCHAR, dlocation VARCHAR); CREATE TABLE department (dname VARCHAR, dnumber VARCHAR) ###Answer: SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston'" "convert the question into postgresql query using the context values ### Question: Return the first names and last names of employees who earn more than 30000 in salary. ### Context: CREATE TABLE employee (fname VARCHAR, lname VARCHAR, salary INTEGER) ###Answer: SELECT fname, lname FROM employee WHERE salary > 30000" "convert the question into postgresql query using the context values ### Question: Find the number of employees of each gender whose salary is lower than 50000. ### Context: CREATE TABLE employee (sex VARCHAR, salary INTEGER) ###Answer: SELECT COUNT(*), sex FROM employee WHERE salary < 50000 GROUP BY sex" "convert the question into postgresql query using the context values ### Question: list the first and last names, and the addresses of all employees in the ascending order of their birth date. ### Context: CREATE TABLE employee (fname VARCHAR, lname VARCHAR, address VARCHAR, Bdate VARCHAR) ###Answer: SELECT fname, lname, address FROM employee ORDER BY Bdate" "convert the question into postgresql query using the context values ### Question: what are the event details of the services that have the type code 'Marriage'? ### Context: CREATE TABLE EVENTS (event_details VARCHAR, Service_ID VARCHAR); CREATE TABLE Services (Service_ID VARCHAR, Service_Type_Code VARCHAR) ###Answer: SELECT T1.event_details FROM EVENTS AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage'" "convert the question into postgresql query using the context values ### Question: What are the ids and details of events that have more than one participants? ### Context: CREATE TABLE EVENTS (event_id VARCHAR, event_details VARCHAR, Event_ID VARCHAR); CREATE TABLE Participants_in_Events (Event_ID VARCHAR) ###Answer: SELECT T1.event_id, T1.event_details FROM EVENTS AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_ID HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: How many events have each participants attended? List the participant id, type and the number. ### Context: CREATE TABLE Participants (Participant_ID VARCHAR, Participant_Type_Code VARCHAR); CREATE TABLE Participants_in_Events (Participant_ID VARCHAR) ###Answer: SELECT T1.Participant_ID, T1.Participant_Type_Code, COUNT(*) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_ID" "convert the question into postgresql query using the context values ### Question: What are all the the participant ids, type code and details? ### Context: CREATE TABLE Participants (Participant_ID VARCHAR, Participant_Type_Code VARCHAR, Participant_Details VARCHAR) ###Answer: SELECT Participant_ID, Participant_Type_Code, Participant_Details FROM Participants" "convert the question into postgresql query using the context values ### Question: How many participants belong to the type 'Organizer'? ### Context: CREATE TABLE participants (participant_type_code VARCHAR) ###Answer: SELECT COUNT(*) FROM participants WHERE participant_type_code = 'Organizer'" "convert the question into postgresql query using the context values ### Question: List the type of the services in alphabetical order. ### Context: CREATE TABLE services (service_type_code VARCHAR) ###Answer: SELECT service_type_code FROM services ORDER BY service_type_code" "convert the question into postgresql query using the context values ### Question: List the service id and details for the events. ### Context: CREATE TABLE EVENTS (service_id VARCHAR, event_details VARCHAR) ###Answer: SELECT service_id, event_details FROM EVENTS" "convert the question into postgresql query using the context values ### Question: How many events had participants whose details had the substring 'Dr.' ### Context: CREATE TABLE participants (Participant_ID VARCHAR, participant_details VARCHAR); CREATE TABLE Participants_in_Events (Participant_ID VARCHAR) ###Answer: SELECT COUNT(*) FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE T1.participant_details LIKE '%Dr.%'" "convert the question into postgresql query using the context values ### Question: What is the most common participant type? ### Context: CREATE TABLE participants (participant_type_code VARCHAR) ###Answer: SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which service id and type has the least number of participants? ### Context: CREATE TABLE Participants_in_Events (Participant_ID VARCHAR, Event_ID VARCHAR); CREATE TABLE services (Service_Type_Code VARCHAR, service_id VARCHAR); CREATE TABLE EVENTS (service_id VARCHAR, Event_ID VARCHAR); CREATE TABLE participants (Participant_ID VARCHAR) ###Answer: SELECT T3.service_id, T4.Service_Type_Code FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID JOIN EVENTS AS T3 ON T2.Event_ID = T3.Event_ID JOIN services AS T4 ON T3.service_id = T4.service_id GROUP BY T3.service_id ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the id of the event with the most participants? ### Context: CREATE TABLE Participants_in_Events (Event_ID VARCHAR) ###Answer: SELECT Event_ID FROM Participants_in_Events GROUP BY Event_ID ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which events id does not have any participant with detail 'Kenyatta Kuhn'? ### Context: CREATE TABLE Participants (Participant_ID VARCHAR); CREATE TABLE EVENTS (event_id VARCHAR, Participant_Details VARCHAR); CREATE TABLE Participants_in_Events (event_id VARCHAR, Participant_ID VARCHAR) ###Answer: SELECT event_id FROM EVENTS EXCEPT SELECT T1.event_id FROM Participants_in_Events AS T1 JOIN Participants AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE Participant_Details = 'Kenyatta Kuhn'" "convert the question into postgresql query using the context values ### Question: Which services type had both successful and failure event details? ### Context: CREATE TABLE EVENTS (service_id VARCHAR, event_details VARCHAR); CREATE TABLE services (service_type_code VARCHAR, service_id VARCHAR) ###Answer: SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Success' INTERSECT SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Fail'" "convert the question into postgresql query using the context values ### Question: How many events did not have any participants? ### Context: CREATE TABLE EVENTS (event_id VARCHAR); CREATE TABLE Participants_in_Events (event_id VARCHAR) ###Answer: SELECT COUNT(*) FROM EVENTS WHERE NOT event_id IN (SELECT event_id FROM Participants_in_Events)" "convert the question into postgresql query using the context values ### Question: What are all the distinct participant ids who attended any events? ### Context: CREATE TABLE participants_in_Events (participant_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT participant_id) FROM participants_in_Events" "convert the question into postgresql query using the context values ### Question: What is the name of the race held most recently? ### Context: CREATE TABLE races (name VARCHAR, date VARCHAR) ###Answer: SELECT name FROM races ORDER BY date DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the name and date of the most recent race? ### Context: CREATE TABLE races (name VARCHAR, date VARCHAR) ###Answer: SELECT name, date FROM races ORDER BY date DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names of all races held in 2017. ### Context: CREATE TABLE races (name VARCHAR, YEAR VARCHAR) ###Answer: SELECT name FROM races WHERE YEAR = 2017" "convert the question into postgresql query using the context values ### Question: Find the distinct names of all races held between 2014 and 2017? ### Context: CREATE TABLE races (name VARCHAR, YEAR INTEGER) ###Answer: SELECT DISTINCT name FROM races WHERE YEAR BETWEEN 2014 AND 2017" "convert the question into postgresql query using the context values ### Question: List the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds? ### Context: CREATE TABLE drivers (forename VARCHAR, surname VARCHAR, driverid VARCHAR); CREATE TABLE laptimes (driverid VARCHAR, milliseconds INTEGER) ###Answer: SELECT DISTINCT T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds < 93000" "convert the question into postgresql query using the context values ### Question: Find all the distinct id and nationality of drivers who have had laptime more than 100000 milliseconds? ### Context: CREATE TABLE laptimes (driverid VARCHAR, milliseconds INTEGER); CREATE TABLE drivers (driverid VARCHAR, nationality VARCHAR) ###Answer: SELECT DISTINCT T1.driverid, T1.nationality FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds > 100000" "convert the question into postgresql query using the context values ### Question: What are the forename and surname of the driver who has the smallest laptime? ### Context: CREATE TABLE laptimes (driverid VARCHAR, milliseconds VARCHAR); CREATE TABLE drivers (forename VARCHAR, surname VARCHAR, driverid VARCHAR) ###Answer: SELECT T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the id and family name of the driver who has the longest laptime? ### Context: CREATE TABLE drivers (driverid VARCHAR, surname VARCHAR); CREATE TABLE laptimes (driverid VARCHAR, milliseconds VARCHAR) ###Answer: SELECT T1.driverid, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the id, forname and surname of the driver who had the first position in terms of laptime at least twice? ### Context: CREATE TABLE drivers (driverid VARCHAR, forename VARCHAR, surname VARCHAR); CREATE TABLE laptimes (driverid VARCHAR) ###Answer: SELECT T1.driverid, T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE POSITION = '1' GROUP BY T1.driverid HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: How many drivers participated in the race Australian Grand Prix held in 2009? ### Context: CREATE TABLE races (raceid VARCHAR, name VARCHAR); CREATE TABLE results (raceid VARCHAR) ###Answer: SELECT COUNT(*) FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid WHERE T2.name = ""Australian Grand Prix"" AND YEAR = 2009" "convert the question into postgresql query using the context values ### Question: How many drivers did not participate in the races held in 2009? ### Context: CREATE TABLE races (driverId VARCHAR, raceId VARCHAR, YEAR VARCHAR); CREATE TABLE results (driverId VARCHAR, raceId VARCHAR, YEAR VARCHAR) ###Answer: SELECT COUNT(DISTINCT driverId) FROM results WHERE NOT raceId IN (SELECT raceId FROM races WHERE YEAR <> 2009)" "convert the question into postgresql query using the context values ### Question: Give me a list of names and years of races that had any driver whose forename is Lewis? ### Context: CREATE TABLE drivers (driverid VARCHAR, forename VARCHAR); CREATE TABLE races (name VARCHAR, year VARCHAR, raceid VARCHAR); CREATE TABLE results (raceid VARCHAR, driverid VARCHAR) ###Answer: SELECT T2.name, T2.year FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T1.driverid = T3.driverid WHERE T3.forename = ""Lewis""" "convert the question into postgresql query using the context values ### Question: Find the forename and surname of drivers whose nationality is German? ### Context: CREATE TABLE drivers (forename VARCHAR, surname VARCHAR, nationality VARCHAR) ###Answer: SELECT forename, surname FROM drivers WHERE nationality = ""German""" "convert the question into postgresql query using the context values ### Question: Find the id and forenames of drivers who participated both the races with name Australian Grand Prix and the races with name Chinese Grand Prix? ### Context: CREATE TABLE races (raceid VARCHAR, name VARCHAR); CREATE TABLE results (driverid VARCHAR, raceid VARCHAR); CREATE TABLE drivers (forename VARCHAR, driverid VARCHAR) ###Answer: SELECT T2.driverid, T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = ""Australian Grand Prix"" INTERSECT SELECT T2.driverid, T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = ""Chinese Grand Prix""" "convert the question into postgresql query using the context values ### Question: What are the forenames and surnames of drivers who participated in the races named Australian Grand Prix but not the races named Chinese Grand Prix? ### Context: CREATE TABLE races (raceid VARCHAR, name VARCHAR); CREATE TABLE drivers (forename VARCHAR, surname VARCHAR, driverid VARCHAR); CREATE TABLE results (raceid VARCHAR, driverid VARCHAR) ###Answer: SELECT T3.forename, T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = ""Australian Grand Prix"" EXCEPT SELECT T3.forename, T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = ""Chinese Grand Prix""" "convert the question into postgresql query using the context values ### Question: Find all the forenames of distinct drivers who was in position 1 as standing and won? ### Context: CREATE TABLE driverstandings (driverid VARCHAR, position VARCHAR, wins VARCHAR); CREATE TABLE drivers (forename VARCHAR, driverid VARCHAR) ###Answer: SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1" "convert the question into postgresql query using the context values ### Question: Find all the forenames of distinct drivers who won in position 1 as driver standing and had more than 20 points? ### Context: CREATE TABLE drivers (forename VARCHAR, driverid VARCHAR); CREATE TABLE driverstandings (driverid VARCHAR, points VARCHAR, position VARCHAR, wins VARCHAR) ###Answer: SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1 AND T2.points > 20" "convert the question into postgresql query using the context values ### Question: What are the numbers of constructors for different nationalities? ### Context: CREATE TABLE constructors (nationality VARCHAR) ###Answer: SELECT COUNT(*), nationality FROM constructors GROUP BY nationality" "convert the question into postgresql query using the context values ### Question: What are the numbers of races for each constructor id? ### Context: CREATE TABLE constructorStandings (constructorid VARCHAR) ###Answer: SELECT COUNT(*), constructorid FROM constructorStandings GROUP BY constructorid" "convert the question into postgresql query using the context values ### Question: What are the names of races that were held after 2017 and the circuits were in the country of Spain? ### Context: CREATE TABLE races (name VARCHAR, circuitid VARCHAR, year VARCHAR); CREATE TABLE circuits (circuitid VARCHAR, country VARCHAR) ###Answer: SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = ""Spain"" AND T1.year > 2017" "convert the question into postgresql query using the context values ### Question: What are the unique names of races that held after 2000 and the circuits were in Spain? ### Context: CREATE TABLE races (name VARCHAR, circuitid VARCHAR, year VARCHAR); CREATE TABLE circuits (circuitid VARCHAR, country VARCHAR) ###Answer: SELECT DISTINCT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = ""Spain"" AND T1.year > 2000" "convert the question into postgresql query using the context values ### Question: Find the distinct driver id and the stop number of all drivers that have a shorter pit stop duration than some drivers in the race with id 841. ### Context: CREATE TABLE pitstops (driverid VARCHAR, STOP VARCHAR, duration INTEGER, raceid VARCHAR) ###Answer: SELECT DISTINCT driverid, STOP FROM pitstops WHERE duration < (SELECT MAX(duration) FROM pitstops WHERE raceid = 841)" "convert the question into postgresql query using the context values ### Question: Find the distinct driver id of all drivers that have a longer stop duration than some drivers in the race whose id is 841? ### Context: CREATE TABLE pitstops (driverid VARCHAR, STOP VARCHAR, duration INTEGER, raceid VARCHAR) ###Answer: SELECT DISTINCT driverid, STOP FROM pitstops WHERE duration > (SELECT MIN(duration) FROM pitstops WHERE raceid = 841)" "convert the question into postgresql query using the context values ### Question: List the forenames of all distinct drivers in alphabetical order? ### Context: CREATE TABLE drivers (forename VARCHAR) ###Answer: SELECT DISTINCT forename FROM drivers ORDER BY forename" "convert the question into postgresql query using the context values ### Question: List the names of all distinct races in reversed lexicographic order? ### Context: CREATE TABLE races (name VARCHAR) ###Answer: SELECT DISTINCT name FROM races ORDER BY name DESC" "convert the question into postgresql query using the context values ### Question: What are the names of races held between 2009 and 2011? ### Context: CREATE TABLE races (name VARCHAR, YEAR INTEGER) ###Answer: SELECT name FROM races WHERE YEAR BETWEEN 2009 AND 2011" "convert the question into postgresql query using the context values ### Question: What are the names of races held after 12:00:00 or before 09:00:00? ### Context: CREATE TABLE races (name VARCHAR, TIME VARCHAR) ###Answer: SELECT name FROM races WHERE TIME > ""12:00:00"" OR TIME < ""09:00:00""" "convert the question into postgresql query using the context values ### Question: What are the drivers' first, last names and id who had more than 8 pit stops or participated in more than 5 race results? ### Context: CREATE TABLE drivers (forename VARCHAR, surname VARCHAR, driverid VARCHAR); CREATE TABLE results (driverid VARCHAR); CREATE TABLE pitstops (driverid VARCHAR) ###Answer: SELECT T1.forename, T1.surname, T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 8 UNION SELECT T1.forename, T1.surname, T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 5" "convert the question into postgresql query using the context values ### Question: What are the drivers' last names and id who had 11 pit stops and participated in more than 5 race results? ### Context: CREATE TABLE drivers (surname VARCHAR, driverid VARCHAR); CREATE TABLE results (driverid VARCHAR); CREATE TABLE pitstops (driverid VARCHAR) ###Answer: SELECT T1.surname, T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) = 11 INTERSECT SELECT T1.surname, T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 5" "convert the question into postgresql query using the context values ### Question: What is the id and last name of the driver who participated in the most races after 2010? ### Context: CREATE TABLE drivers (driverid VARCHAR, surname VARCHAR); CREATE TABLE races (raceid VARCHAR, year INTEGER); CREATE TABLE results (driverid VARCHAR, raceid VARCHAR) ###Answer: SELECT T1.driverid, T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid WHERE T3.year > 2010 GROUP BY T1.driverid ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the names of circuits that belong to UK or Malaysia? ### Context: CREATE TABLE circuits (name VARCHAR, country VARCHAR) ###Answer: SELECT name FROM circuits WHERE country = ""UK"" OR country = ""Malaysia""" "convert the question into postgresql query using the context values ### Question: Find the id and location of circuits that belong to France or Belgium? ### Context: CREATE TABLE circuits (circuitid VARCHAR, LOCATION VARCHAR, country VARCHAR) ###Answer: SELECT circuitid, LOCATION FROM circuits WHERE country = ""France"" OR country = ""Belgium""" "convert the question into postgresql query using the context values ### Question: Find the names of Japanese constructors that have once earned more than 5 points? ### Context: CREATE TABLE constructorstandings (constructorid VARCHAR, points VARCHAR); CREATE TABLE constructors (name VARCHAR, constructorid VARCHAR, nationality VARCHAR) ###Answer: SELECT T1.name FROM constructors AS T1 JOIN constructorstandings AS T2 ON T1.constructorid = T2.constructorid WHERE T1.nationality = ""Japanese"" AND T2.points > 5" "convert the question into postgresql query using the context values ### Question: What is the average fastest lap speed in race named 'Monaco Grand Prix' in 2008 ? ### Context: CREATE TABLE results (fastestlapspeed INTEGER, raceid VARCHAR); CREATE TABLE races (raceid VARCHAR, year VARCHAR, name VARCHAR) ###Answer: SELECT AVG(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = ""Monaco Grand Prix""" "convert the question into postgresql query using the context values ### Question: What is the maximum fastest lap speed in race named 'Monaco Grand Prix' in 2008 ? ### Context: CREATE TABLE results (fastestlapspeed INTEGER, raceid VARCHAR); CREATE TABLE races (raceid VARCHAR, year VARCHAR, name VARCHAR) ###Answer: SELECT MAX(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = ""Monaco Grand Prix""" "convert the question into postgresql query using the context values ### Question: What are the maximum fastest lap speed in races held after 2004 grouped by race name and ordered by year? ### Context: CREATE TABLE results (fastestlapspeed INTEGER, raceid VARCHAR); CREATE TABLE races (name VARCHAR, year INTEGER, raceid VARCHAR) ###Answer: SELECT MAX(T2.fastestlapspeed), T1.name, T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year" "convert the question into postgresql query using the context values ### Question: What are the average fastest lap speed in races held after 2004 grouped by race name and ordered by year? ### Context: CREATE TABLE results (fastestlapspeed INTEGER, raceid VARCHAR); CREATE TABLE races (name VARCHAR, year INTEGER, raceid VARCHAR) ###Answer: SELECT AVG(T2.fastestlapspeed), T1.name, T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year" "convert the question into postgresql query using the context values ### Question: Find the id, forename and number of races of all drivers who have at least participated in two races? ### Context: CREATE TABLE drivers (driverid VARCHAR, forename VARCHAR); CREATE TABLE races (raceid VARCHAR); CREATE TABLE results (driverid VARCHAR, raceid VARCHAR) ###Answer: SELECT T1.driverid, T1.forename, COUNT(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Find the driver id and number of races of all drivers who have at most participated in 30 races? ### Context: CREATE TABLE races (raceid VARCHAR); CREATE TABLE results (driverid VARCHAR, raceid VARCHAR); CREATE TABLE drivers (driverid VARCHAR) ###Answer: SELECT T1.driverid, COUNT(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING COUNT(*) <= 30" "convert the question into postgresql query using the context values ### Question: Find the id and surname of the driver who participated the most number of races? ### Context: CREATE TABLE drivers (driverid VARCHAR, surname VARCHAR); CREATE TABLE races (raceid VARCHAR); CREATE TABLE results (driverid VARCHAR, raceid VARCHAR) ###Answer: SELECT T1.driverid, T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many technicians are there? ### Context: CREATE TABLE technician (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM technician" "convert the question into postgresql query using the context values ### Question: List the names of technicians in ascending order of age. ### Context: CREATE TABLE technician (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM technician ORDER BY Age" "convert the question into postgresql query using the context values ### Question: What are the team and starting year of technicians? ### Context: CREATE TABLE technician (Team VARCHAR, Starting_Year VARCHAR) ###Answer: SELECT Team, Starting_Year FROM technician" "convert the question into postgresql query using the context values ### Question: List the name of technicians whose team is not ""NYY"". ### Context: CREATE TABLE technician (Name VARCHAR, Team VARCHAR) ###Answer: SELECT Name FROM technician WHERE Team <> ""NYY""" "convert the question into postgresql query using the context values ### Question: Show the name of technicians aged either 36 or 37 ### Context: CREATE TABLE technician (Name VARCHAR, Age VARCHAR) ###Answer: SELECT Name FROM technician WHERE Age = 36 OR Age = 37" "convert the question into postgresql query using the context values ### Question: What is the starting year of the oldest technicians? ### Context: CREATE TABLE technician (Starting_Year VARCHAR, Age VARCHAR) ###Answer: SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show different teams of technicians and the number of technicians in each team. ### Context: CREATE TABLE technician (Team VARCHAR) ###Answer: SELECT Team, COUNT(*) FROM technician GROUP BY Team" "convert the question into postgresql query using the context values ### Question: Please show the team that has the most number of technicians. ### Context: CREATE TABLE technician (Team VARCHAR) ###Answer: SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the team that have at least two technicians. ### Context: CREATE TABLE technician (Team VARCHAR) ###Answer: SELECT Team FROM technician GROUP BY Team HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show names of technicians and series of machines they are assigned to repair. ### Context: CREATE TABLE machine (Machine_series VARCHAR, machine_id VARCHAR); CREATE TABLE repair_assignment (machine_id VARCHAR, technician_ID VARCHAR); CREATE TABLE technician (Name VARCHAR, technician_ID VARCHAR) ###Answer: SELECT T3.Name, T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID" "convert the question into postgresql query using the context values ### Question: Show names of technicians in ascending order of quality rank of the machine they are assigned. ### Context: CREATE TABLE repair_assignment (machine_id VARCHAR, technician_ID VARCHAR); CREATE TABLE machine (machine_id VARCHAR, quality_rank VARCHAR); CREATE TABLE technician (Name VARCHAR, technician_ID VARCHAR) ###Answer: SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank" "convert the question into postgresql query using the context values ### Question: Show names of technicians who are assigned to repair machines with value point more than 70. ### Context: CREATE TABLE machine (machine_id VARCHAR, value_points INTEGER); CREATE TABLE repair_assignment (machine_id VARCHAR, technician_ID VARCHAR); CREATE TABLE technician (Name VARCHAR, technician_ID VARCHAR) ###Answer: SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID WHERE T2.value_points > 70" "convert the question into postgresql query using the context values ### Question: Show names of technicians and the number of machines they are assigned to repair. ### Context: CREATE TABLE repair_assignment (technician_ID VARCHAR); CREATE TABLE technician (Name VARCHAR, technician_ID VARCHAR) ###Answer: SELECT T2.Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID = T2.technician_ID GROUP BY T2.Name" "convert the question into postgresql query using the context values ### Question: List the names of technicians who have not been assigned to repair machines. ### Context: CREATE TABLE technician (Name VARCHAR, technician_id VARCHAR); CREATE TABLE repair_assignment (Name VARCHAR, technician_id VARCHAR) ###Answer: SELECT Name FROM technician WHERE NOT technician_id IN (SELECT technician_id FROM repair_assignment)" "convert the question into postgresql query using the context values ### Question: Show the starting years shared by technicians from team ""CLE"" and ""CWS"". ### Context: CREATE TABLE technician (Starting_Year VARCHAR, Team VARCHAR) ###Answer: SELECT Starting_Year FROM technician WHERE Team = ""CLE"" INTERSECT SELECT Starting_Year FROM technician WHERE Team = ""CWS""" "convert the question into postgresql query using the context values ### Question: How many entrepreneurs are there? ### Context: CREATE TABLE entrepreneur (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM entrepreneur" "convert the question into postgresql query using the context values ### Question: List the companies of entrepreneurs in descending order of money requested. ### Context: CREATE TABLE entrepreneur (Company VARCHAR, Money_Requested VARCHAR) ###Answer: SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC" "convert the question into postgresql query using the context values ### Question: List the companies and the investors of entrepreneurs. ### Context: CREATE TABLE entrepreneur (Company VARCHAR, Investor VARCHAR) ###Answer: SELECT Company, Investor FROM entrepreneur" "convert the question into postgresql query using the context values ### Question: What is the average money requested by all entrepreneurs? ### Context: CREATE TABLE entrepreneur (Money_Requested INTEGER) ###Answer: SELECT AVG(Money_Requested) FROM entrepreneur" "convert the question into postgresql query using the context values ### Question: What are the names of people in ascending order of weight? ### Context: CREATE TABLE People (Name VARCHAR, Weight VARCHAR) ###Answer: SELECT Name FROM People ORDER BY Weight" "convert the question into postgresql query using the context values ### Question: What are the names of entrepreneurs? ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE entrepreneur (People_ID VARCHAR) ###Answer: SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID" "convert the question into postgresql query using the context values ### Question: What are the names of entrepreneurs whose investor is not ""Rachel Elnaugh""? ### Context: CREATE TABLE entrepreneur (People_ID VARCHAR, Investor VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor <> ""Rachel Elnaugh""" "convert the question into postgresql query using the context values ### Question: What is the weight of the shortest person? ### Context: CREATE TABLE people (Weight VARCHAR, Height VARCHAR) ###Answer: SELECT Weight FROM people ORDER BY Height LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the name of the entrepreneur with the greatest weight? ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR, Weight VARCHAR); CREATE TABLE entrepreneur (People_ID VARCHAR) ###Answer: SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the total money requested by entrepreneurs with height more than 1.85? ### Context: CREATE TABLE people (People_ID VARCHAR, Height INTEGER); CREATE TABLE entrepreneur (Money_Requested INTEGER, People_ID VARCHAR) ###Answer: SELECT SUM(T1.Money_Requested) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 1.85" "convert the question into postgresql query using the context values ### Question: What are the dates of birth of entrepreneurs with investor ""Simon Woodroffe"" or ""Peter Jones""? ### Context: CREATE TABLE entrepreneur (People_ID VARCHAR, Investor VARCHAR); CREATE TABLE people (Date_of_Birth VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Date_of_Birth FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = ""Simon Woodroffe"" OR T1.Investor = ""Peter Jones""" "convert the question into postgresql query using the context values ### Question: What are the weights of entrepreneurs in descending order of money requested? ### Context: CREATE TABLE entrepreneur (People_ID VARCHAR, Money_Requested VARCHAR); CREATE TABLE people (Weight VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Weight FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested DESC" "convert the question into postgresql query using the context values ### Question: What are the investors of entrepreneurs and the corresponding number of entrepreneurs invested by each investor? ### Context: CREATE TABLE entrepreneur (Investor VARCHAR) ###Answer: SELECT Investor, COUNT(*) FROM entrepreneur GROUP BY Investor" "convert the question into postgresql query using the context values ### Question: What is the investor that has invested in the most number of entrepreneurs? ### Context: CREATE TABLE entrepreneur (Investor VARCHAR) ###Answer: SELECT Investor FROM entrepreneur GROUP BY Investor ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the investors that have invested in at least two entrepreneurs? ### Context: CREATE TABLE entrepreneur (Investor VARCHAR) ###Answer: SELECT Investor FROM entrepreneur GROUP BY Investor HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: List the names of entrepreneurs and their companies in descending order of money requested? ### Context: CREATE TABLE entrepreneur (Company VARCHAR, People_ID VARCHAR, Money_Requested VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T2.Name, T1.Company FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested" "convert the question into postgresql query using the context values ### Question: List the names of people that are not entrepreneurs. ### Context: CREATE TABLE entrepreneur (Name VARCHAR, People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM entrepreneur)" "convert the question into postgresql query using the context values ### Question: Show the investors shared by entrepreneurs that requested more than 140000 and entrepreneurs that requested less than 120000. ### Context: CREATE TABLE entrepreneur (Investor VARCHAR, Money_Requested INTEGER) ###Answer: SELECT Investor FROM entrepreneur WHERE Money_Requested > 140000 INTERSECT SELECT Investor FROM entrepreneur WHERE Money_Requested < 120000" "convert the question into postgresql query using the context values ### Question: How many distinct companies are there? ### Context: CREATE TABLE entrepreneur (Company VARCHAR) ###Answer: SELECT COUNT(DISTINCT Company) FROM entrepreneur" "convert the question into postgresql query using the context values ### Question: Show the company of the tallest entrepreneur. ### Context: CREATE TABLE entrepreneur (Company VARCHAR, People_ID VARCHAR); CREATE TABLE people (People_ID VARCHAR, Height VARCHAR) ###Answer: SELECT T1.Company FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Height DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many perpetrators are there? ### Context: CREATE TABLE perpetrator (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM perpetrator" "convert the question into postgresql query using the context values ### Question: List the date of perpetrators in descending order of the number of people killed. ### Context: CREATE TABLE perpetrator (Date VARCHAR, Killed VARCHAR) ###Answer: SELECT Date FROM perpetrator ORDER BY Killed DESC" "convert the question into postgresql query using the context values ### Question: List the number of people injured by perpetrators in ascending order. ### Context: CREATE TABLE perpetrator (Injured VARCHAR) ###Answer: SELECT Injured FROM perpetrator ORDER BY Injured" "convert the question into postgresql query using the context values ### Question: What is the average number of people injured by all perpetrators? ### Context: CREATE TABLE perpetrator (Injured INTEGER) ###Answer: SELECT AVG(Injured) FROM perpetrator" "convert the question into postgresql query using the context values ### Question: What is the location of the perpetrator with the largest kills. ### Context: CREATE TABLE perpetrator (LOCATION VARCHAR, Killed VARCHAR) ###Answer: SELECT LOCATION FROM perpetrator ORDER BY Killed DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the names of people in ascending order of height? ### Context: CREATE TABLE People (Name VARCHAR, Height VARCHAR) ###Answer: SELECT Name FROM People ORDER BY Height" "convert the question into postgresql query using the context values ### Question: What are the names of perpetrators? ### Context: CREATE TABLE perpetrator (People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID" "convert the question into postgresql query using the context values ### Question: What are the names of perpetrators whose country is not ""China""? ### Context: CREATE TABLE perpetrator (People_ID VARCHAR, Country VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country <> ""China""" "convert the question into postgresql query using the context values ### Question: What is the name of the perpetrator with the biggest weight. ### Context: CREATE TABLE perpetrator (People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR, Weight VARCHAR) ###Answer: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Weight DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the total kills of the perpetrators with height more than 1.84. ### Context: CREATE TABLE people (People_ID VARCHAR, Height INTEGER); CREATE TABLE perpetrator (Killed INTEGER, People_ID VARCHAR) ###Answer: SELECT SUM(T2.Killed) FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84" "convert the question into postgresql query using the context values ### Question: What are the names of perpetrators in country ""China"" or ""Japan""? ### Context: CREATE TABLE perpetrator (People_ID VARCHAR, Country VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = ""China"" OR T2.Country = ""Japan""" "convert the question into postgresql query using the context values ### Question: What are the heights of perpetrators in descending order of the number of people they injured? ### Context: CREATE TABLE perpetrator (People_ID VARCHAR, Injured VARCHAR); CREATE TABLE people (Height VARCHAR, People_ID VARCHAR) ###Answer: SELECT T1.Height FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Injured DESC" "convert the question into postgresql query using the context values ### Question: What are the countries of perpetrators? Show each country and the corresponding number of perpetrators there. ### Context: CREATE TABLE perpetrator (Country VARCHAR) ###Answer: SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country" "convert the question into postgresql query using the context values ### Question: What is the country that has the most perpetrators? ### Context: CREATE TABLE perpetrator (Country VARCHAR) ###Answer: SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the countries that have at least two perpetrators? ### Context: CREATE TABLE perpetrator (Country VARCHAR) ###Answer: SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: List the names of perpetrators in descending order of the year. ### Context: CREATE TABLE perpetrator (People_ID VARCHAR, Year VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Year DESC" "convert the question into postgresql query using the context values ### Question: List the names of people that are not perpetrators. ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE perpetrator (Name VARCHAR, People_ID VARCHAR) ###Answer: SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM perpetrator)" "convert the question into postgresql query using the context values ### Question: Show the countries that have both perpetrators with injures more than 50 and perpetrators with injures smaller than 20. ### Context: CREATE TABLE perpetrator (Country VARCHAR, Injured INTEGER) ###Answer: SELECT Country FROM perpetrator WHERE Injured > 50 INTERSECT SELECT Country FROM perpetrator WHERE Injured < 20" "convert the question into postgresql query using the context values ### Question: How many distinct locations of perpetrators are there? ### Context: CREATE TABLE perpetrator (LOCATION VARCHAR) ###Answer: SELECT COUNT(DISTINCT LOCATION) FROM perpetrator" "convert the question into postgresql query using the context values ### Question: Show the date of the tallest perpetrator. ### Context: CREATE TABLE perpetrator (Date VARCHAR, People_ID VARCHAR); CREATE TABLE people (People_ID VARCHAR, Height VARCHAR) ###Answer: SELECT T2.Date FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: In which year did the most recent crime happen? ### Context: CREATE TABLE perpetrator (YEAR INTEGER) ###Answer: SELECT MAX(YEAR) FROM perpetrator" "convert the question into postgresql query using the context values ### Question: Report the name of all campuses in Los Angeles county. ### Context: CREATE TABLE campuses (campus VARCHAR, county VARCHAR) ###Answer: SELECT campus FROM campuses WHERE county = ""Los Angeles""" "convert the question into postgresql query using the context values ### Question: What are the names of all campuses located at Chico? ### Context: CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR) ###Answer: SELECT campus FROM campuses WHERE LOCATION = ""Chico""" "convert the question into postgresql query using the context values ### Question: Find all the campuses opened in 1958. ### Context: CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR) ###Answer: SELECT campus FROM campuses WHERE YEAR = 1958" "convert the question into postgresql query using the context values ### Question: Find the name of the campuses opened before 1800. ### Context: CREATE TABLE campuses (campus VARCHAR, YEAR INTEGER) ###Answer: SELECT campus FROM campuses WHERE YEAR < 1800" "convert the question into postgresql query using the context values ### Question: Which campus was opened between 1935 and 1939? ### Context: CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR) ###Answer: SELECT campus FROM campuses WHERE YEAR >= 1935 AND YEAR <= 1939" "convert the question into postgresql query using the context values ### Question: Find the name of the campuses that is in Northridge, Los Angeles or in San Francisco, San Francisco. ### Context: CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR, county VARCHAR) ###Answer: SELECT campus FROM campuses WHERE LOCATION = ""Northridge"" AND county = ""Los Angeles"" UNION SELECT campus FROM campuses WHERE LOCATION = ""San Francisco"" AND county = ""San Francisco""" "convert the question into postgresql query using the context values ### Question: What is the campus fee of ""San Jose State University"" in year 1996? ### Context: CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR) ###Answer: SELECT campusfee FROM campuses AS T1 JOIN csu_fees AS T2 ON T1.id = t2.campus WHERE t1.campus = ""San Jose State University"" AND T2.year = 1996" "convert the question into postgresql query using the context values ### Question: What is the campus fee of ""San Francisco State University"" in year 1996? ### Context: CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR) ###Answer: SELECT campusfee FROM campuses AS T1 JOIN csu_fees AS T2 ON T1.id = t2.campus WHERE t1.campus = ""San Francisco State University"" AND T2.year = 1996" "convert the question into postgresql query using the context values ### Question: Find the count of universities whose campus fee is greater than the average campus fee. ### Context: CREATE TABLE csu_fees (campusfee INTEGER) ###Answer: SELECT COUNT(*) FROM csu_fees WHERE campusfee > (SELECT AVG(campusfee) FROM csu_fees)" "convert the question into postgresql query using the context values ### Question: Which university is in Los Angeles county and opened after 1950? ### Context: CREATE TABLE campuses (campus VARCHAR, county VARCHAR, YEAR VARCHAR) ###Answer: SELECT campus FROM campuses WHERE county = ""Los Angeles"" AND YEAR > 1950" "convert the question into postgresql query using the context values ### Question: Which year has the most degrees conferred? ### Context: CREATE TABLE degrees (YEAR VARCHAR, degrees INTEGER) ###Answer: SELECT YEAR FROM degrees GROUP BY YEAR ORDER BY SUM(degrees) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which campus has the most degrees conferred in all times? ### Context: CREATE TABLE degrees (campus VARCHAR, degrees INTEGER) ###Answer: SELECT campus FROM degrees GROUP BY campus ORDER BY SUM(degrees) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which campus has the most faculties in year 2003? ### Context: CREATE TABLE faculty (campus VARCHAR, year VARCHAR, faculty VARCHAR); CREATE TABLE campuses (campus VARCHAR, id VARCHAR) ###Answer: SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2003 ORDER BY T2.faculty DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the average fee on a CSU campus in 1996 ### Context: CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR) ###Answer: SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 1996" "convert the question into postgresql query using the context values ### Question: What is the average fee on a CSU campus in 2005? ### Context: CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR) ###Answer: SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 2005" "convert the question into postgresql query using the context values ### Question: report the total number of degrees granted between 1998 and 2002. ### Context: CREATE TABLE campuses (campus VARCHAR, id VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR) ###Answer: SELECT T1.campus, SUM(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T2.year >= 1998 AND T2.year <= 2002 GROUP BY T1.campus" "convert the question into postgresql query using the context values ### Question: For each Orange county campus, report the number of degrees granted after 2000. ### Context: CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR) ###Answer: SELECT T1.campus, SUM(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T1.county = ""Orange"" AND T2.year >= 2000 GROUP BY T1.campus" "convert the question into postgresql query using the context values ### Question: Find the names of the campus which has more faculties in 2002 than every campus in Orange county. ### Context: CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR) ###Answer: SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND faculty > (SELECT MAX(faculty) FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND T1.county = ""Orange"")" "convert the question into postgresql query using the context values ### Question: What campus had more than 400 total enrollment but more than 200 full time enrollment in year 1956? ### Context: CREATE TABLE enrollments (campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR) ###Answer: SELECT T1.campus FROM campuses AS t1 JOIN enrollments AS t2 ON t1.id = t2.campus WHERE t2.year = 1956 AND totalenrollment_ay > 400 AND FTE_AY > 200" "convert the question into postgresql query using the context values ### Question: How many campuses are there in Los Angeles county? ### Context: CREATE TABLE campuses (county VARCHAR) ###Answer: SELECT COUNT(*) FROM campuses WHERE county = ""Los Angeles""" "convert the question into postgresql query using the context values ### Question: How many degrees were conferred in ""San Jose State University"" in 2000? ### Context: CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR) ###Answer: SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = ""San Jose State University"" AND t2.year = 2000" "convert the question into postgresql query using the context values ### Question: What are the degrees conferred in ""San Francisco State University"" in 2001. ### Context: CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR) ###Answer: SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = ""San Francisco State University"" AND t2.year = 2001" "convert the question into postgresql query using the context values ### Question: How many faculty is there in total in the year of 2002? ### Context: CREATE TABLE faculty (faculty INTEGER, YEAR VARCHAR) ###Answer: SELECT SUM(faculty) FROM faculty WHERE YEAR = 2002" "convert the question into postgresql query using the context values ### Question: What is the number of faculty lines in campus ""Long Beach State University"" in 2002? ### Context: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR) ###Answer: SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2002 AND T2.campus = ""Long Beach State University""" "convert the question into postgresql query using the context values ### Question: How many faculty lines are there in ""San Francisco State University"" in year 2004? ### Context: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR) ###Answer: SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2004 AND T2.campus = ""San Francisco State University""" "convert the question into postgresql query using the context values ### Question: List the campus that have between 600 and 1000 faculty lines in year 2004. ### Context: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (campus VARCHAR, faculty VARCHAR) ###Answer: SELECT T1.campus FROM campuses AS t1 JOIN faculty AS t2 ON t1.id = t2.campus WHERE t2.faculty >= 600 AND t2.faculty <= 1000 AND T1.year = 2004" "convert the question into postgresql query using the context values ### Question: How many faculty lines are there in the university that conferred the most number of degrees in year 2002? ### Context: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR) ###Answer: SELECT T2.faculty FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = t2.campus JOIN degrees AS T3 ON T1.id = t3.campus AND t2.year = t3.year WHERE t2.year = 2002 ORDER BY t3.degrees DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many faculty lines are there in the university that conferred the least number of degrees in year 2001? ### Context: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR) ###Answer: SELECT T2.faculty FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = t2.campus JOIN degrees AS T3 ON T1.id = t3.campus AND t2.year = t3.year WHERE t2.year = 2001 ORDER BY t3.degrees LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many undergraduates are there in ""San Jose State University"" in year 2004? ### Context: CREATE TABLE discipline_enrollments (undergraduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR) ###Answer: SELECT SUM(t1.undergraduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = ""San Jose State University""" "convert the question into postgresql query using the context values ### Question: What is the number of graduates in ""San Francisco State University"" in year 2004? ### Context: CREATE TABLE discipline_enrollments (graduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR) ###Answer: SELECT SUM(t1.graduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = ""San Francisco State University""" "convert the question into postgresql query using the context values ### Question: What is the campus fee of ""San Francisco State University"" in year 2000? ### Context: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR) ###Answer: SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = ""San Francisco State University"" AND t1.year = 2000" "convert the question into postgresql query using the context values ### Question: Find the campus fee of ""San Jose State University"" in year 2000. ### Context: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR) ###Answer: SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = ""San Jose State University"" AND t1.year = 2000" "convert the question into postgresql query using the context values ### Question: How many CSU campuses are there? ### Context: CREATE TABLE campuses (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM campuses" "convert the question into postgresql query using the context values ### Question: How many candidates are there? ### Context: CREATE TABLE candidate (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM candidate" "convert the question into postgresql query using the context values ### Question: Which poll resource provided the most number of candidate information? ### Context: CREATE TABLE candidate (poll_source VARCHAR) ###Answer: SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: what are the top 3 highest support rates? ### Context: CREATE TABLE candidate (support_rate VARCHAR) ###Answer: SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Find the id of the candidate who got the lowest oppose rate. ### Context: CREATE TABLE candidate (Candidate_ID VARCHAR, oppose_rate VARCHAR) ###Answer: SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1" "convert the question into postgresql query using the context values ### Question: Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate. ### Context: CREATE TABLE candidate (Support_rate VARCHAR, Consider_rate VARCHAR, Oppose_rate VARCHAR, unsure_rate VARCHAR) ###Answer: SELECT Support_rate, Consider_rate, Oppose_rate FROM candidate ORDER BY unsure_rate" "convert the question into postgresql query using the context values ### Question: which poll source does the highest oppose rate come from? ### Context: CREATE TABLE candidate (poll_source VARCHAR, oppose_rate VARCHAR) ###Answer: SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List all people names in the order of their date of birth from old to young. ### Context: CREATE TABLE people (name VARCHAR, date_of_birth VARCHAR) ###Answer: SELECT name FROM people ORDER BY date_of_birth" "convert the question into postgresql query using the context values ### Question: Find the average height and weight for all males (sex is M). ### Context: CREATE TABLE people (height INTEGER, weight INTEGER, sex VARCHAR) ###Answer: SELECT AVG(height), AVG(weight) FROM people WHERE sex = 'M'" "convert the question into postgresql query using the context values ### Question: find the names of people who are taller than 200 or lower than 190. ### Context: CREATE TABLE people (name VARCHAR, height VARCHAR) ###Answer: SELECT name FROM people WHERE height > 200 OR height < 190" "convert the question into postgresql query using the context values ### Question: Find the average and minimum weight for each gender. ### Context: CREATE TABLE people (sex VARCHAR, weight INTEGER) ###Answer: SELECT AVG(weight), MIN(weight), sex FROM people GROUP BY sex" "convert the question into postgresql query using the context values ### Question: Find the name and gender of the candidate who got the highest support rate. ### Context: CREATE TABLE candidate (people_id VARCHAR, support_rate VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR) ###Answer: SELECT t1.name, t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id ORDER BY t2.support_rate DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of the candidates whose oppose percentage is the lowest for each sex. ### Context: CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR) ###Answer: SELECT t1.name, t1.sex, MIN(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex" "convert the question into postgresql query using the context values ### Question: which gender got the highest average uncertain ratio. ### Context: CREATE TABLE candidate (people_id VARCHAR, unsure_rate INTEGER); CREATE TABLE people (sex VARCHAR, people_id VARCHAR) ###Answer: SELECT t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex ORDER BY AVG(t2.unsure_rate) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: what are the names of people who did not participate in the candidate election. ### Context: CREATE TABLE candidate (name VARCHAR, people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR) ###Answer: SELECT name FROM people WHERE NOT people_id IN (SELECT people_id FROM candidate)" "convert the question into postgresql query using the context values ### Question: Find the names of the candidates whose support percentage is lower than their oppose rate. ### Context: CREATE TABLE candidate (people_id VARCHAR, support_rate INTEGER, oppose_rate VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR) ###Answer: SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate" "convert the question into postgresql query using the context values ### Question: how many people are there whose weight is higher than 85 for each gender? ### Context: CREATE TABLE people (sex VARCHAR, weight INTEGER) ###Answer: SELECT COUNT(*), sex FROM people WHERE weight > 85 GROUP BY sex" "convert the question into postgresql query using the context values ### Question: find the highest support percentage, lowest consider rate and oppose rate of all candidates. ### Context: CREATE TABLE candidate (support_rate INTEGER, consider_rate INTEGER, oppose_rate INTEGER) ###Answer: SELECT MAX(support_rate), MIN(consider_rate), MIN(oppose_rate) FROM candidate" "convert the question into postgresql query using the context values ### Question: list all female (sex is F) candidate names in the alphabetical order. ### Context: CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR, sex VARCHAR) ###Answer: SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t1.sex = 'F' ORDER BY t1.name" "convert the question into postgresql query using the context values ### Question: find the name of people whose height is lower than the average. ### Context: CREATE TABLE people (name VARCHAR, height INTEGER) ###Answer: SELECT name FROM people WHERE height < (SELECT AVG(height) FROM people)" "convert the question into postgresql query using the context values ### Question: List all info about all people. ### Context: CREATE TABLE people (Id VARCHAR) ###Answer: SELECT * FROM people" "convert the question into postgresql query using the context values ### Question: Find the titles of all movies directed by steven spielberg. ### Context: CREATE TABLE Movie (title VARCHAR, director VARCHAR) ###Answer: SELECT title FROM Movie WHERE director = 'Steven Spielberg'" "convert the question into postgresql query using the context values ### Question: What is the name of the movie produced after 2000 and directed by James Cameron? ### Context: CREATE TABLE Movie (title VARCHAR, director VARCHAR, YEAR VARCHAR) ###Answer: SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000" "convert the question into postgresql query using the context values ### Question: How many movies were made before 2000? ### Context: CREATE TABLE Movie (YEAR INTEGER) ###Answer: SELECT COUNT(*) FROM Movie WHERE YEAR < 2000" "convert the question into postgresql query using the context values ### Question: Who is the director of movie Avatar? ### Context: CREATE TABLE Movie (director VARCHAR, title VARCHAR) ###Answer: SELECT director FROM Movie WHERE title = 'Avatar'" "convert the question into postgresql query using the context values ### Question: How many reviewers listed? ### Context: CREATE TABLE Reviewer (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Reviewer" "convert the question into postgresql query using the context values ### Question: What is the id of the reviewer whose name has substring “Mike”? ### Context: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR) ###Answer: SELECT rID FROM Reviewer WHERE name LIKE ""%Mike%""" "convert the question into postgresql query using the context values ### Question: What is the reviewer id of Daniel Lewis? ### Context: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR) ###Answer: SELECT rID FROM Reviewer WHERE name = ""Daniel Lewis""" "convert the question into postgresql query using the context values ### Question: What is the total number of ratings that has more than 3 stars? ### Context: CREATE TABLE Rating (stars INTEGER) ###Answer: SELECT COUNT(*) FROM Rating WHERE stars > 3" "convert the question into postgresql query using the context values ### Question: What is the lowest and highest rating star? ### Context: CREATE TABLE Rating (stars INTEGER) ###Answer: SELECT MAX(stars), MIN(stars) FROM Rating" "convert the question into postgresql query using the context values ### Question: Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year. ### Context: CREATE TABLE Movie (mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR) ###Answer: SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year" "convert the question into postgresql query using the context values ### Question: What are the names of directors who directed movies with 5 star rating? Also return the title of these movies. ### Context: CREATE TABLE Movie (director VARCHAR, title VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR) ###Answer: SELECT T1.director, T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5" "convert the question into postgresql query using the context values ### Question: What is the average rating star for each reviewer? ### Context: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (stars INTEGER, rID VARCHAR) ###Answer: SELECT T2.name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name" "convert the question into postgresql query using the context values ### Question: Find the titles of all movies that have no ratings. ### Context: CREATE TABLE Rating (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT title FROM Movie WHERE NOT mID IN (SELECT mID FROM Rating)" "convert the question into postgresql query using the context values ### Question: Find the names of all reviewers who have ratings with a NULL value for the date. ### Context: CREATE TABLE Rating (rID VARCHAR); CREATE TABLE Reviewer (rID VARCHAR) ###Answer: SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = ""null""" "convert the question into postgresql query using the context values ### Question: What is the average rating stars and title for the oldest movie? ### Context: CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER) ###Answer: SELECT AVG(T1.stars), T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MIN(YEAR) FROM Movie)" "convert the question into postgresql query using the context values ### Question: What is the name of the most recent movie? ### Context: CREATE TABLE Movie (title VARCHAR, YEAR INTEGER) ###Answer: SELECT title FROM Movie WHERE YEAR = (SELECT MAX(YEAR) FROM Movie)" "convert the question into postgresql query using the context values ### Question: What is the maximum stars and year for the most recent movie? ### Context: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER); CREATE TABLE Movie (year VARCHAR, mID VARCHAR) ###Answer: SELECT MAX(T1.stars), T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MAX(YEAR) FROM Movie)" "convert the question into postgresql query using the context values ### Question: What is the names of movies whose created year is after all movies directed by Steven Spielberg? ### Context: CREATE TABLE Movie (title VARCHAR, YEAR INTEGER, director VARCHAR) ###Answer: SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = ""Steven Spielberg"")" "convert the question into postgresql query using the context values ### Question: What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron? ### Context: CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = ""James Cameron"")" "convert the question into postgresql query using the context values ### Question: Return reviewer name, movie title, stars, and ratingDate. And sort the data first by reviewer name, then by movie title, and lastly by number of stars. ### Context: CREATE TABLE Rating (stars VARCHAR, ratingDate VARCHAR, mID VARCHAR, rID VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT T3.name, T2.title, T1.stars, T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name, T2.title, T1.stars" "convert the question into postgresql query using the context values ### Question: Find the names of all reviewers who have contributed three or more ratings. ### Context: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR) ###Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3" "convert the question into postgresql query using the context values ### Question: Find the names of all reviewers who rated Gone with the Wind. ### Context: CREATE TABLE Movie (mID VARCHAR, title VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) ###Answer: SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'" "convert the question into postgresql query using the context values ### Question: Find the names of all directors whose movies are rated by Sarah Martinez. ### Context: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) ###Answer: SELECT DISTINCT T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Sarah Martinez'" "convert the question into postgresql query using the context values ### Question: For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars. ### Context: CREATE TABLE Rating (stars VARCHAR, mID VARCHAR, rID VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR, director VARCHAR) ###Answer: SELECT DISTINCT T3.name, T2.title, T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name" "convert the question into postgresql query using the context values ### Question: Return all reviewer names and movie names together in a single list. ### Context: CREATE TABLE Reviewer (name VARCHAR, title VARCHAR); CREATE TABLE Movie (name VARCHAR, title VARCHAR) ###Answer: SELECT name FROM Reviewer UNION SELECT title FROM Movie" "convert the question into postgresql query using the context values ### Question: Find the titles of all movies not reviewed by Chris Jackson. ### Context: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) ###Answer: SELECT DISTINCT title FROM Movie EXCEPT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Chris Jackson'" "convert the question into postgresql query using the context values ### Question: For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title. ### Context: CREATE TABLE Movie (title VARCHAR, director VARCHAR); CREATE TABLE Movie (director VARCHAR, title VARCHAR) ###Answer: SELECT T1.title, T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title ORDER BY T1.director, T1.title" "convert the question into postgresql query using the context values ### Question: For directors who had more than one movie, return the titles and produced years of all movies directed by them. ### Context: CREATE TABLE Movie (director VARCHAR, title VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, director VARCHAR) ###Answer: SELECT T1.title, T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title" "convert the question into postgresql query using the context values ### Question: What are the names of the directors who made exactly one movie? ### Context: CREATE TABLE Movie (director VARCHAR) ###Answer: SELECT director FROM Movie GROUP BY director HAVING COUNT(*) = 1" "convert the question into postgresql query using the context values ### Question: What are the names of the directors who made exactly one movie excluding director NULL? ### Context: CREATE TABLE Movie (director VARCHAR) ###Answer: SELECT director FROM Movie WHERE director <> ""null"" GROUP BY director HAVING COUNT(*) = 1" "convert the question into postgresql query using the context values ### Question: How many movie reviews does each director get? ### Context: CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR) ###Answer: SELECT COUNT(*), T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director" "convert the question into postgresql query using the context values ### Question: Find the movies with the highest average rating. Return the movie titles and average rating. ### Context: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG(T1.stars) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the movie titles and average rating of the movies with the lowest average rating? ### Context: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG(T1.stars) LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the names and years of the movies that has the top 3 highest rating star? ### Context: CREATE TABLE Rating (mID VARCHAR, stars VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.stars DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: For each director, return the director's name together with the title of the movie they directed that received the highest rating among all of their movies, and the value of that rating. Ignore movies whose director is NULL. ### Context: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, T1.stars, T2.director, MAX(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director <> ""null"" GROUP BY director" "convert the question into postgresql query using the context values ### Question: Find the title and star rating of the movie that got the least rating star for each reviewer. ### Context: CREATE TABLE Rating (rID VARCHAR, stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, T1.rID, T1.stars, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID" "convert the question into postgresql query using the context values ### Question: Find the title and score of the movie with the lowest rating among all movies directed by each director. ### Context: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, T1.stars, T2.director, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.director" "convert the question into postgresql query using the context values ### Question: What is the name of the movie that is rated by most of times? ### Context: CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title, T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the titles of all movies that have rating star is between 3 and 5? ### Context: CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5" "convert the question into postgresql query using the context values ### Question: Find the names of reviewers who had given higher than 3 star ratings. ### Context: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR, stars INTEGER) ###Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3" "convert the question into postgresql query using the context values ### Question: Find the average rating star for each movie that are not reviewed by Brittany Harris. ### Context: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) ###Answer: SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = ""Brittany Harris"") GROUP BY mID" "convert the question into postgresql query using the context values ### Question: What are the ids of the movies that are not reviewed by Brittany Harris. ### Context: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) ###Answer: SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = ""Brittany Harris""" "convert the question into postgresql query using the context values ### Question: Find the average rating star for each movie that received at least 2 ratings. ### Context: CREATE TABLE Rating (mID VARCHAR, stars INTEGER) ###Answer: SELECT mID, AVG(stars) FROM Rating GROUP BY mID HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: find the ids of reviewers who did not give 4 star. ### Context: CREATE TABLE Rating (rID VARCHAR, stars VARCHAR) ###Answer: SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4" "convert the question into postgresql query using the context values ### Question: Find the ids of reviewers who didn't only give 4 star. ### Context: CREATE TABLE Rating (rID VARCHAR, stars VARCHAR) ###Answer: SELECT rID FROM Rating WHERE stars <> 4" "convert the question into postgresql query using the context values ### Question: What are names of the movies that are either made after 2000 or reviewed by Brittany Harris? ### Context: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) ###Answer: SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Brittany Harris' OR T2.year > 2000" "convert the question into postgresql query using the context values ### Question: What are names of the movies that are either made before 1980 or directed by James Cameron? ### Context: CREATE TABLE Movie (title VARCHAR, director VARCHAR, YEAR VARCHAR) ###Answer: SELECT title FROM Movie WHERE director = ""James Cameron"" OR YEAR < 1980" "convert the question into postgresql query using the context values ### Question: What are the names of reviewers who had rated 3 star and 4 star? ### Context: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR, stars VARCHAR) ###Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 4" "convert the question into postgresql query using the context values ### Question: What are the names of movies that get 3 star and 4 star? ### Context: CREATE TABLE Rating (mID VARCHAR, stars VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) ###Answer: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 3 INTERSECT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 4" "convert the question into postgresql query using the context values ### Question: How many counties are there? ### Context: CREATE TABLE county_public_safety (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM county_public_safety" "convert the question into postgresql query using the context values ### Question: List the names of counties in descending order of population. ### Context: CREATE TABLE county_public_safety (Name VARCHAR, Population VARCHAR) ###Answer: SELECT Name FROM county_public_safety ORDER BY Population DESC" "convert the question into postgresql query using the context values ### Question: List the distinct police forces of counties whose location is not on east side. ### Context: CREATE TABLE county_public_safety (Police_force VARCHAR, LOCATION VARCHAR) ###Answer: SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION <> ""East""" "convert the question into postgresql query using the context values ### Question: What are the minimum and maximum crime rate of counties? ### Context: CREATE TABLE county_public_safety (Crime_rate INTEGER) ###Answer: SELECT MIN(Crime_rate), MAX(Crime_rate) FROM county_public_safety" "convert the question into postgresql query using the context values ### Question: Show the crime rates of counties in ascending order of number of police officers. ### Context: CREATE TABLE county_public_safety (Crime_rate VARCHAR, Police_officers VARCHAR) ###Answer: SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers" "convert the question into postgresql query using the context values ### Question: What are the names of cities in ascending alphabetical order? ### Context: CREATE TABLE city (Name VARCHAR) ###Answer: SELECT Name FROM city ORDER BY Name" "convert the question into postgresql query using the context values ### Question: What are the percentage of hispanics in cities with the black percentage higher than 10? ### Context: CREATE TABLE city (Hispanic VARCHAR, Black INTEGER) ###Answer: SELECT Hispanic FROM city WHERE Black > 10" "convert the question into postgresql query using the context values ### Question: List the name of the county with the largest population. ### Context: CREATE TABLE county_public_safety (Name VARCHAR, Population VARCHAR) ###Answer: SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the names of the city with the top 5 white percentages. ### Context: CREATE TABLE city (Name VARCHAR, White VARCHAR) ###Answer: SELECT Name FROM city ORDER BY White DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: Show names of cities and names of counties they are in. ### Context: CREATE TABLE city (Name VARCHAR, County_ID VARCHAR); CREATE TABLE county_public_safety (Name VARCHAR, County_ID VARCHAR) ###Answer: SELECT T1.Name, T2.Name FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID" "convert the question into postgresql query using the context values ### Question: Show white percentages of cities and the crime rates of counties they are in. ### Context: CREATE TABLE city (White VARCHAR, County_ID VARCHAR); CREATE TABLE county_public_safety (Crime_rate VARCHAR, County_ID VARCHAR) ###Answer: SELECT T1.White, T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID" "convert the question into postgresql query using the context values ### Question: Show the name of cities in the county that has the largest number of police officers. ### Context: CREATE TABLE city (name VARCHAR, county_ID VARCHAR, Police_officers VARCHAR); CREATE TABLE county_public_safety (name VARCHAR, county_ID VARCHAR, Police_officers VARCHAR) ###Answer: SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1)" "convert the question into postgresql query using the context values ### Question: Show the number of cities in counties that have a population more than 20000. ### Context: CREATE TABLE county_public_safety (county_ID VARCHAR, population INTEGER); CREATE TABLE city (county_ID VARCHAR, population INTEGER) ###Answer: SELECT COUNT(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE population > 20000)" "convert the question into postgresql query using the context values ### Question: Show the crime rate of counties with a city having white percentage more than 90. ### Context: CREATE TABLE county_public_safety (Crime_rate VARCHAR, County_ID VARCHAR); CREATE TABLE city (County_ID VARCHAR, White INTEGER) ###Answer: SELECT T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID WHERE T1.White > 90" "convert the question into postgresql query using the context values ### Question: Please show the police forces and the number of counties with each police force. ### Context: CREATE TABLE county_public_safety (Police_force VARCHAR) ###Answer: SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force" "convert the question into postgresql query using the context values ### Question: What is the location shared by most counties? ### Context: CREATE TABLE county_public_safety (LOCATION VARCHAR) ###Answer: SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the names of counties that do not have any cities. ### Context: CREATE TABLE city (Name VARCHAR, County_ID VARCHAR); CREATE TABLE county_public_safety (Name VARCHAR, County_ID VARCHAR) ###Answer: SELECT Name FROM county_public_safety WHERE NOT County_ID IN (SELECT County_ID FROM city)" "convert the question into postgresql query using the context values ### Question: Show the police force shared by counties with location on the east and west. ### Context: CREATE TABLE county_public_safety (Police_force VARCHAR, LOCATION VARCHAR) ###Answer: SELECT Police_force FROM county_public_safety WHERE LOCATION = ""East"" INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = ""West""" "convert the question into postgresql query using the context values ### Question: Show the names of cities in counties that have a crime rate less than 100. ### Context: CREATE TABLE county_public_safety (name VARCHAR, county_id VARCHAR, Crime_rate INTEGER); CREATE TABLE city (name VARCHAR, county_id VARCHAR, Crime_rate INTEGER) ###Answer: SELECT name FROM city WHERE county_id IN (SELECT county_id FROM county_public_safety WHERE Crime_rate < 100)" "convert the question into postgresql query using the context values ### Question: Show the case burden of counties in descending order of population. ### Context: CREATE TABLE county_public_safety (Case_burden VARCHAR, Population VARCHAR) ###Answer: SELECT Case_burden FROM county_public_safety ORDER BY Population DESC" "convert the question into postgresql query using the context values ### Question: Find the names of all modern rooms with a base price below $160 and two beds. ### Context: CREATE TABLE Rooms (roomName VARCHAR, decor VARCHAR, basePrice VARCHAR, beds VARCHAR) ###Answer: SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern'" "convert the question into postgresql query using the context values ### Question: Find all the rooms that have a price higher than 160 and can accommodate more than 2 people. Report room names and ids. ### Context: CREATE TABLE Rooms (roomName VARCHAR, RoomId VARCHAR, basePrice VARCHAR, maxOccupancy VARCHAR) ###Answer: SELECT roomName, RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2" "convert the question into postgresql query using the context values ### Question: Find the most popular room in the hotel. The most popular room is the room that had seen the largest number of reservations. ### Context: CREATE TABLE Reservations (Room VARCHAR); CREATE TABLE Rooms (roomName VARCHAR, RoomId VARCHAR) ###Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many kids stay in the rooms reserved by ROY SWEAZY? ### Context: CREATE TABLE Reservations (kids VARCHAR, FirstName VARCHAR, LastName VARCHAR) ###Answer: SELECT kids FROM Reservations WHERE FirstName = ""ROY"" AND LastName = ""SWEAZY""" "convert the question into postgresql query using the context values ### Question: How many times does ROY SWEAZY has reserved a room. ### Context: CREATE TABLE Reservations (FirstName VARCHAR, LastName VARCHAR) ###Answer: SELECT COUNT(*) FROM Reservations WHERE FirstName = ""ROY"" AND LastName = ""SWEAZY""" "convert the question into postgresql query using the context values ### Question: Which room has the highest rate? List the room's full name, rate, check in and check out date. ### Context: CREATE TABLE Rooms (roomName VARCHAR, RoomId VARCHAR); CREATE TABLE Reservations (Rate VARCHAR, CheckIn VARCHAR, CheckOut VARCHAR, Room VARCHAR) ###Answer: SELECT T2.roomName, T1.Rate, T1.CheckIn, T1.CheckOut FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY T1.Rate DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many adults stay in the room CONRAD SELBIG checked in on Oct 23, 2010? ### Context: CREATE TABLE Reservations (Adults VARCHAR, LastName VARCHAR, CheckIn VARCHAR, FirstName VARCHAR) ###Answer: SELECT Adults FROM Reservations WHERE CheckIn = ""2010-10-23"" AND FirstName = ""CONRAD"" AND LastName = ""SELBIG""" "convert the question into postgresql query using the context values ### Question: How many kids stay in the room DAMIEN TRACHSEL checked in on Sep 21, 2010? ### Context: CREATE TABLE Reservations (Kids VARCHAR, LastName VARCHAR, CheckIn VARCHAR, FirstName VARCHAR) ###Answer: SELECT Kids FROM Reservations WHERE CheckIn = ""2010-09-21"" AND FirstName = ""DAMIEN"" AND LastName = ""TRACHSEL""" "convert the question into postgresql query using the context values ### Question: How many king beds are there? ### Context: CREATE TABLE Rooms (beds INTEGER, bedtype VARCHAR) ###Answer: SELECT SUM(beds) FROM Rooms WHERE bedtype = 'King'" "convert the question into postgresql query using the context values ### Question: List the names and decor of rooms that have a king bed. Sort the list by their price. ### Context: CREATE TABLE Rooms (roomName VARCHAR, decor VARCHAR, bedtype VARCHAR, basePrice VARCHAR) ###Answer: SELECT roomName, decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice" "convert the question into postgresql query using the context values ### Question: Which room has cheapest base price? List the room's name and the base price. ### Context: CREATE TABLE Rooms (roomName VARCHAR, basePrice VARCHAR) ###Answer: SELECT roomName, basePrice FROM Rooms ORDER BY basePrice LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the decor of room Recluse and defiance? ### Context: CREATE TABLE Rooms (decor VARCHAR, roomName VARCHAR) ###Answer: SELECT decor FROM Rooms WHERE roomName = ""Recluse and defiance""" "convert the question into postgresql query using the context values ### Question: What is the average base price of different bed type? List bed type and average base price. ### Context: CREATE TABLE Rooms (bedType VARCHAR, basePrice INTEGER) ###Answer: SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType" "convert the question into postgresql query using the context values ### Question: What is the total number of people who could stay in the modern rooms in this inn? ### Context: CREATE TABLE Rooms (maxOccupancy INTEGER, decor VARCHAR) ###Answer: SELECT SUM(maxOccupancy) FROM Rooms WHERE decor = 'modern'" "convert the question into postgresql query using the context values ### Question: What kind of decor has the least number of reservations? ### Context: CREATE TABLE Reservations (Room VARCHAR); CREATE TABLE Rooms (decor VARCHAR, RoomId VARCHAR) ###Answer: SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T2.decor ORDER BY COUNT(T2.decor) LIMIT 1" "convert the question into postgresql query using the context values ### Question: List how many times the number of people in the room reached the maximum occupancy of the room. The number of people include adults and kids. ### Context: CREATE TABLE Rooms (RoomId VARCHAR, maxOccupancy VARCHAR); CREATE TABLE Reservations (Room VARCHAR, Adults VARCHAR, Kids VARCHAR) ###Answer: SELECT COUNT(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids" "convert the question into postgresql query using the context values ### Question: Find the first and last names of people who payed more than the rooms' base prices. ### Context: CREATE TABLE Reservations (firstname VARCHAR, lastname VARCHAR, Room VARCHAR, Rate VARCHAR); CREATE TABLE Rooms (RoomId VARCHAR, basePrice VARCHAR) ###Answer: SELECT T1.firstname, T1.lastname FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T1.Rate - T2.basePrice > 0" "convert the question into postgresql query using the context values ### Question: How many rooms are there? ### Context: CREATE TABLE Rooms (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Rooms" "convert the question into postgresql query using the context values ### Question: Find the number of rooms with a king bed. ### Context: CREATE TABLE Rooms (bedType VARCHAR) ###Answer: SELECT COUNT(*) FROM Rooms WHERE bedType = ""King""" "convert the question into postgresql query using the context values ### Question: Find the number of rooms for each bed type. ### Context: CREATE TABLE Rooms (bedType VARCHAR) ###Answer: SELECT bedType, COUNT(*) FROM Rooms GROUP BY bedType" "convert the question into postgresql query using the context values ### Question: Find the name of the room with the maximum occupancy. ### Context: CREATE TABLE Rooms (roomName VARCHAR, maxOccupancy VARCHAR) ###Answer: SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the id and name of the most expensive base price room. ### Context: CREATE TABLE Rooms (RoomId VARCHAR, roomName VARCHAR, basePrice VARCHAR) ###Answer: SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the type of bed and name of all traditional rooms. ### Context: CREATE TABLE Rooms (roomName VARCHAR, bedType VARCHAR, decor VARCHAR) ###Answer: SELECT roomName, bedType FROM Rooms WHERE decor = ""traditional""" "convert the question into postgresql query using the context values ### Question: Find the number of rooms with king bed for each decor type. ### Context: CREATE TABLE Rooms (decor VARCHAR, bedType VARCHAR) ###Answer: SELECT decor, COUNT(*) FROM Rooms WHERE bedType = ""King"" GROUP BY decor" "convert the question into postgresql query using the context values ### Question: Find the average and minimum price of the rooms in different decor. ### Context: CREATE TABLE Rooms (decor VARCHAR, basePrice INTEGER) ###Answer: SELECT decor, AVG(basePrice), MIN(basePrice) FROM Rooms GROUP BY decor" "convert the question into postgresql query using the context values ### Question: List the name of all rooms sorted by their prices. ### Context: CREATE TABLE Rooms (roomName VARCHAR, basePrice VARCHAR) ###Answer: SELECT roomName FROM Rooms ORDER BY basePrice" "convert the question into postgresql query using the context values ### Question: Find the number of rooms with price higher than 120 for different decor. ### Context: CREATE TABLE Rooms (decor VARCHAR, basePrice INTEGER) ###Answer: SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor" "convert the question into postgresql query using the context values ### Question: List the name of rooms with king or queen bed. ### Context: CREATE TABLE Rooms (roomName VARCHAR, bedType VARCHAR) ###Answer: SELECT roomName FROM Rooms WHERE bedType = ""King"" OR bedType = ""Queen""" "convert the question into postgresql query using the context values ### Question: How many different types of beds are there? ### Context: CREATE TABLE Rooms (bedType VARCHAR) ###Answer: SELECT COUNT(DISTINCT bedType) FROM Rooms" "convert the question into postgresql query using the context values ### Question: Find the name and id of the top 3 expensive rooms. ### Context: CREATE TABLE Rooms (RoomId VARCHAR, roomName VARCHAR, basePrice VARCHAR) ###Answer: SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Find the name of rooms whose price is higher than the average price. ### Context: CREATE TABLE Rooms (roomName VARCHAR, basePrice INTEGER) ###Answer: SELECT roomName FROM Rooms WHERE basePrice > (SELECT AVG(basePrice) FROM Rooms)" "convert the question into postgresql query using the context values ### Question: Find the number of rooms that do not have any reservation. ### Context: CREATE TABLE rooms (roomid VARCHAR, room VARCHAR); CREATE TABLE reservations (roomid VARCHAR, room VARCHAR) ###Answer: SELECT COUNT(*) FROM rooms WHERE NOT roomid IN (SELECT DISTINCT room FROM reservations)" "convert the question into postgresql query using the context values ### Question: Return the name and number of reservations made for each of the rooms. ### Context: CREATE TABLE Reservations (Room VARCHAR); CREATE TABLE Rooms (roomName VARCHAR, RoomId VARCHAR) ###Answer: SELECT T2.roomName, COUNT(*), T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room" "convert the question into postgresql query using the context values ### Question: Find the names of rooms that have been reserved for more than 60 times. ### Context: CREATE TABLE Reservations (Room VARCHAR); CREATE TABLE Rooms (roomName VARCHAR, RoomId VARCHAR) ###Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING COUNT(*) > 60" "convert the question into postgresql query using the context values ### Question: Find the name of rooms whose base price is between 120 and 150. ### Context: CREATE TABLE rooms (roomname VARCHAR, baseprice INTEGER) ###Answer: SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150" "convert the question into postgresql query using the context values ### Question: Find the name of rooms booked by some customers whose first name contains ROY. ### Context: CREATE TABLE Reservations (Room VARCHAR); CREATE TABLE Rooms (roomName VARCHAR, RoomId VARCHAR) ###Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'" "convert the question into postgresql query using the context values ### Question: what are the details of the cmi masters that have the cross reference code 'Tax'? ### Context: CREATE TABLE CMI_Cross_References (master_customer_id VARCHAR, source_system_code VARCHAR); CREATE TABLE Customer_Master_Index (cmi_details VARCHAR, master_customer_id VARCHAR) ###Answer: SELECT T1.cmi_details FROM Customer_Master_Index AS T1 JOIN CMI_Cross_References AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T2.source_system_code = 'Tax'" "convert the question into postgresql query using the context values ### Question: What is the cmi cross reference id that is related to at least one council tax entry? List the cross reference id and source system code. ### Context: CREATE TABLE Council_Tax (cmi_cross_ref_id VARCHAR); CREATE TABLE CMI_Cross_References (cmi_cross_ref_id VARCHAR, source_system_code VARCHAR) ###Answer: SELECT T1.cmi_cross_ref_id, T1.source_system_code FROM CMI_Cross_References AS T1 JOIN Council_Tax AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T1.cmi_cross_ref_id HAVING COUNT(*) >= 1" "convert the question into postgresql query using the context values ### Question: How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the n ### Context: CREATE TABLE CMI_Cross_References (cmi_cross_ref_id VARCHAR, master_customer_id VARCHAR); CREATE TABLE Business_Rates (cmi_cross_ref_id VARCHAR) ###Answer: SELECT T2.cmi_cross_ref_id, T2.master_customer_id, COUNT(*) FROM Business_Rates AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T2.cmi_cross_ref_id" "convert the question into postgresql query using the context values ### Question: What is the tax source system code related to the benefits and overpayments? List the code and the benifit id, order by benifit id. ### Context: CREATE TABLE CMI_Cross_References (source_system_code VARCHAR, cmi_cross_ref_id VARCHAR); CREATE TABLE Benefits_Overpayments (council_tax_id VARCHAR, cmi_cross_ref_id VARCHAR) ###Answer: SELECT T1.source_system_code, T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Benefits_Overpayments AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id ORDER BY T2.council_tax_id" "convert the question into postgresql query using the context values ### Question: Wat is the tax source system code and master customer id of the taxes related to each parking fine id? ### Context: CREATE TABLE CMI_Cross_References (source_system_code VARCHAR, master_customer_id VARCHAR, cmi_cross_ref_id VARCHAR); CREATE TABLE Parking_Fines (council_tax_id VARCHAR, cmi_cross_ref_id VARCHAR) ###Answer: SELECT T1.source_system_code, T1.master_customer_id, T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Parking_Fines AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id" "convert the question into postgresql query using the context values ### Question: What are the renting arrears tax ids related to the customer master index whose detail is not 'Schmidt, Kertzmann and Lubowitz'? ### Context: CREATE TABLE Rent_Arrears (council_tax_id VARCHAR, cmi_cross_ref_id VARCHAR); CREATE TABLE Customer_Master_Index (master_customer_id VARCHAR, cmi_details VARCHAR); CREATE TABLE CMI_Cross_References (cmi_cross_ref_id VARCHAR, master_customer_id VARCHAR) ###Answer: SELECT T1.council_tax_id FROM Rent_Arrears AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id JOIN Customer_Master_Index AS T3 ON T3.master_customer_id = T2.master_customer_id WHERE T3.cmi_details <> 'Schmidt , Kertzmann and Lubowitz'" "convert the question into postgresql query using the context values ### Question: What are the register ids of electoral registries that have the cross reference source system code 'Electoral' or 'Tax'? ### Context: CREATE TABLE Electoral_Register (electoral_register_id VARCHAR, cmi_cross_ref_id VARCHAR); CREATE TABLE CMI_Cross_References (cmi_cross_ref_id VARCHAR, source_system_code VARCHAR) ###Answer: SELECT T1.electoral_register_id FROM Electoral_Register AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id WHERE T2.source_system_code = 'Electoral' OR T2.source_system_code = 'Tax'" "convert the question into postgresql query using the context values ### Question: How many different source system code for the cmi cross references are there? ### Context: CREATE TABLE CMI_cross_references (source_system_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT source_system_code) FROM CMI_cross_references" "convert the question into postgresql query using the context values ### Question: List all information about customer master index, and sort them by details in descending order. ### Context: CREATE TABLE customer_master_index (cmi_details VARCHAR) ###Answer: SELECT * FROM customer_master_index ORDER BY cmi_details DESC" "convert the question into postgresql query using the context values ### Question: List the council tax ids and their related cmi cross references of all the parking fines. ### Context: CREATE TABLE parking_fines (council_tax_id VARCHAR, cmi_cross_ref_id VARCHAR) ###Answer: SELECT council_tax_id, cmi_cross_ref_id FROM parking_fines" "convert the question into postgresql query using the context values ### Question: How many council taxes are collected for renting arrears ? ### Context: CREATE TABLE rent_arrears (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM rent_arrears" "convert the question into postgresql query using the context values ### Question: What are the distinct cross reference source system codes which are related to the master customer details 'Gottlieb, Becker and Wyman'? ### Context: CREATE TABLE customer_master_index (master_customer_id VARCHAR, cmi_details VARCHAR); CREATE TABLE cmi_cross_references (source_system_code VARCHAR, master_customer_id VARCHAR) ###Answer: SELECT DISTINCT T2.source_system_code FROM customer_master_index AS T1 JOIN cmi_cross_references AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T1.cmi_details = 'Gottlieb , Becker and Wyman'" "convert the question into postgresql query using the context values ### Question: Which cmi cross reference id is not related to any parking taxes? ### Context: CREATE TABLE parking_fines (cmi_cross_ref_id VARCHAR); CREATE TABLE cmi_cross_references (cmi_cross_ref_id VARCHAR) ###Answer: SELECT cmi_cross_ref_id FROM cmi_cross_references EXCEPT SELECT cmi_cross_ref_id FROM parking_fines" "convert the question into postgresql query using the context values ### Question: Which distinct source system code includes the substring 'en'? ### Context: CREATE TABLE cmi_cross_references (source_system_code VARCHAR) ###Answer: SELECT DISTINCT source_system_code FROM cmi_cross_references WHERE source_system_code LIKE '%en%'" "convert the question into postgresql query using the context values ### Question: How many parties are there? ### Context: CREATE TABLE party (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM party" "convert the question into postgresql query using the context values ### Question: List the themes of parties in ascending order of number of hosts. ### Context: CREATE TABLE party (Party_Theme VARCHAR, Number_of_hosts VARCHAR) ###Answer: SELECT Party_Theme FROM party ORDER BY Number_of_hosts" "convert the question into postgresql query using the context values ### Question: What are the themes and locations of parties? ### Context: CREATE TABLE party (Party_Theme VARCHAR, LOCATION VARCHAR) ###Answer: SELECT Party_Theme, LOCATION FROM party" "convert the question into postgresql query using the context values ### Question: Show the first year and last year of parties with theme ""Spring"" or ""Teqnology"". ### Context: CREATE TABLE party (First_year VARCHAR, Last_year VARCHAR, Party_Theme VARCHAR) ###Answer: SELECT First_year, Last_year FROM party WHERE Party_Theme = ""Spring"" OR Party_Theme = ""Teqnology""" "convert the question into postgresql query using the context values ### Question: What is the average number of hosts for parties? ### Context: CREATE TABLE party (Number_of_hosts INTEGER) ###Answer: SELECT AVG(Number_of_hosts) FROM party" "convert the question into postgresql query using the context values ### Question: What is the location of the party with the most hosts? ### Context: CREATE TABLE party (LOCATION VARCHAR, Number_of_hosts VARCHAR) ###Answer: SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show different nationalities along with the number of hosts of each nationality. ### Context: CREATE TABLE HOST (Nationality VARCHAR) ###Answer: SELECT Nationality, COUNT(*) FROM HOST GROUP BY Nationality" "convert the question into postgresql query using the context values ### Question: Show the most common nationality of hosts. ### Context: CREATE TABLE HOST (Nationality VARCHAR) ###Answer: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the nations that have both hosts older than 45 and hosts younger than 35. ### Context: CREATE TABLE HOST (Nationality VARCHAR, Age INTEGER) ###Answer: SELECT Nationality FROM HOST WHERE Age > 45 INTERSECT SELECT Nationality FROM HOST WHERE Age < 35" "convert the question into postgresql query using the context values ### Question: Show the themes of parties and the names of the party hosts. ### Context: CREATE TABLE HOST (Name VARCHAR, Host_ID VARCHAR); CREATE TABLE party_host (Host_ID VARCHAR, Party_ID VARCHAR); CREATE TABLE party (Party_Theme VARCHAR, Party_ID VARCHAR) ###Answer: SELECT T3.Party_Theme, T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID" "convert the question into postgresql query using the context values ### Question: Show the locations of parties and the names of the party hosts in ascending order of the age of the host. ### Context: CREATE TABLE party (Location VARCHAR, Party_ID VARCHAR); CREATE TABLE HOST (Name VARCHAR, Host_ID VARCHAR, Age VARCHAR); CREATE TABLE party_host (Host_ID VARCHAR, Party_ID VARCHAR) ###Answer: SELECT T3.Location, T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID ORDER BY T2.Age" "convert the question into postgresql query using the context values ### Question: Show the locations of parties with hosts older than 50. ### Context: CREATE TABLE party (Location VARCHAR, Party_ID VARCHAR); CREATE TABLE party_host (Host_ID VARCHAR, Party_ID VARCHAR); CREATE TABLE HOST (Host_ID VARCHAR, Age INTEGER) ###Answer: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T2.Age > 50" "convert the question into postgresql query using the context values ### Question: Show the host names for parties with number of hosts greater than 20. ### Context: CREATE TABLE HOST (Name VARCHAR, Host_ID VARCHAR); CREATE TABLE party_host (Host_ID VARCHAR, Party_ID VARCHAR); CREATE TABLE party (Party_ID VARCHAR, Number_of_hosts INTEGER) ###Answer: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T3.Number_of_hosts > 20" "convert the question into postgresql query using the context values ### Question: Show the name and the nationality of the oldest host. ### Context: CREATE TABLE HOST (Name VARCHAR, Nationality VARCHAR, Age VARCHAR) ###Answer: SELECT Name, Nationality FROM HOST ORDER BY Age DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the names of hosts who did not serve as a host of any party in our record. ### Context: CREATE TABLE HOST (Name VARCHAR, Host_ID VARCHAR); CREATE TABLE party_host (Name VARCHAR, Host_ID VARCHAR) ###Answer: SELECT Name FROM HOST WHERE NOT Host_ID IN (SELECT Host_ID FROM party_host)" "convert the question into postgresql query using the context values ### Question: Show all region code and region name sorted by the codes. ### Context: CREATE TABLE region (region_code VARCHAR, region_name VARCHAR) ###Answer: SELECT region_code, region_name FROM region ORDER BY region_code" "convert the question into postgresql query using the context values ### Question: List all region names in alphabetical order. ### Context: CREATE TABLE region (region_name VARCHAR) ###Answer: SELECT region_name FROM region ORDER BY region_name" "convert the question into postgresql query using the context values ### Question: Show names for all regions except for Denmark. ### Context: CREATE TABLE region (region_name VARCHAR) ###Answer: SELECT region_name FROM region WHERE region_name <> 'Denmark'" "convert the question into postgresql query using the context values ### Question: How many storms had death records? ### Context: CREATE TABLE storm (Number_Deaths INTEGER) ###Answer: SELECT COUNT(*) FROM storm WHERE Number_Deaths > 0" "convert the question into postgresql query using the context values ### Question: List name, dates active, and number of deaths for all storms with at least 1 death. ### Context: CREATE TABLE storm (name VARCHAR, dates_active VARCHAR, number_deaths VARCHAR) ###Answer: SELECT name, dates_active, number_deaths FROM storm WHERE number_deaths >= 1" "convert the question into postgresql query using the context values ### Question: Show the average and maximum damage for all storms with max speed higher than 1000. ### Context: CREATE TABLE storm (damage_millions_USD INTEGER, max_speed INTEGER) ###Answer: SELECT AVG(damage_millions_USD), MAX(damage_millions_USD) FROM storm WHERE max_speed > 1000" "convert the question into postgresql query using the context values ### Question: What is the total number of deaths and damage for all storms with a max speed greater than the average? ### Context: CREATE TABLE storm (number_deaths INTEGER, damage_millions_USD INTEGER, max_speed INTEGER) ###Answer: SELECT SUM(number_deaths), SUM(damage_millions_USD) FROM storm WHERE max_speed > (SELECT AVG(max_speed) FROM storm)" "convert the question into postgresql query using the context values ### Question: List name and damage for all storms in a descending order of max speed. ### Context: CREATE TABLE storm (name VARCHAR, damage_millions_USD VARCHAR, max_speed VARCHAR) ###Answer: SELECT name, damage_millions_USD FROM storm ORDER BY max_speed DESC" "convert the question into postgresql query using the context values ### Question: How many regions are affected? ### Context: CREATE TABLE affected_region (region_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT region_id) FROM affected_region" "convert the question into postgresql query using the context values ### Question: Show the name for regions not affected. ### Context: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_name VARCHAR, region_id VARCHAR) ###Answer: SELECT region_name FROM region WHERE NOT region_id IN (SELECT region_id FROM affected_region)" "convert the question into postgresql query using the context values ### Question: Show the name for regions and the number of storms for each region. ### Context: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR) ###Answer: SELECT T1.region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id" "convert the question into postgresql query using the context values ### Question: List the name for storms and the number of affected regions for each storm. ### Context: CREATE TABLE affected_region (storm_id VARCHAR); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) ###Answer: SELECT T1.name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id" "convert the question into postgresql query using the context values ### Question: What is the storm name and max speed which affected the greatest number of regions? ### Context: CREATE TABLE storm (name VARCHAR, max_speed VARCHAR, storm_id VARCHAR); CREATE TABLE affected_region (storm_id VARCHAR) ###Answer: SELECT T1.name, T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the name of storms which don't have affected region in record. ### Context: CREATE TABLE affected_region (name VARCHAR, storm_id VARCHAR); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) ###Answer: SELECT name FROM storm WHERE NOT storm_id IN (SELECT storm_id FROM affected_region)" "convert the question into postgresql query using the context values ### Question: Show storm name with at least two regions and 10 cities affected. ### Context: CREATE TABLE affected_region (storm_id VARCHAR, number_city_affected INTEGER); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) ###Answer: SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING SUM(T2.number_city_affected) >= 10" "convert the question into postgresql query using the context values ### Question: Show all storm names except for those with at least two affected regions. ### Context: CREATE TABLE storm (name VARCHAR); CREATE TABLE affected_region (storm_id VARCHAR); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) ###Answer: SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What are the region names affected by the storm with a number of deaths of least 10? ### Context: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE storm (storm_id VARCHAR, number_deaths VARCHAR) ###Answer: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10" "convert the question into postgresql query using the context values ### Question: Show all storm names affecting region ""Denmark"". ### Context: CREATE TABLE region (region_id VARCHAR, region_name VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE storm (name VARCHAR, storm_id VARCHAR) ###Answer: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'" "convert the question into postgresql query using the context values ### Question: Show the region name with at least two storms. ### Context: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR) ###Answer: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Find the names of the regions which were affected by the storm that killed the greatest number of people. ### Context: CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE storm (storm_id VARCHAR, Number_Deaths VARCHAR) ###Answer: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of the storm that affected both Afghanistan and Albania regions. ### Context: CREATE TABLE storm (Name VARCHAR, storm_id VARCHAR); CREATE TABLE affected_region (region_id VARCHAR, storm_id VARCHAR); CREATE TABLE region (region_id VARCHAR, Region_name VARCHAR) ###Answer: SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Albania'" "convert the question into postgresql query using the context values ### Question: How many counties are there in total? ### Context: CREATE TABLE county (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM county" "convert the question into postgresql query using the context values ### Question: Show the county name and population of all counties. ### Context: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) ###Answer: SELECT County_name, Population FROM county" "convert the question into postgresql query using the context values ### Question: Show the average population of all counties. ### Context: CREATE TABLE county (Population INTEGER) ###Answer: SELECT AVG(Population) FROM county" "convert the question into postgresql query using the context values ### Question: Return the maximum and minimum population among all counties. ### Context: CREATE TABLE county (Population INTEGER) ###Answer: SELECT MAX(Population), MIN(Population) FROM county" "convert the question into postgresql query using the context values ### Question: Show all the distinct districts for elections. ### Context: CREATE TABLE election (District VARCHAR) ###Answer: SELECT DISTINCT District FROM election" "convert the question into postgresql query using the context values ### Question: Show the zip code of the county with name ""Howard"". ### Context: CREATE TABLE county (Zip_code VARCHAR, County_name VARCHAR) ###Answer: SELECT Zip_code FROM county WHERE County_name = ""Howard""" "convert the question into postgresql query using the context values ### Question: Show the delegate from district 1 in election. ### Context: CREATE TABLE election (Delegate VARCHAR, District VARCHAR) ###Answer: SELECT Delegate FROM election WHERE District = 1" "convert the question into postgresql query using the context values ### Question: Show the delegate and committee information of elections. ### Context: CREATE TABLE election (Delegate VARCHAR, Committee VARCHAR) ###Answer: SELECT Delegate, Committee FROM election" "convert the question into postgresql query using the context values ### Question: How many distinct governors are there? ### Context: CREATE TABLE party (Governor VARCHAR) ###Answer: SELECT COUNT(DISTINCT Governor) FROM party" "convert the question into postgresql query using the context values ### Question: Show the lieutenant governor and comptroller from the democratic party. ### Context: CREATE TABLE party (Lieutenant_Governor VARCHAR, Comptroller VARCHAR, Party VARCHAR) ###Answer: SELECT Lieutenant_Governor, Comptroller FROM party WHERE Party = ""Democratic""" "convert the question into postgresql query using the context values ### Question: In which distinct years was the governor ""Eliot Spitzer""? ### Context: CREATE TABLE party (YEAR VARCHAR, Governor VARCHAR) ###Answer: SELECT DISTINCT YEAR FROM party WHERE Governor = ""Eliot Spitzer""" "convert the question into postgresql query using the context values ### Question: Show all the information about election. ### Context: CREATE TABLE election (Id VARCHAR) ###Answer: SELECT * FROM election" "convert the question into postgresql query using the context values ### Question: Show the delegates and the names of county they belong to. ### Context: CREATE TABLE election (Delegate VARCHAR, District VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) ###Answer: SELECT T2.Delegate, T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District" "convert the question into postgresql query using the context values ### Question: Which delegates are from counties with population smaller than 100000? ### Context: CREATE TABLE election (Delegate VARCHAR, District VARCHAR); CREATE TABLE county (County_id VARCHAR, Population INTEGER) ###Answer: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000" "convert the question into postgresql query using the context values ### Question: How many distinct delegates are from counties with population larger than 50000? ### Context: CREATE TABLE election (Delegate VARCHAR, District VARCHAR); CREATE TABLE county (County_id VARCHAR, Population INTEGER) ###Answer: SELECT COUNT(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000" "convert the question into postgresql query using the context values ### Question: What are the names of the county that the delegates on ""Appropriations"" committee belong to? ### Context: CREATE TABLE election (District VARCHAR, Committee VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) ###Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = ""Appropriations""" "convert the question into postgresql query using the context values ### Question: Show the delegates and the names of the party they belong to. ### Context: CREATE TABLE election (Delegate VARCHAR, Party VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) ###Answer: SELECT T1.Delegate, T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID" "convert the question into postgresql query using the context values ### Question: Who were the governors of the parties associated with delegates from district 1? ### Context: CREATE TABLE party (Governor VARCHAR, Party_ID VARCHAR); CREATE TABLE election (Party VARCHAR, District VARCHAR) ###Answer: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1" "convert the question into postgresql query using the context values ### Question: Who were the comptrollers of the parties associated with the delegates from district 1 or district 2? ### Context: CREATE TABLE party (Comptroller VARCHAR, Party_ID VARCHAR); CREATE TABLE election (Party VARCHAR, District VARCHAR) ###Answer: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2" "convert the question into postgresql query using the context values ### Question: Return all the committees that have delegates from Democratic party. ### Context: CREATE TABLE election (Committee VARCHAR, Party VARCHAR); CREATE TABLE party (Party_ID VARCHAR, Party VARCHAR) ###Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = ""Democratic""" "convert the question into postgresql query using the context values ### Question: Show the name of each county along with the corresponding number of delegates from that county. ### Context: CREATE TABLE election (District VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) ###Answer: SELECT T1.County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id" "convert the question into postgresql query using the context values ### Question: Show the name of each party and the corresponding number of delegates from that party. ### Context: CREATE TABLE election (Party VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) ###Answer: SELECT T2.Party, COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party" "convert the question into postgresql query using the context values ### Question: Return the names of all counties sorted by population in ascending order. ### Context: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) ###Answer: SELECT County_name FROM county ORDER BY Population" "convert the question into postgresql query using the context values ### Question: Return the names of all counties sorted by county name in descending alphabetical order. ### Context: CREATE TABLE county (County_name VARCHAR) ###Answer: SELECT County_name FROM county ORDER BY County_name DESC" "convert the question into postgresql query using the context values ### Question: Show the name of the county with the biggest population. ### Context: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) ###Answer: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the 3 counties with the smallest population. ### Context: CREATE TABLE county (County_name VARCHAR, Population VARCHAR) ###Answer: SELECT County_name FROM county ORDER BY Population LIMIT 3" "convert the question into postgresql query using the context values ### Question: Show the names of counties that have at least two delegates. ### Context: CREATE TABLE election (District VARCHAR); CREATE TABLE county (County_name VARCHAR, County_id VARCHAR) ###Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the name of the party that has at least two records. ### Context: CREATE TABLE party (Party VARCHAR) ###Answer: SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Show the name of the party that has the most delegates. ### Context: CREATE TABLE election (Party VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) ###Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the people that have been governor the most times. ### Context: CREATE TABLE party (Governor VARCHAR) ###Answer: SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the people that have been comptroller the most times and the corresponding number of times. ### Context: CREATE TABLE party (Comptroller VARCHAR) ###Answer: SELECT Comptroller, COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the names of parties that do not have delegates in election? ### Context: CREATE TABLE election (Party VARCHAR, Party_ID VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) ###Answer: SELECT Party FROM party WHERE NOT Party_ID IN (SELECT Party FROM election)" "convert the question into postgresql query using the context values ### Question: What are the names of parties that have both delegates on ""Appropriations"" committee and ### Context: CREATE TABLE election (Party VARCHAR, Committee VARCHAR); CREATE TABLE party (Party VARCHAR, Party_ID VARCHAR) ###Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = ""Appropriations"" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = ""Economic Matters""" "convert the question into postgresql query using the context values ### Question: Which committees have delegates from both democratic party and liberal party? ### Context: CREATE TABLE election (Committee VARCHAR, Party VARCHAR); CREATE TABLE party (Party_ID VARCHAR, Party VARCHAR) ###Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = ""Democratic"" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = ""Liberal""" "convert the question into postgresql query using the context values ### Question: How many journalists are there? ### Context: CREATE TABLE journalist (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM journalist" "convert the question into postgresql query using the context values ### Question: List the names of journalists in ascending order of years working. ### Context: CREATE TABLE journalist (Name VARCHAR, Years_working VARCHAR) ###Answer: SELECT Name FROM journalist ORDER BY Years_working" "convert the question into postgresql query using the context values ### Question: What are the nationalities and ages of journalists? ### Context: CREATE TABLE journalist (Nationality VARCHAR, Age VARCHAR) ###Answer: SELECT Nationality, Age FROM journalist" "convert the question into postgresql query using the context values ### Question: Show the names of journalists from ""England"" or ""Wales"". ### Context: CREATE TABLE journalist (Name VARCHAR, Nationality VARCHAR) ###Answer: SELECT Name FROM journalist WHERE Nationality = ""England"" OR Nationality = ""Wales""" "convert the question into postgresql query using the context values ### Question: What is the average number of years spent working as a journalist? ### Context: CREATE TABLE journalist (Years_working INTEGER) ###Answer: SELECT AVG(Years_working) FROM journalist" "convert the question into postgresql query using the context values ### Question: What is the nationality of the journalist with the largest number of years working? ### Context: CREATE TABLE journalist (Nationality VARCHAR, Years_working VARCHAR) ###Answer: SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the different nationalities and the number of journalists of each nationality. ### Context: CREATE TABLE journalist (Nationality VARCHAR) ###Answer: SELECT Nationality, COUNT(*) FROM journalist GROUP BY Nationality" "convert the question into postgresql query using the context values ### Question: Show the most common nationality for journalists. ### Context: CREATE TABLE journalist (Nationality VARCHAR) ###Answer: SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working. ### Context: CREATE TABLE journalist (Nationality VARCHAR, Years_working INTEGER) ###Answer: SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3" "convert the question into postgresql query using the context values ### Question: Show the dates, places, and names of events in descending order of the attendance. ### Context: CREATE TABLE event (Date VARCHAR, Name VARCHAR, venue VARCHAR, Event_Attendance VARCHAR) ###Answer: SELECT Date, Name, venue FROM event ORDER BY Event_Attendance DESC" "convert the question into postgresql query using the context values ### Question: Show the names of journalists and the dates of the events they reported. ### Context: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Date VARCHAR, Event_ID VARCHAR) ###Answer: SELECT T3.Name, T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID" "convert the question into postgresql query using the context values ### Question: Show the names of journalists and the names of the events they reported in ascending order ### Context: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Name VARCHAR, Event_ID VARCHAR, Event_Attendance VARCHAR) ###Answer: SELECT T3.Name, T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID ORDER BY T2.Event_Attendance" "convert the question into postgresql query using the context values ### Question: Show the names of journalists and the number of events they reported. ### Context: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Event_ID VARCHAR) ###Answer: SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name" "convert the question into postgresql query using the context values ### Question: Show the names of journalists that have reported more than one event. ### Context: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Event_ID VARCHAR, journalist_ID VARCHAR); CREATE TABLE event (Event_ID VARCHAR) ###Answer: SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: List the names of journalists who have not reported any event. ### Context: CREATE TABLE journalist (Name VARCHAR, journalist_ID VARCHAR); CREATE TABLE news_report (Name VARCHAR, journalist_ID VARCHAR) ###Answer: SELECT Name FROM journalist WHERE NOT journalist_ID IN (SELECT journalist_ID FROM news_report)" "convert the question into postgresql query using the context values ### Question: what are the average and maximum attendances of all events? ### Context: CREATE TABLE event (Event_Attendance INTEGER) ###Answer: SELECT AVG(Event_Attendance), MAX(Event_Attendance) FROM event" "convert the question into postgresql query using the context values ### Question: Find the average age and experience working length of journalists working on different role type. ### Context: CREATE TABLE news_report (work_type VARCHAR, journalist_id VARCHAR); CREATE TABLE journalist (age INTEGER, journalist_id VARCHAR) ###Answer: SELECT AVG(t1.age), AVG(Years_working), t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type" "convert the question into postgresql query using the context values ### Question: List the event venues and names that have the top 2 most number of people attended. ### Context: CREATE TABLE event (venue VARCHAR, name VARCHAR, Event_Attendance VARCHAR) ###Answer: SELECT venue, name FROM event ORDER BY Event_Attendance DESC LIMIT 2" "convert the question into postgresql query using the context values ### Question: Show me all the restaurants. ### Context: CREATE TABLE Restaurant (ResName VARCHAR) ###Answer: SELECT ResName FROM Restaurant" "convert the question into postgresql query using the context values ### Question: What is the address of the restaurant Subway? ### Context: CREATE TABLE Restaurant (Address VARCHAR, ResName VARCHAR) ###Answer: SELECT Address FROM Restaurant WHERE ResName = ""Subway""" "convert the question into postgresql query using the context values ### Question: What is the rating of the restaurant Subway? ### Context: CREATE TABLE Restaurant (Rating VARCHAR, ResName VARCHAR) ###Answer: SELECT Rating FROM Restaurant WHERE ResName = ""Subway""" "convert the question into postgresql query using the context values ### Question: List all restaurant types. ### Context: CREATE TABLE Restaurant_Type (ResTypeName VARCHAR) ###Answer: SELECT ResTypeName FROM Restaurant_Type" "convert the question into postgresql query using the context values ### Question: What is the description of the restaurant type Sandwich? ### Context: CREATE TABLE Restaurant_Type (ResTypeDescription VARCHAR, ResTypeName VARCHAR) ###Answer: SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = ""Sandwich""" "convert the question into postgresql query using the context values ### Question: Which restaurants have highest rating? List the restaurant name and its rating. ### Context: CREATE TABLE Restaurant (ResName VARCHAR, Rating VARCHAR) ###Answer: SELECT ResName, Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the age of student Linda Smith? ### Context: CREATE TABLE Student (Age VARCHAR, Fname VARCHAR, Lname VARCHAR) ###Answer: SELECT Age FROM Student WHERE Fname = ""Linda"" AND Lname = ""Smith""" "convert the question into postgresql query using the context values ### Question: What is the gender of the student Linda Smith? ### Context: CREATE TABLE Student (Sex VARCHAR, Fname VARCHAR, Lname VARCHAR) ###Answer: SELECT Sex FROM Student WHERE Fname = ""Linda"" AND Lname = ""Smith""" "convert the question into postgresql query using the context values ### Question: List all students' first names and last names who majored in 600. ### Context: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Major VARCHAR) ###Answer: SELECT Fname, Lname FROM Student WHERE Major = 600" "convert the question into postgresql query using the context values ### Question: Which city does student Linda Smith live in? ### Context: CREATE TABLE Student (city_code VARCHAR, Fname VARCHAR, Lname VARCHAR) ###Answer: SELECT city_code FROM Student WHERE Fname = ""Linda"" AND Lname = ""Smith""" "convert the question into postgresql query using the context values ### Question: Advisor 1121 has how many students? ### Context: CREATE TABLE Student (Advisor VARCHAR) ###Answer: SELECT COUNT(*) FROM Student WHERE Advisor = 1121" "convert the question into postgresql query using the context values ### Question: Which Advisor has most of students? List advisor and the number of students. ### Context: CREATE TABLE Student (Advisor VARCHAR) ###Answer: SELECT Advisor, COUNT(*) FROM Student GROUP BY Advisor ORDER BY COUNT(Advisor) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which major has least number of students? List the major and the number of students. ### Context: CREATE TABLE Student (Major VARCHAR) ###Answer: SELECT Major, COUNT(*) FROM Student GROUP BY Major ORDER BY COUNT(Major) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which major has between 2 and 30 number of students? List major and the number of students. ### Context: CREATE TABLE Student (Major VARCHAR) ###Answer: SELECT Major, COUNT(*) FROM Student GROUP BY Major HAVING COUNT(Major) BETWEEN 2 AND 30" "convert the question into postgresql query using the context values ### Question: Which student's age is older than 18 and is majoring in 600? List each student's first and last name. ### Context: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Age VARCHAR, Major VARCHAR) ###Answer: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major = 600" "convert the question into postgresql query using the context values ### Question: List all female students age is older than 18 who is not majoring in 600. List students' first name and last name. ### Context: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Sex VARCHAR, Age VARCHAR, Major VARCHAR) ###Answer: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major <> 600 AND Sex = 'F'" "convert the question into postgresql query using the context values ### Question: How many restaurant is the Sandwich type restaurant? ### Context: CREATE TABLE Type_Of_Restaurant (Id VARCHAR); CREATE TABLE Restaurant (Id VARCHAR); CREATE TABLE Restaurant_Type (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich'" "convert the question into postgresql query using the context values ### Question: How long does student Linda Smith spend on the restaurant in total? ### Context: CREATE TABLE Visits_Restaurant (Spent INTEGER); CREATE TABLE Student (Spent INTEGER) ###Answer: SELECT SUM(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = ""Linda"" AND Student.Lname = ""Smith""" "convert the question into postgresql query using the context values ### Question: How many times has the student Linda Smith visited Subway? ### Context: CREATE TABLE Visits_Restaurant (Id VARCHAR); CREATE TABLE Student (Id VARCHAR); CREATE TABLE Restaurant (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = ""Linda"" AND Student.Lname = ""Smith"" AND Restaurant.ResName = ""Subway""" "convert the question into postgresql query using the context values ### Question: When did Linda Smith visit Subway? ### Context: CREATE TABLE Restaurant (TIME VARCHAR); CREATE TABLE Visits_Restaurant (TIME VARCHAR); CREATE TABLE Student (TIME VARCHAR) ###Answer: SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = ""Linda"" AND Student.Lname = ""Smith"" AND Restaurant.ResName = ""Subway""" "convert the question into postgresql query using the context values ### Question: At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total. ### Context: CREATE TABLE Visits_Restaurant (Id VARCHAR); CREATE TABLE Restaurant (Id VARCHAR) ###Answer: SELECT Restaurant.ResName, SUM(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY SUM(Visits_Restaurant.Spent) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which student visited restaurant most often? List student's first name and last name. ### Context: CREATE TABLE Visits_Restaurant (Id VARCHAR); CREATE TABLE Student (Id VARCHAR) ###Answer: SELECT Student.Fname, Student.Lname FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the ids of orders whose status is 'Success'. ### Context: CREATE TABLE actual_orders (actual_order_id VARCHAR, order_status_code VARCHAR) ###Answer: SELECT actual_order_id FROM actual_orders WHERE order_status_code = 'Success'" "convert the question into postgresql query using the context values ### Question: Find the name and price of the product that has been ordered the greatest number of times. ### Context: CREATE TABLE products (product_name VARCHAR, product_price VARCHAR, product_id VARCHAR); CREATE TABLE regular_order_products (product_id VARCHAR) ###Answer: SELECT t1.product_name, t1.product_price FROM products AS t1 JOIN regular_order_products AS t2 ON t1.product_id = t2.product_id GROUP BY t2.product_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the number of customers in total. ### Context: CREATE TABLE customers (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM customers" "convert the question into postgresql query using the context values ### Question: How many different payment methods are there? ### Context: CREATE TABLE customers (payment_method VARCHAR) ###Answer: SELECT COUNT(DISTINCT payment_method) FROM customers" "convert the question into postgresql query using the context values ### Question: Show the details of all trucks in the order of their license number. ### Context: CREATE TABLE trucks (truck_details VARCHAR, truck_licence_number VARCHAR) ###Answer: SELECT truck_details FROM trucks ORDER BY truck_licence_number" "convert the question into postgresql query using the context values ### Question: Find the name of the most expensive product. ### Context: CREATE TABLE products (product_name VARCHAR, product_price VARCHAR) ###Answer: SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the names of customers who are not living in the state of California. ### Context: CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR); CREATE TABLE addresses (address_id VARCHAR, state_province_county VARCHAR) ###Answer: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'" "convert the question into postgresql query using the context values ### Question: List the names and emails of customers who payed by Visa card. ### Context: CREATE TABLE customers (customer_email VARCHAR, customer_name VARCHAR, payment_method VARCHAR) ###Answer: SELECT customer_email, customer_name FROM customers WHERE payment_method = 'Visa'" "convert the question into postgresql query using the context values ### Question: Find the names and phone numbers of customers living in California state. ### Context: CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE addresses (address_id VARCHAR, state_province_county VARCHAR) ###Answer: SELECT t1.customer_name, t1.customer_phone FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'" "convert the question into postgresql query using the context values ### Question: Find the states which do not have any employee in their record. ### Context: CREATE TABLE Employees (state_province_county VARCHAR, address_id VARCHAR, employee_address_id VARCHAR); CREATE TABLE addresses (state_province_county VARCHAR, address_id VARCHAR, employee_address_id VARCHAR) ###Answer: SELECT state_province_county FROM addresses WHERE NOT address_id IN (SELECT employee_address_id FROM Employees)" "convert the question into postgresql query using the context values ### Question: List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers. ### Context: CREATE TABLE Customers (customer_name VARCHAR, customer_phone VARCHAR, customer_email VARCHAR, date_became_customer VARCHAR) ###Answer: SELECT customer_name, customer_phone, customer_email FROM Customers ORDER BY date_became_customer" "convert the question into postgresql query using the context values ### Question: Find the name of the first 5 customers. ### Context: CREATE TABLE Customers (customer_name VARCHAR, date_became_customer VARCHAR) ###Answer: SELECT customer_name FROM Customers ORDER BY date_became_customer LIMIT 5" "convert the question into postgresql query using the context values ### Question: Find the payment method that is used most frequently. ### Context: CREATE TABLE Customers (payment_method VARCHAR) ###Answer: SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the names of all routes in alphabetic order. ### Context: CREATE TABLE Delivery_Routes (route_name VARCHAR) ###Answer: SELECT route_name FROM Delivery_Routes ORDER BY route_name" "convert the question into postgresql query using the context values ### Question: Find the name of route that has the highest number of deliveries. ### Context: CREATE TABLE Delivery_Routes (route_name VARCHAR, route_id VARCHAR); CREATE TABLE Delivery_Route_Locations (route_id VARCHAR) ###Answer: SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the state names and the number of customers living in each state. ### Context: CREATE TABLE customer_addresses (address_id VARCHAR); CREATE TABLE addresses (state_province_county VARCHAR, address_id VARCHAR) ###Answer: SELECT t2.state_province_county, COUNT(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county" "convert the question into postgresql query using the context values ### Question: How many authors are there? ### Context: CREATE TABLE authors (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM authors" "convert the question into postgresql query using the context values ### Question: How many institutions are there? ### Context: CREATE TABLE inst (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM inst" "convert the question into postgresql query using the context values ### Question: How many papers are published in total? ### Context: CREATE TABLE papers (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM papers" "convert the question into postgresql query using the context values ### Question: What are the titles of papers published by ""Jeremy Gibbons""? ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) ###Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = ""Jeremy"" AND t1.lname = ""Gibbons""" "convert the question into postgresql query using the context values ### Question: Find all the papers published by ""Aaron Turon"". ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) ###Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = ""Aaron"" AND t1.lname = ""Turon""" "convert the question into postgresql query using the context values ### Question: How many papers have ""Atsushi Ohori"" published? ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE papers (paperid VARCHAR) ###Answer: SELECT COUNT(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = ""Atsushi"" AND t1.lname = ""Ohori""" "convert the question into postgresql query using the context values ### Question: What is the name of the institution that ""Matthias Blume"" belongs to? ### Context: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE inst (name VARCHAR, instid VARCHAR) ###Answer: SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = ""Matthias"" AND t1.lname = ""Blume""" "convert the question into postgresql query using the context values ### Question: Which institution does ""Katsuhiro Ueno"" belong to? ### Context: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE inst (name VARCHAR, instid VARCHAR) ###Answer: SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = ""Katsuhiro"" AND t1.lname = ""Ueno""" "convert the question into postgresql query using the context values ### Question: Who belong to the institution ""University of Oxford""? Show the first names and last names. ### Context: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR); CREATE TABLE inst (instid VARCHAR, name VARCHAR) ###Answer: SELECT DISTINCT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = ""University of Oxford""" "convert the question into postgresql query using the context values ### Question: Which authors belong to the institution ""Google""? Show the first names and last names. ### Context: CREATE TABLE authorship (authid VARCHAR, instid VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR); CREATE TABLE inst (instid VARCHAR, name VARCHAR) ###Answer: SELECT DISTINCT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = ""Google""" "convert the question into postgresql query using the context values ### Question: What are the last names of the author of the paper titled ""Binders Unbound""? ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR) ###Answer: SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = ""Binders Unbound""" "convert the question into postgresql query using the context values ### Question: Find the first and last name of the author(s) who wrote the paper ""Nameless, Painless"". ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR); CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR) ###Answer: SELECT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = ""Nameless , Painless""" "convert the question into postgresql query using the context values ### Question: What are the papers published under the institution ""Indiana University""? ### Context: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) ###Answer: SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = ""Indiana University""" "convert the question into postgresql query using the context values ### Question: Find all the papers published by the institution ""Google"". ### Context: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) ###Answer: SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = ""Google""" "convert the question into postgresql query using the context values ### Question: How many papers are published by the institution ""Tokohu University""? ### Context: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) ###Answer: SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = ""Tokohu University""" "convert the question into postgresql query using the context values ### Question: Find the number of papers published by the institution ""University of Pennsylvania"". ### Context: CREATE TABLE inst (instid VARCHAR, name VARCHAR); CREATE TABLE authorship (paperid VARCHAR, instid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) ###Answer: SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = ""University of Pennsylvania""" "convert the question into postgresql query using the context values ### Question: Find the papers which have ""Olin Shivers"" as an author. ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) ###Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = ""Olin"" AND t1.lname = ""Shivers""" "convert the question into postgresql query using the context values ### Question: Which papers have ""Stephanie Weirich"" as an author? ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE authors (authid VARCHAR, fname VARCHAR, lname VARCHAR) ###Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = ""Stephanie"" AND t1.lname = ""Weirich""" "convert the question into postgresql query using the context values ### Question: Which paper is published in an institution in ""USA"" and have ""Turon"" as its second author? ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR, instid VARCHAR, authorder VARCHAR); CREATE TABLE authors (authid VARCHAR, lname VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE inst (instid VARCHAR, country VARCHAR) ###Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = ""USA"" AND t2.authorder = 2 AND t1.lname = ""Turon""" "convert the question into postgresql query using the context values ### Question: Find the titles of papers whose first author is affiliated with an institution in the country ""Japan"" and has last name ""Ohori""? ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR, instid VARCHAR, authorder VARCHAR); CREATE TABLE authors (authid VARCHAR, lname VARCHAR); CREATE TABLE papers (title VARCHAR, paperid VARCHAR); CREATE TABLE inst (instid VARCHAR, country VARCHAR) ###Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = ""Japan"" AND t2.authorder = 1 AND t1.lname = ""Ohori""" "convert the question into postgresql query using the context values ### Question: What is the last name of the author that has published the most papers? ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, fname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR) ###Answer: SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname, t1.lname ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Retrieve the country that has published the most papers. ### Context: CREATE TABLE inst (country VARCHAR, instid VARCHAR); CREATE TABLE authorship (instid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR) ###Answer: SELECT t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of the organization that has published the largest number of papers. ### Context: CREATE TABLE inst (name VARCHAR, instid VARCHAR); CREATE TABLE authorship (instid VARCHAR, paperid VARCHAR); CREATE TABLE papers (paperid VARCHAR) ###Answer: SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the titles of the papers that contain the word ""ML"". ### Context: CREATE TABLE papers (title VARCHAR) ###Answer: SELECT title FROM papers WHERE title LIKE ""%ML%""" "convert the question into postgresql query using the context values ### Question: Which paper's title contains the word ""Database""? ### Context: CREATE TABLE papers (title VARCHAR) ###Answer: SELECT title FROM papers WHERE title LIKE ""%Database%""" "convert the question into postgresql query using the context values ### Question: Find the first names of all the authors who have written a paper with title containing the word ""Functional"". ### Context: CREATE TABLE authors (fname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR); CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR) ###Answer: SELECT t1.fname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE ""%Functional%""" "convert the question into postgresql query using the context values ### Question: Find the last names of all the authors that have written a paper with title containing the word ""Monadic"". ### Context: CREATE TABLE authorship (authid VARCHAR, paperid VARCHAR); CREATE TABLE authors (lname VARCHAR, authid VARCHAR); CREATE TABLE papers (paperid VARCHAR, title VARCHAR) ###Answer: SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE ""%Monadic%""" "convert the question into postgresql query using the context values ### Question: Retrieve the title of the paper that has the largest number of authors. ### Context: CREATE TABLE authorship (authorder INTEGER); CREATE TABLE authorship (paperid VARCHAR, authorder INTEGER); CREATE TABLE papers (title VARCHAR, paperid VARCHAR) ###Answer: SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid = t2.paperid WHERE t1.authorder = (SELECT MAX(authorder) FROM authorship)" "convert the question into postgresql query using the context values ### Question: What is the first name of the author with last name ""Ueno""? ### Context: CREATE TABLE authors (fname VARCHAR, lname VARCHAR) ###Answer: SELECT fname FROM authors WHERE lname = ""Ueno""" "convert the question into postgresql query using the context values ### Question: Find the last name of the author with first name ""Amal"". ### Context: CREATE TABLE authors (lname VARCHAR, fname VARCHAR) ###Answer: SELECT lname FROM authors WHERE fname = ""Amal""" "convert the question into postgresql query using the context values ### Question: Find the first names of all the authors ordered in alphabetical order. ### Context: CREATE TABLE authors (fname VARCHAR) ###Answer: SELECT fname FROM authors ORDER BY fname" "convert the question into postgresql query using the context values ### Question: Retrieve all the last names of authors in alphabetical order. ### Context: CREATE TABLE authors (lname VARCHAR) ###Answer: SELECT lname FROM authors ORDER BY lname" "convert the question into postgresql query using the context values ### Question: Retrieve all the first and last names of authors in the alphabetical order of last names. ### Context: CREATE TABLE authors (fname VARCHAR, lname VARCHAR) ###Answer: SELECT fname, lname FROM authors ORDER BY lname" "convert the question into postgresql query using the context values ### Question: How many different last names do the actors and actresses have? ### Context: CREATE TABLE actor (last_name VARCHAR) ###Answer: SELECT COUNT(DISTINCT last_name) FROM actor" "convert the question into postgresql query using the context values ### Question: What is the most popular first name of the actors? ### Context: CREATE TABLE actor (first_name VARCHAR) ###Answer: SELECT first_name FROM actor GROUP BY first_name ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the most popular full name of the actors? ### Context: CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT first_name, last_name FROM actor GROUP BY first_name, last_name ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which districts have at least two addresses? ### Context: CREATE TABLE address (district VARCHAR) ###Answer: SELECT district FROM address GROUP BY district HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What is the phone number and postal code of the address 1031 Daugavpils Parkway? ### Context: CREATE TABLE address (phone VARCHAR, postal_code VARCHAR, address VARCHAR) ###Answer: SELECT phone, postal_code FROM address WHERE address = '1031 Daugavpils Parkway'" "convert the question into postgresql query using the context values ### Question: Which city has the most addresses? List the city name, number of addresses, and city id. ### Context: CREATE TABLE address (city_id VARCHAR); CREATE TABLE city (city VARCHAR, city_id VARCHAR) ###Answer: SELECT T2.city, COUNT(*), T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many addresses are in the district of California? ### Context: CREATE TABLE address (district VARCHAR) ###Answer: SELECT COUNT(*) FROM address WHERE district = 'California'" "convert the question into postgresql query using the context values ### Question: Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id. ### Context: CREATE TABLE film (title VARCHAR, film_id VARCHAR, rental_rate VARCHAR); CREATE TABLE inventory (film_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VARCHAR) ###Answer: SELECT title, film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING COUNT(*) < 3" "convert the question into postgresql query using the context values ### Question: How many cities are in Australia? ### Context: CREATE TABLE country (country_id VARCHAR, country VARCHAR); CREATE TABLE city (country_id VARCHAR) ###Answer: SELECT COUNT(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'" "convert the question into postgresql query using the context values ### Question: Which countries have at least 3 cities? ### Context: CREATE TABLE country (country VARCHAR, country_id VARCHAR); CREATE TABLE city (country_id VARCHAR) ###Answer: SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING COUNT(*) >= 3" "convert the question into postgresql query using the context values ### Question: Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa. ### Context: CREATE TABLE payment (payment_date VARCHAR, staff_id VARCHAR); CREATE TABLE staff (staff_id VARCHAR, first_name VARCHAR); CREATE TABLE payment (payment_date VARCHAR, amount INTEGER) ###Answer: SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'" "convert the question into postgresql query using the context values ### Question: How many customers have an active value of 1? ### Context: CREATE TABLE customer (active VARCHAR) ###Answer: SELECT COUNT(*) FROM customer WHERE active = '1'" "convert the question into postgresql query using the context values ### Question: Which film has the highest rental rate? And what is the rate? ### Context: CREATE TABLE film (title VARCHAR, rental_rate VARCHAR) ###Answer: SELECT title, rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which film has the most number of actors or actresses? List the film name, film id and description. ### Context: CREATE TABLE film_actor (film_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VARCHAR, description VARCHAR) ###Answer: SELECT T2.title, T2.film_id, T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which film actor (actress) starred the most films? List his or her first name, last name and actor id. ### Context: CREATE TABLE film_actor (actor_id VARCHAR); CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR, actor_id VARCHAR) ###Answer: SELECT T2.first_name, T2.last_name, T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name. ### Context: CREATE TABLE film_actor (actor_id VARCHAR); CREATE TABLE actor (first_name VARCHAR, last_name VARCHAR, actor_id VARCHAR) ###Answer: SELECT T2.first_name, T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING COUNT(*) > 30" "convert the question into postgresql query using the context values ### Question: Which store owns most items? ### Context: CREATE TABLE inventory (store_id VARCHAR) ###Answer: SELECT store_id FROM inventory GROUP BY store_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the total amount of all payments? ### Context: CREATE TABLE payment (amount INTEGER) ###Answer: SELECT SUM(amount) FROM payment" "convert the question into postgresql query using the context values ### Question: Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id. ### Context: CREATE TABLE payment (customer_id VARCHAR); CREATE TABLE customer (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name, T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY SUM(amount) LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the genre name of the film HUNGER ROOF? ### Context: CREATE TABLE film_category (category_id VARCHAR, film_id VARCHAR); CREATE TABLE film (film_id VARCHAR, title VARCHAR); CREATE TABLE category (name VARCHAR, category_id VARCHAR) ###Answer: SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'" "convert the question into postgresql query using the context values ### Question: How many films are there in each category? List the genre name, genre id and the count. ### Context: CREATE TABLE film_category (category_id VARCHAR); CREATE TABLE category (name VARCHAR, category_id VARCHAR) ###Answer: SELECT T2.name, T1.category_id, COUNT(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id" "convert the question into postgresql query using the context values ### Question: Which film has the most copies in the inventory? List both title and id. ### Context: CREATE TABLE film (title VARCHAR, film_id VARCHAR); CREATE TABLE inventory (film_id VARCHAR) ###Answer: SELECT T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the film title and inventory id of the item in the inventory which was rented most frequently? ### Context: CREATE TABLE film (title VARCHAR, film_id VARCHAR); CREATE TABLE inventory (inventory_id VARCHAR, film_id VARCHAR); CREATE TABLE rental (inventory_id VARCHAR) ###Answer: SELECT T1.title, T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many languages are in these films? ### Context: CREATE TABLE film (language_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT language_id) FROM film" "convert the question into postgresql query using the context values ### Question: What are all the movies rated as R? List the titles. ### Context: CREATE TABLE film (title VARCHAR, rating VARCHAR) ###Answer: SELECT title FROM film WHERE rating = 'R'" "convert the question into postgresql query using the context values ### Question: Where is store 1 located? ### Context: CREATE TABLE store (address_id VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1" "convert the question into postgresql query using the context values ### Question: Which staff handled least number of payments? List the full name and the id. ### Context: CREATE TABLE payment (staff_id VARCHAR); CREATE TABLE staff (first_name VARCHAR, last_name VARCHAR, staff_id VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which language does the film AIRPORT POLLOCK use? List the language name. ### Context: CREATE TABLE film (language_id VARCHAR, title VARCHAR); CREATE TABLE LANGUAGE (name VARCHAR, language_id VARCHAR) ###Answer: SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK'" "convert the question into postgresql query using the context values ### Question: How many stores are there? ### Context: CREATE TABLE store (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM store" "convert the question into postgresql query using the context values ### Question: How many kinds of different ratings are listed? ### Context: CREATE TABLE film (rating VARCHAR) ###Answer: SELECT COUNT(DISTINCT rating) FROM film" "convert the question into postgresql query using the context values ### Question: Which movies have 'Deleted Scenes' as a substring in the special feature? ### Context: CREATE TABLE film (title VARCHAR, special_features VARCHAR) ###Answer: SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'" "convert the question into postgresql query using the context values ### Question: How many items in inventory does store 1 have? ### Context: CREATE TABLE inventory (store_id VARCHAR) ###Answer: SELECT COUNT(*) FROM inventory WHERE store_id = 1" "convert the question into postgresql query using the context values ### Question: When did the first payment happen? ### Context: CREATE TABLE payment (payment_date VARCHAR) ###Answer: SELECT payment_date FROM payment ORDER BY payment_date LIMIT 1" "convert the question into postgresql query using the context values ### Question: Where does the customer with the first name Linda live? And what is her email? ### Context: CREATE TABLE customer (email VARCHAR, address_id VARCHAR, first_name VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.address, T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'" "convert the question into postgresql query using the context values ### Question: Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles. ### Context: CREATE TABLE film (title VARCHAR, replacement_cost INTEGER, LENGTH VARCHAR, rating VARCHAR) ###Answer: SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200" "convert the question into postgresql query using the context values ### Question: What is the first name and the last name of the customer who made the earliest rental? ### Context: CREATE TABLE customer (first_name VARCHAR, last_name VARCHAR, customer_id VARCHAR); CREATE TABLE rental (customer_id VARCHAR, rental_date VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns? ### Context: CREATE TABLE customer (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE rental (staff_id VARCHAR, customer_id VARCHAR); CREATE TABLE staff (first_name VARCHAR, last_name VARCHAR, staff_id VARCHAR) ###Answer: SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'" "convert the question into postgresql query using the context values ### Question: Which store has most the customers? ### Context: CREATE TABLE customer (store_id VARCHAR) ###Answer: SELECT store_id FROM customer GROUP BY store_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the largest payment amount? ### Context: CREATE TABLE payment (amount VARCHAR) ###Answer: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Where does the staff member with the first name Elsa live? ### Context: CREATE TABLE staff (address_id VARCHAR, first_name VARCHAR); CREATE TABLE address (address VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'" "convert the question into postgresql query using the context values ### Question: What are the first names of customers who have not rented any films after '2005-08-23 02:06:01'? ### Context: CREATE TABLE customer (first_name VARCHAR, customer_id VARCHAR, rental_date INTEGER); CREATE TABLE rental (first_name VARCHAR, customer_id VARCHAR, rental_date INTEGER) ###Answer: SELECT first_name FROM customer WHERE NOT customer_id IN (SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01')" "convert the question into postgresql query using the context values ### Question: How many bank branches are there? ### Context: CREATE TABLE bank (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM bank" "convert the question into postgresql query using the context values ### Question: How many customers are there? ### Context: CREATE TABLE bank (no_of_customers INTEGER) ###Answer: SELECT SUM(no_of_customers) FROM bank" "convert the question into postgresql query using the context values ### Question: Find the number of customers in the banks at New York City. ### Context: CREATE TABLE bank (no_of_customers INTEGER, city VARCHAR) ###Answer: SELECT SUM(no_of_customers) FROM bank WHERE city = 'New York City'" "convert the question into postgresql query using the context values ### Question: Find the average number of customers in all banks of Utah state. ### Context: CREATE TABLE bank (no_of_customers INTEGER, state VARCHAR) ###Answer: SELECT AVG(no_of_customers) FROM bank WHERE state = 'Utah'" "convert the question into postgresql query using the context values ### Question: Find the average number of customers cross all banks. ### Context: CREATE TABLE bank (no_of_customers INTEGER) ###Answer: SELECT AVG(no_of_customers) FROM bank" "convert the question into postgresql query using the context values ### Question: Find the city and state of the bank branch named morningside. ### Context: CREATE TABLE bank (city VARCHAR, state VARCHAR, bname VARCHAR) ###Answer: SELECT city, state FROM bank WHERE bname = 'morningside'" "convert the question into postgresql query using the context values ### Question: Find the branch names of banks in the New York state. ### Context: CREATE TABLE bank (bname VARCHAR, state VARCHAR) ###Answer: SELECT bname FROM bank WHERE state = 'New York'" "convert the question into postgresql query using the context values ### Question: List the name of all customers sorted by their account balance in ascending order. ### Context: CREATE TABLE customer (cust_name VARCHAR, acc_bal VARCHAR) ###Answer: SELECT cust_name FROM customer ORDER BY acc_bal" "convert the question into postgresql query using the context values ### Question: List the name of all different customers who have some loan sorted by their total loan amount. ### Context: CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) ###Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount)" "convert the question into postgresql query using the context values ### Question: Find the state, account type, and credit score of the customer whose number of loan is 0. ### Context: CREATE TABLE customer (state VARCHAR, acc_type VARCHAR, credit_score VARCHAR, no_of_loans VARCHAR) ###Answer: SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0" "convert the question into postgresql query using the context values ### Question: Find the number of different cities which banks are located at. ### Context: CREATE TABLE bank (city VARCHAR) ###Answer: SELECT COUNT(DISTINCT city) FROM bank" "convert the question into postgresql query using the context values ### Question: Find the number of different states which banks are located at. ### Context: CREATE TABLE bank (state VARCHAR) ###Answer: SELECT COUNT(DISTINCT state) FROM bank" "convert the question into postgresql query using the context values ### Question: How many distinct types of accounts are there? ### Context: CREATE TABLE customer (acc_type VARCHAR) ###Answer: SELECT COUNT(DISTINCT acc_type) FROM customer" "convert the question into postgresql query using the context values ### Question: Find the name and account balance of the customer whose name includes the letter ‘a’. ### Context: CREATE TABLE customer (cust_name VARCHAR, acc_bal VARCHAR) ###Answer: SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%'" "convert the question into postgresql query using the context values ### Question: Find the total account balance of each customer from Utah or Texas. ### Context: CREATE TABLE customer (acc_bal INTEGER, state VARCHAR) ###Answer: SELECT SUM(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas'" "convert the question into postgresql query using the context values ### Question: Find the name of customers who have both saving and checking account types. ### Context: CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR) ###Answer: SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'" "convert the question into postgresql query using the context values ### Question: Find the name of customers who do not have an saving account. ### Context: CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR) ###Answer: SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'" "convert the question into postgresql query using the context values ### Question: Find the name of customers who do not have a loan with a type of Mortgages. ### Context: CREATE TABLE loan (cust_id VARCHAR, loan_type VARCHAR); CREATE TABLE customer (cust_name VARCHAR); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) ###Answer: SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE T2.loan_type = 'Mortgages'" "convert the question into postgresql query using the context values ### Question: Find the name of customers who have loans of both Mortgages and Auto. ### Context: CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) ###Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Mortgages' INTERSECT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Auto'" "convert the question into postgresql query using the context values ### Question: Find the name of customers whose credit score is below the average credit scores of all customers. ### Context: CREATE TABLE customer (cust_name VARCHAR, credit_score INTEGER) ###Answer: SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer)" "convert the question into postgresql query using the context values ### Question: Find the branch name of the bank that has the most number of customers. ### Context: CREATE TABLE bank (bname VARCHAR, no_of_customers VARCHAR) ###Answer: SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of customer who has the lowest credit score. ### Context: CREATE TABLE customer (cust_name VARCHAR, credit_score VARCHAR) ###Answer: SELECT cust_name FROM customer ORDER BY credit_score LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name, account type, and account balance of the customer who has the highest credit score. ### Context: CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR, acc_bal VARCHAR, credit_score VARCHAR) ###Answer: SELECT cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of customer who has the highest amount of loans. ### Context: CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR) ###Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the state which has the most number of customers. ### Context: CREATE TABLE bank (state VARCHAR, no_of_customers INTEGER) ###Answer: SELECT state FROM bank GROUP BY state ORDER BY SUM(no_of_customers) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: For each account type, find the average account balance of customers with credit score lower than 50. ### Context: CREATE TABLE customer (acc_type VARCHAR, acc_bal INTEGER, credit_score INTEGER) ###Answer: SELECT AVG(acc_bal), acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type" "convert the question into postgresql query using the context values ### Question: For each state, find the total account balance of customers whose credit score is above 100. ### Context: CREATE TABLE customer (state VARCHAR, acc_bal INTEGER, credit_score INTEGER) ###Answer: SELECT SUM(acc_bal), state FROM customer WHERE credit_score > 100 GROUP BY state" "convert the question into postgresql query using the context values ### Question: Find the total amount of loans offered by each bank branch. ### Context: CREATE TABLE loan (branch_id VARCHAR); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR) ###Answer: SELECT SUM(amount), T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname" "convert the question into postgresql query using the context values ### Question: Find the name of customers who have more than one loan. ### Context: CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) ###Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Find the name and account balance of the customers who have loans with a total amount of more than 5000. ### Context: CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR, cust_id VARCHAR) ###Answer: SELECT T1.cust_name, T1.acc_type FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING SUM(T2.amount) > 5000" "convert the question into postgresql query using the context values ### Question: Find the name of bank branch that provided the greatest total amount of loans. ### Context: CREATE TABLE loan (branch_id VARCHAR, amount INTEGER); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR) ###Answer: SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname ORDER BY SUM(T2.amount) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100. ### Context: CREATE TABLE loan (branch_id VARCHAR, cust_id VARCHAR, amount INTEGER); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR); CREATE TABLE customer (cust_id VARCHAR, credit_score INTEGER) ###Answer: SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id = T2.branch_id JOIN customer AS T3 ON T1.cust_id = T3.cust_id WHERE T3.credit_score < 100 GROUP BY T2.bname ORDER BY SUM(T1.amount) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name of bank branches that provided some loans. ### Context: CREATE TABLE loan (branch_id VARCHAR); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR) ###Answer: SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id" "convert the question into postgresql query using the context values ### Question: Find the name and credit score of the customers who have some loans. ### Context: CREATE TABLE customer (cust_name VARCHAR, credit_score VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) ###Answer: SELECT DISTINCT T1.cust_name, T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id" "convert the question into postgresql query using the context values ### Question: Find the the name of the customers who have a loan with amount more than 3000. ### Context: CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) ###Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000" "convert the question into postgresql query using the context values ### Question: Find the city and name of bank branches that provide business loans. ### Context: CREATE TABLE bank (bname VARCHAR, city VARCHAR, branch_id VARCHAR); CREATE TABLE loan (branch_id VARCHAR, loan_type VARCHAR) ###Answer: SELECT T1.bname, T1.city FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T2.loan_type = 'Business'" "convert the question into postgresql query using the context values ### Question: Find the names of bank branches that have provided a loan to any customer whose credit score is below 100. ### Context: CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR); CREATE TABLE customer (cust_id VARCHAR, credit_score INTEGER); CREATE TABLE loan (branch_id VARCHAR, cust_id VARCHAR) ###Answer: SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id = T2.branch_id JOIN customer AS T3 ON T1.cust_id = T3.cust_id WHERE T3.credit_score < 100" "convert the question into postgresql query using the context values ### Question: Find the total amount of loans provided by bank branches in the state of New York. ### Context: CREATE TABLE bank (branch_id VARCHAR, state VARCHAR); CREATE TABLE loan (amount INTEGER, branch_id VARCHAR) ###Answer: SELECT SUM(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York'" "convert the question into postgresql query using the context values ### Question: Find the average credit score of the customers who have some loan. ### Context: CREATE TABLE loan (credit_score INTEGER, cust_id VARCHAR); CREATE TABLE customer (credit_score INTEGER, cust_id VARCHAR) ###Answer: SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)" "convert the question into postgresql query using the context values ### Question: Find the average credit score of the customers who do not have any loan. ### Context: CREATE TABLE loan (credit_score INTEGER, cust_id VARCHAR); CREATE TABLE customer (credit_score INTEGER, cust_id VARCHAR) ###Answer: SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)" "convert the question into postgresql query using the context values ### Question: How many assessment notes are there in total? ### Context: CREATE TABLE ASSESSMENT_NOTES (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM ASSESSMENT_NOTES" "convert the question into postgresql query using the context values ### Question: What are the dates of the assessment notes? ### Context: CREATE TABLE Assessment_Notes (date_of_notes VARCHAR) ###Answer: SELECT date_of_notes FROM Assessment_Notes" "convert the question into postgresql query using the context values ### Question: How many addresses have zip code 197? ### Context: CREATE TABLE ADDRESSES (zip_postcode VARCHAR) ###Answer: SELECT COUNT(*) FROM ADDRESSES WHERE zip_postcode = ""197""" "convert the question into postgresql query using the context values ### Question: How many distinct incident type codes are there? ### Context: CREATE TABLE Behavior_Incident (incident_type_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT incident_type_code) FROM Behavior_Incident" "convert the question into postgresql query using the context values ### Question: Return all distinct detention type codes. ### Context: CREATE TABLE Detention (detention_type_code VARCHAR) ###Answer: SELECT DISTINCT detention_type_code FROM Detention" "convert the question into postgresql query using the context values ### Question: What are the start and end dates for incidents with incident type code ""NOISE""? ### Context: CREATE TABLE Behavior_Incident (date_incident_start VARCHAR, date_incident_end VARCHAR, incident_type_code VARCHAR) ###Answer: SELECT date_incident_start, date_incident_end FROM Behavior_Incident WHERE incident_type_code = ""NOISE""" "convert the question into postgresql query using the context values ### Question: Return all detention summaries. ### Context: CREATE TABLE Detention (detention_summary VARCHAR) ###Answer: SELECT detention_summary FROM Detention" "convert the question into postgresql query using the context values ### Question: Return the cell phone number and email address for all students. ### Context: CREATE TABLE STUDENTS (cell_mobile_number VARCHAR, email_address VARCHAR) ###Answer: SELECT cell_mobile_number, email_address FROM STUDENTS" "convert the question into postgresql query using the context values ### Question: What is the email of the student with first name ""Emma"" and last name ""Rohan""? ### Context: CREATE TABLE Students (email_address VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT email_address FROM Students WHERE first_name = ""Emma"" AND last_name = ""Rohan""" "convert the question into postgresql query using the context values ### Question: How many distinct students have been in detention? ### Context: CREATE TABLE Students_in_Detention (student_id VARCHAR) ###Answer: SELECT COUNT(DISTINCT student_id) FROM Students_in_Detention" "convert the question into postgresql query using the context values ### Question: What is the gender of the teacher with last name ""Medhurst""? ### Context: CREATE TABLE TEACHERS (gender VARCHAR, last_name VARCHAR) ###Answer: SELECT gender FROM TEACHERS WHERE last_name = ""Medhurst""" "convert the question into postgresql query using the context values ### Question: What is the incident type description for the incident type with code ""VIOLENCE""? ### Context: CREATE TABLE Ref_Incident_Type (incident_type_description VARCHAR, incident_type_code VARCHAR) ###Answer: SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = ""VIOLENCE""" "convert the question into postgresql query using the context values ### Question: Find the maximum and minimum monthly rental for all student addresses. ### Context: CREATE TABLE Student_Addresses (monthly_rental INTEGER) ###Answer: SELECT MAX(monthly_rental), MIN(monthly_rental) FROM Student_Addresses" "convert the question into postgresql query using the context values ### Question: Find the first names of teachers whose email address contains the word ""man"". ### Context: CREATE TABLE Teachers (first_name VARCHAR, email_address VARCHAR) ###Answer: SELECT first_name FROM Teachers WHERE email_address LIKE '%man%'" "convert the question into postgresql query using the context values ### Question: List all information about the assessment notes sorted by date in ascending order. ### Context: CREATE TABLE Assessment_Notes (date_of_notes VARCHAR) ###Answer: SELECT * FROM Assessment_Notes ORDER BY date_of_notes" "convert the question into postgresql query using the context values ### Question: List all cities of addresses in alphabetical order. ### Context: CREATE TABLE Addresses (city VARCHAR) ###Answer: SELECT city FROM Addresses ORDER BY city" "convert the question into postgresql query using the context values ### Question: Find the first names and last names of teachers in alphabetical order of last name. ### Context: CREATE TABLE Teachers (first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT first_name, last_name FROM Teachers ORDER BY last_name" "convert the question into postgresql query using the context values ### Question: Find all information about student addresses, and sort by monthly rental in descending order. ### Context: CREATE TABLE Student_Addresses (monthly_rental VARCHAR) ###Answer: SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC" "convert the question into postgresql query using the context values ### Question: Find the id and first name of the student that has the most number of assessment notes? ### Context: CREATE TABLE Students (first_name VARCHAR, student_id VARCHAR); CREATE TABLE Assessment_Notes (student_id VARCHAR) ###Answer: SELECT T1.student_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the ids and first names of the 3 teachers that have the most number of assessment notes? ### Context: CREATE TABLE Assessment_Notes (teacher_id VARCHAR); CREATE TABLE Teachers (first_name VARCHAR, teacher_id VARCHAR) ###Answer: SELECT T1.teacher_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Find the id and last name of the student that has the most behavior incidents? ### Context: CREATE TABLE Students (last_name VARCHAR, student_id VARCHAR); CREATE TABLE Behavior_Incident (student_id VARCHAR) ###Answer: SELECT T1.student_id, T2.last_name FROM Behavior_Incident AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the id and last name of the teacher that has the most detentions with detention type code ""AFTER""? ### Context: CREATE TABLE Detention (teacher_id VARCHAR, detention_type_code VARCHAR); CREATE TABLE Teachers (last_name VARCHAR, teacher_id VARCHAR) ###Answer: SELECT T1.teacher_id, T2.last_name FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T1.detention_type_code = ""AFTER"" GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the id and first name of the student whose addresses have the highest average monthly rental? ### Context: CREATE TABLE Students (first_name VARCHAR, student_id VARCHAR); CREATE TABLE Student_Addresses (student_id VARCHAR) ###Answer: SELECT T1.student_id, T2.first_name FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY AVG(monthly_rental) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the id and city of the student address with the highest average monthly rental. ### Context: CREATE TABLE Student_Addresses (address_id VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.address_id, T1.city FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id ORDER BY AVG(monthly_rental) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the code and description of the most frequent behavior incident type? ### Context: CREATE TABLE Ref_Incident_Type (incident_type_description VARCHAR, incident_type_code VARCHAR); CREATE TABLE Behavior_Incident (incident_type_code VARCHAR) ###Answer: SELECT T1.incident_type_code, T2.incident_type_description FROM Behavior_Incident AS T1 JOIN Ref_Incident_Type AS T2 ON T1.incident_type_code = T2.incident_type_code GROUP BY T1.incident_type_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the code and description of the least frequent detention type ? ### Context: CREATE TABLE Ref_Detention_Type (detention_type_description VARCHAR, detention_type_code VARCHAR); CREATE TABLE Detention (detention_type_code VARCHAR) ###Answer: SELECT T1.detention_type_code, T2.detention_type_description FROM Detention AS T1 JOIN Ref_Detention_Type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the dates of assessment notes for students with first name ""Fanny"". ### Context: CREATE TABLE Students (student_id VARCHAR, first_name VARCHAR); CREATE TABLE Assessment_Notes (date_of_notes VARCHAR, student_id VARCHAR) ###Answer: SELECT T1.date_of_notes FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.first_name = ""Fanny""" "convert the question into postgresql query using the context values ### Question: Find the texts of assessment notes for teachers with last name ""Schuster"". ### Context: CREATE TABLE Assessment_Notes (text_of_notes VARCHAR, teacher_id VARCHAR); CREATE TABLE Teachers (teacher_id VARCHAR, last_name VARCHAR) ###Answer: SELECT T1.text_of_notes FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = ""Schuster""" "convert the question into postgresql query using the context values ### Question: Find the start and end dates of behavior incidents of students with last name ""Fahey"". ### Context: CREATE TABLE Behavior_Incident (date_incident_start VARCHAR, student_id VARCHAR); CREATE TABLE Students (student_id VARCHAR, last_name VARCHAR) ###Answer: SELECT T1.date_incident_start, date_incident_end FROM Behavior_Incident AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.last_name = ""Fahey""" "convert the question into postgresql query using the context values ### Question: Find the start and end dates of detentions of teachers with last name ""Schultz"". ### Context: CREATE TABLE Detention (datetime_detention_start VARCHAR, teacher_id VARCHAR); CREATE TABLE Teachers (teacher_id VARCHAR, last_name VARCHAR) ###Answer: SELECT T1.datetime_detention_start, datetime_detention_end FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = ""Schultz""" "convert the question into postgresql query using the context values ### Question: What are the id and zip code of the address with the highest monthly rental? ### Context: CREATE TABLE Student_Addresses (address_id VARCHAR); CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.address_id, T1.zip_postcode FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id ORDER BY monthly_rental DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the cell phone number of the student whose address has the lowest monthly rental? ### Context: CREATE TABLE Students (cell_mobile_number VARCHAR, student_id VARCHAR); CREATE TABLE Student_Addresses (student_id VARCHAR, monthly_rental VARCHAR) ###Answer: SELECT T2.cell_mobile_number FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.monthly_rental LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the monthly rentals of student addresses in Texas state? ### Context: CREATE TABLE Addresses (address_id VARCHAR, state_province_county VARCHAR); CREATE TABLE Student_Addresses (monthly_rental VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.monthly_rental FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = ""Texas""" "convert the question into postgresql query using the context values ### Question: What are the first names and last names of students with address in Wisconsin state? ### Context: CREATE TABLE Addresses (address_id VARCHAR, state_province_county VARCHAR); CREATE TABLE Students (first_name VARCHAR, last_name VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = ""Wisconsin""" "convert the question into postgresql query using the context values ### Question: What are the line 1 and average monthly rentals of all student addresses? ### Context: CREATE TABLE Addresses (line_1 VARCHAR, address_id VARCHAR); CREATE TABLE Student_Addresses (monthly_rental INTEGER, address_id VARCHAR) ###Answer: SELECT T1.line_1, AVG(T2.monthly_rental) FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id" "convert the question into postgresql query using the context values ### Question: What is the zip code of the address where the teacher with first name ""Lyla"" lives? ### Context: CREATE TABLE Teachers (address_id VARCHAR, first_name VARCHAR); CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR) ###Answer: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = ""Lyla""" "convert the question into postgresql query using the context values ### Question: What are the email addresses of teachers whose address has zip code ""918""? ### Context: CREATE TABLE Addresses (address_id VARCHAR, zip_postcode VARCHAR); CREATE TABLE Teachers (email_address VARCHAR, address_id VARCHAR) ###Answer: SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = ""918""" "convert the question into postgresql query using the context values ### Question: How many students are not involved in any behavior incident? ### Context: CREATE TABLE STUDENTS (student_id VARCHAR); CREATE TABLE Behavior_Incident (student_id VARCHAR) ###Answer: SELECT COUNT(*) FROM STUDENTS WHERE NOT student_id IN (SELECT student_id FROM Behavior_Incident)" "convert the question into postgresql query using the context values ### Question: Find the last names of teachers who are not involved in any detention. ### Context: CREATE TABLE Teachers (last_name VARCHAR); CREATE TABLE Teachers (last_name VARCHAR, teacher_id VARCHAR); CREATE TABLE Detention (teacher_id VARCHAR) ###Answer: SELECT last_name FROM Teachers EXCEPT SELECT T1.last_name FROM Teachers AS T1 JOIN Detention AS T2 ON T1.teacher_id = T2.teacher_id" "convert the question into postgresql query using the context values ### Question: What are the line 1 of addresses shared by some students and some teachers? ### Context: CREATE TABLE Teachers (address_id VARCHAR); CREATE TABLE Students (address_id VARCHAR); CREATE TABLE Addresses (line_1 VARCHAR, address_id VARCHAR) ###Answer: SELECT T1.line_1 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id INTERSECT SELECT T1.line_1 FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id" "convert the question into postgresql query using the context values ### Question: Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail. ### Context: CREATE TABLE Assets (asset_id VARCHAR, asset_details VARCHAR); CREATE TABLE Asset_Parts (asset_id VARCHAR); CREATE TABLE Fault_Log (asset_id VARCHAR) ###Answer: SELECT T1.asset_id, T1.asset_details FROM Assets AS T1 JOIN Asset_Parts AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING COUNT(*) = 2 INTERSECT SELECT T1.asset_id, T1.asset_details FROM Assets AS T1 JOIN Fault_Log AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING COUNT(*) < 2" "convert the question into postgresql query using the context values ### Question: How many assets does each maintenance contract contain? List the number and the contract id. ### Context: CREATE TABLE Assets (maintenance_contract_id VARCHAR); CREATE TABLE Maintenance_Contracts (maintenance_contract_id VARCHAR) ###Answer: SELECT COUNT(*), T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id" "convert the question into postgresql query using the context values ### Question: How many assets does each third party company supply? List the count and the company id. ### Context: CREATE TABLE Assets (supplier_company_id VARCHAR); CREATE TABLE Third_Party_Companies (company_id VARCHAR) ###Answer: SELECT COUNT(*), T1.company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id" "convert the question into postgresql query using the context values ### Question: Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name. ### Context: CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR); CREATE TABLE Maintenance_Engineers (company_id VARCHAR); CREATE TABLE Third_Party_Companies (company_id VARCHAR, company_name VARCHAR) ###Answer: SELECT T1.company_id, T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(*) >= 2 UNION SELECT T3.company_id, T3.company_name FROM Third_Party_Companies AS T3 JOIN Maintenance_Contracts AS T4 ON T3.company_id = T4.maintenance_contract_company_id GROUP BY T3.company_id HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers? ### Context: CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE Fault_Log (recorded_by_staff_id VARCHAR) ###Answer: SELECT T1.staff_name, T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id EXCEPT SELECT T3.staff_name, T3.staff_id FROM Staff AS T3 JOIN Engineer_Visits AS T4 ON T3.staff_id = T4.contact_staff_id" "convert the question into postgresql query using the context values ### Question: Which engineer has visited the most times? Show the engineer id, first name and last name. ### Context: CREATE TABLE Maintenance_Engineers (engineer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE Engineer_Visits (Id VARCHAR) ###Answer: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which parts have more than 2 faults? Show the part name and id. ### Context: CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Part_Faults (part_id VARCHAR) ###Answer: SELECT T1.part_name, T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_id HAVING COUNT(*) > 2" "convert the question into postgresql query using the context values ### Question: List all every engineer's first name, last name, details and coresponding skill description. ### Context: CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, other_details VARCHAR, engineer_id VARCHAR); CREATE TABLE Engineer_Skills (engineer_id VARCHAR, skill_id VARCHAR); CREATE TABLE Skills (skill_description VARCHAR, skill_id VARCHAR) ###Answer: SELECT T1.first_name, T1.last_name, T1.other_details, T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id" "convert the question into postgresql query using the context values ### Question: For all the faults of different parts, what are all the decriptions of the skills required to fix them? List the name of the faults and the skill description. ### Context: CREATE TABLE Skills_Required_To_Fix (part_fault_id VARCHAR, skill_id VARCHAR); CREATE TABLE Part_Faults (fault_short_name VARCHAR, part_fault_id VARCHAR); CREATE TABLE Skills (skill_description VARCHAR, skill_id VARCHAR) ###Answer: SELECT T1.fault_short_name, T3.skill_description FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id" "convert the question into postgresql query using the context values ### Question: How many assets can each parts be used in? List the part name and the number. ### Context: CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Asset_Parts (part_id VARCHAR) ###Answer: SELECT T1.part_name, COUNT(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name" "convert the question into postgresql query using the context values ### Question: What are all the fault descriptions and the fault status of all the faults recoreded in the logs? ### Context: CREATE TABLE Fault_Log (fault_description VARCHAR, fault_log_entry_id VARCHAR); CREATE TABLE Fault_Log_Parts (fault_status VARCHAR, fault_log_entry_id VARCHAR) ###Answer: SELECT T1.fault_description, T2.fault_status FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id" "convert the question into postgresql query using the context values ### Question: How many engineer visits are required at most for a single fault log? List the number and the log entry id. ### Context: CREATE TABLE Fault_Log (fault_log_entry_id VARCHAR); CREATE TABLE Engineer_Visits (fault_log_entry_id VARCHAR) ###Answer: SELECT COUNT(*), T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are all the distinct last names of all the engineers? ### Context: CREATE TABLE Maintenance_Engineers (last_name VARCHAR) ###Answer: SELECT DISTINCT last_name FROM Maintenance_Engineers" "convert the question into postgresql query using the context values ### Question: How many fault status codes are recorded in the fault log parts table? ### Context: CREATE TABLE Fault_Log_Parts (fault_status VARCHAR) ###Answer: SELECT DISTINCT fault_status FROM Fault_Log_Parts" "convert the question into postgresql query using the context values ### Question: Which engineers have never visited to maintain the assets? List the engineer first name and last name. ### Context: CREATE TABLE Engineer_Visits (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR); CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR) ###Answer: SELECT first_name, last_name FROM Maintenance_Engineers WHERE NOT engineer_id IN (SELECT engineer_id FROM Engineer_Visits)" "convert the question into postgresql query using the context values ### Question: List the asset id, details, make and model for every asset. ### Context: CREATE TABLE Assets (asset_id VARCHAR, asset_details VARCHAR, asset_make VARCHAR, asset_model VARCHAR) ###Answer: SELECT asset_id, asset_details, asset_make, asset_model FROM Assets" "convert the question into postgresql query using the context values ### Question: When was the first asset acquired? ### Context: CREATE TABLE Assets (asset_acquired_date VARCHAR) ###Answer: SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which part fault requires the most number of skills to fix? List part id and name. ### Context: CREATE TABLE Part_Faults (part_id VARCHAR, part_fault_id VARCHAR); CREATE TABLE Skills_Required_To_Fix (part_fault_id VARCHAR); CREATE TABLE Parts (part_id VARCHAR, part_name VARCHAR) ###Answer: SELECT T1.part_id, T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which kind of part has the least number of faults? List the part name. ### Context: CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Part_Faults (part_id VARCHAR) ###Answer: SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name. ### Context: CREATE TABLE Engineer_Visits (engineer_id VARCHAR); CREATE TABLE Maintenance_Engineers (engineer_id VARCHAR, first_name VARCHAR, last_name VARCHAR) ###Answer: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id = T2.engineer_id GROUP BY T1.engineer_id ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which staff have contacted which engineers? List the staff name and the engineer first name and last name. ### Context: CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR, engineer_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR) ###Answer: SELECT T1.staff_name, T3.first_name, T3.last_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id" "convert the question into postgresql query using the context values ### Question: Which fault log included the most number of faulty parts? List the fault log id, description and record time. ### Context: CREATE TABLE Fault_Log (fault_log_entry_id VARCHAR, fault_description VARCHAR, fault_log_entry_datetime VARCHAR); CREATE TABLE Fault_Log_Parts (fault_log_entry_id VARCHAR) ###Answer: SELECT T1.fault_log_entry_id, T1.fault_description, T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which skill is used in fixing the most number of faults? List the skill id and description. ### Context: CREATE TABLE Skills (skill_id VARCHAR, skill_description VARCHAR); CREATE TABLE Skills_Required_To_Fix (skill_id VARCHAR) ###Answer: SELECT T1.skill_id, T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are all the distinct asset models? ### Context: CREATE TABLE Assets (asset_model VARCHAR) ###Answer: SELECT DISTINCT asset_model FROM Assets" "convert the question into postgresql query using the context values ### Question: List the all the assets make, model, details by the disposed date ascendingly. ### Context: CREATE TABLE Assets (asset_make VARCHAR, asset_model VARCHAR, asset_details VARCHAR, asset_disposed_date VARCHAR) ###Answer: SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date" "convert the question into postgresql query using the context values ### Question: Which part has the least chargeable amount? List the part id and amount. ### Context: CREATE TABLE Parts (part_id VARCHAR, chargeable_amount VARCHAR) ###Answer: SELECT part_id, chargeable_amount FROM Parts ORDER BY chargeable_amount LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which company started the earliest the maintenance contract? Show the company name. ### Context: CREATE TABLE Third_Party_Companies (company_name VARCHAR, company_id VARCHAR); CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR, contract_start_date VARCHAR) ###Answer: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id ORDER BY T2.contract_start_date LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the description of the type of the company who concluded its contracts most recently? ### Context: CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR, contract_end_date VARCHAR); CREATE TABLE Third_Party_Companies (company_name VARCHAR, company_id VARCHAR, company_type_code VARCHAR); CREATE TABLE Ref_Company_Types (company_type_code VARCHAR) ###Answer: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id JOIN Ref_Company_Types AS T3 ON T1.company_type_code = T3.company_type_code ORDER BY T2.contract_end_date DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which gender makes up the majority of the staff? ### Context: CREATE TABLE staff (gender VARCHAR) ###Answer: SELECT gender FROM staff GROUP BY gender ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many engineers did each staff contact? List both the contact staff name and number of engineers contacted. ### Context: CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR) ###Answer: SELECT T1.staff_name, COUNT(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name" "convert the question into postgresql query using the context values ### Question: Which assets did not incur any fault log? List the asset model. ### Context: CREATE TABLE Fault_Log (asset_model VARCHAR, asset_id VARCHAR); CREATE TABLE Assets (asset_model VARCHAR, asset_id VARCHAR) ###Answer: SELECT asset_model FROM Assets WHERE NOT asset_id IN (SELECT asset_id FROM Fault_Log)" "convert the question into postgresql query using the context values ### Question: list the local authorities and services provided by all stations. ### Context: CREATE TABLE station (local_authority VARCHAR, services VARCHAR) ###Answer: SELECT local_authority, services FROM station" "convert the question into postgresql query using the context values ### Question: show all train numbers and names ordered by their time from early to late. ### Context: CREATE TABLE train (train_number VARCHAR, name VARCHAR, TIME VARCHAR) ###Answer: SELECT train_number, name FROM train ORDER BY TIME" "convert the question into postgresql query using the context values ### Question: Give me the times and numbers of all trains that go to Chennai, ordered by time. ### Context: CREATE TABLE train (TIME VARCHAR, train_number VARCHAR, destination VARCHAR) ###Answer: SELECT TIME, train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME" "convert the question into postgresql query using the context values ### Question: How many trains have 'Express' in their names? ### Context: CREATE TABLE train (name VARCHAR) ###Answer: SELECT COUNT(*) FROM train WHERE name LIKE ""%Express%""" "convert the question into postgresql query using the context values ### Question: Find the number and time of the train that goes from Chennai to Guruvayur. ### Context: CREATE TABLE train (train_number VARCHAR, TIME VARCHAR, origin VARCHAR, destination VARCHAR) ###Answer: SELECT train_number, TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'" "convert the question into postgresql query using the context values ### Question: Find the number of trains starting from each origin. ### Context: CREATE TABLE train (origin VARCHAR) ###Answer: SELECT origin, COUNT(*) FROM train GROUP BY origin" "convert the question into postgresql query using the context values ### Question: Find the name of the train whose route runs through greatest number of stations. ### Context: CREATE TABLE route (train_id VARCHAR); CREATE TABLE train (name VARCHAR, id VARCHAR) ###Answer: SELECT t1.name FROM train AS t1 JOIN route AS t2 ON t1.id = t2.train_id GROUP BY t2.train_id ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the number of trains for each station, as well as the station network name and services. ### Context: CREATE TABLE route (station_id VARCHAR); CREATE TABLE station (network_name VARCHAR, services VARCHAR, id VARCHAR) ###Answer: SELECT COUNT(*), t1.network_name, t1.services FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id" "convert the question into postgresql query using the context values ### Question: What is the average high temperature for each day of week? ### Context: CREATE TABLE weekly_weather (day_of_week VARCHAR, high_temperature INTEGER) ###Answer: SELECT AVG(high_temperature), day_of_week FROM weekly_weather GROUP BY day_of_week" "convert the question into postgresql query using the context values ### Question: Give me the maximum low temperature and average precipitation at the Amersham station. ### Context: CREATE TABLE weekly_weather (low_temperature INTEGER, precipitation INTEGER, station_id VARCHAR); CREATE TABLE station (id VARCHAR, network_name VARCHAR) ###Answer: SELECT MAX(t1.low_temperature), AVG(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id WHERE t2.network_name = ""Amersham""" "convert the question into postgresql query using the context values ### Question: Find names and times of trains that run through stations for the local authority Chiltern. ### Context: CREATE TABLE station (id VARCHAR, local_authority VARCHAR); CREATE TABLE route (station_id VARCHAR, train_id VARCHAR); CREATE TABLE train (name VARCHAR, time VARCHAR, id VARCHAR) ###Answer: SELECT t3.name, t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = ""Chiltern""" "convert the question into postgresql query using the context values ### Question: How many different services are provided by all stations? ### Context: CREATE TABLE station (services VARCHAR) ###Answer: SELECT COUNT(DISTINCT services) FROM station" "convert the question into postgresql query using the context values ### Question: Find the id and local authority of the station with has the highest average high temperature. ### Context: CREATE TABLE weekly_weather (station_id VARCHAR); CREATE TABLE station (id VARCHAR, local_authority VARCHAR) ###Answer: SELECT t2.id, t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id ORDER BY AVG(high_temperature) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the id and local authority of the station whose maximum precipitation is higher than 50. ### Context: CREATE TABLE weekly_weather (station_id VARCHAR, precipitation INTEGER); CREATE TABLE station (id VARCHAR, local_authority VARCHAR) ###Answer: SELECT t2.id, t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id HAVING MAX(t1.precipitation) > 50" "convert the question into postgresql query using the context values ### Question: show the lowest low temperature and highest wind speed in miles per hour. ### Context: CREATE TABLE weekly_weather (low_temperature INTEGER, wind_speed_mph INTEGER) ###Answer: SELECT MIN(low_temperature), MAX(wind_speed_mph) FROM weekly_weather" "convert the question into postgresql query using the context values ### Question: Find the origins from which more than 1 train starts. ### Context: CREATE TABLE train (origin VARCHAR) ###Answer: SELECT origin FROM train GROUP BY origin HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Find the number of professors in accounting department. ### Context: CREATE TABLE professor (dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR) ###Answer: SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = ""Accounting""" "convert the question into postgresql query using the context values ### Question: How many professors are teaching class with code ACCT-211? ### Context: CREATE TABLE CLASS (PROF_NUM VARCHAR, CRS_CODE VARCHAR) ###Answer: SELECT COUNT(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = ""ACCT-211""" "convert the question into postgresql query using the context values ### Question: What is the first and last name of the professor in biology department? ### Context: CREATE TABLE professor (dept_code VARCHAR, EMP_NUM VARCHAR); CREATE TABLE department (dept_code VARCHAR); CREATE TABLE employee (EMP_FNAME VARCHAR, EMP_LNAME VARCHAR, EMP_NUM VARCHAR) ###Answer: SELECT T3.EMP_FNAME, T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM = T3.EMP_NUM WHERE DEPT_NAME = ""Biology""" "convert the question into postgresql query using the context values ### Question: What are the first names and date of birth of professors teaching course ACCT-211? ### Context: CREATE TABLE CLASS (PROF_NUM VARCHAR); CREATE TABLE employee (EMP_FNAME VARCHAR, EMP_DOB VARCHAR, EMP_NUM VARCHAR) ###Answer: SELECT DISTINCT T1.EMP_FNAME, T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = ""ACCT-211""" "convert the question into postgresql query using the context values ### Question: How many classes are professor whose last name is Graztevski has? ### Context: CREATE TABLE CLASS (PROF_NUM VARCHAR); CREATE TABLE employee (EMP_NUM VARCHAR, EMP_LNAME VARCHAR) ###Answer: SELECT COUNT(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'" "convert the question into postgresql query using the context values ### Question: What is the code of the school where the accounting department belongs to? ### Context: CREATE TABLE department (school_code VARCHAR, dept_name VARCHAR) ###Answer: SELECT school_code FROM department WHERE dept_name = ""Accounting""" "convert the question into postgresql query using the context values ### Question: How many credits does course CIS-220 have, and what its description? ### Context: CREATE TABLE course (crs_credit VARCHAR, crs_description VARCHAR, crs_code VARCHAR) ###Answer: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'CIS-220'" "convert the question into postgresql query using the context values ### Question: what is the address of history department? ### Context: CREATE TABLE department (dept_address VARCHAR, dept_name VARCHAR) ###Answer: SELECT dept_address FROM department WHERE dept_name = 'History'" "convert the question into postgresql query using the context values ### Question: How many different locations does the school with code BUS has? ### Context: CREATE TABLE department (dept_address VARCHAR, school_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'" "convert the question into postgresql query using the context values ### Question: How many different locations does each school have? ### Context: CREATE TABLE department (school_code VARCHAR, dept_address VARCHAR) ###Answer: SELECT COUNT(DISTINCT dept_address), school_code FROM department GROUP BY school_code" "convert the question into postgresql query using the context values ### Question: Find the description and credit for the course QM-261? ### Context: CREATE TABLE course (crs_credit VARCHAR, crs_description VARCHAR, crs_code VARCHAR) ###Answer: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'QM-261'" "convert the question into postgresql query using the context values ### Question: Find the number of departments in each school. ### Context: CREATE TABLE department (school_code VARCHAR, dept_name VARCHAR) ###Answer: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code" "convert the question into postgresql query using the context values ### Question: Find the number of different departments in each school whose number of different departments is less than 5. ### Context: CREATE TABLE department (school_code VARCHAR, dept_name VARCHAR) ###Answer: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code HAVING COUNT(DISTINCT dept_name) < 5" "convert the question into postgresql query using the context values ### Question: How many sections does each course has? ### Context: CREATE TABLE CLASS (crs_code VARCHAR) ###Answer: SELECT COUNT(*), crs_code FROM CLASS GROUP BY crs_code" "convert the question into postgresql query using the context values ### Question: What is the total credit does each department offer? ### Context: CREATE TABLE course (dept_code VARCHAR, crs_credit INTEGER) ###Answer: SELECT SUM(crs_credit), dept_code FROM course GROUP BY dept_code" "convert the question into postgresql query using the context values ### Question: Find the number of classes offered for all class rooms that held at least 2 classes. ### Context: CREATE TABLE CLASS (class_room VARCHAR) ###Answer: SELECT COUNT(*), class_room FROM CLASS GROUP BY class_room HAVING COUNT(*) >= 2" "convert the question into postgresql query using the context values ### Question: Find the number of classes in each department. ### Context: CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE course (crs_code VARCHAR) ###Answer: SELECT COUNT(*), dept_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code GROUP BY dept_code" "convert the question into postgresql query using the context values ### Question: Find the number of classes in each school. ### Context: CREATE TABLE department (school_code VARCHAR, dept_code VARCHAR); CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE course (crs_code VARCHAR, dept_code VARCHAR) ###Answer: SELECT COUNT(*), T3.school_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T2.dept_code = T3.dept_code GROUP BY T3.school_code" "convert the question into postgresql query using the context values ### Question: What is the number of professors for different school? ### Context: CREATE TABLE department (school_code VARCHAR, dept_code VARCHAR); CREATE TABLE professor (dept_code VARCHAR) ###Answer: SELECT COUNT(*), T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code" "convert the question into postgresql query using the context values ### Question: Find the count and code of the job has most employees. ### Context: CREATE TABLE employee (emp_jobcode VARCHAR) ###Answer: SELECT emp_jobcode, COUNT(*) FROM employee GROUP BY emp_jobcode ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Which school has the smallest amount of professors? ### Context: CREATE TABLE department (school_code VARCHAR, dept_code VARCHAR); CREATE TABLE professor (dept_code VARCHAR) ###Answer: SELECT T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the number of professors with a Ph.D. degree in each department. ### Context: CREATE TABLE professor (dept_code VARCHAR, prof_high_degree VARCHAR) ###Answer: SELECT COUNT(*), dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code" "convert the question into postgresql query using the context values ### Question: Find the number of students for each department. ### Context: CREATE TABLE student (dept_code VARCHAR) ###Answer: SELECT COUNT(*), dept_code FROM student GROUP BY dept_code" "convert the question into postgresql query using the context values ### Question: Find the total number of hours have done for all students in each department. ### Context: CREATE TABLE student (dept_code VARCHAR, stu_hrs INTEGER) ###Answer: SELECT SUM(stu_hrs), dept_code FROM student GROUP BY dept_code" "convert the question into postgresql query using the context values ### Question: Find the max, average, and minimum gpa of all students in each department. ### Context: CREATE TABLE student (dept_code VARCHAR, stu_gpa INTEGER) ###Answer: SELECT MAX(stu_gpa), AVG(stu_gpa), MIN(stu_gpa), dept_code FROM student GROUP BY dept_code" "convert the question into postgresql query using the context values ### Question: What is the name and the average gpa of department whose students have the highest average gpa? ### Context: CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE student (stu_gpa INTEGER, dept_code VARCHAR) ###Answer: SELECT T2.dept_name, AVG(T1.stu_gpa) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY AVG(T1.stu_gpa) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: how many schools exist in total? ### Context: CREATE TABLE department (school_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT school_code) FROM department" "convert the question into postgresql query using the context values ### Question: How many different classes are there? ### Context: CREATE TABLE CLASS (class_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT class_code) FROM CLASS" "convert the question into postgresql query using the context values ### Question: How many courses are offered? ### Context: CREATE TABLE CLASS (crs_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT crs_code) FROM CLASS" "convert the question into postgresql query using the context values ### Question: How many departments does the college has? ### Context: CREATE TABLE department (dept_name VARCHAR) ###Answer: SELECT COUNT(DISTINCT dept_name) FROM department" "convert the question into postgresql query using the context values ### Question: How many courses are offered by the Computer Info. Systems department? ### Context: CREATE TABLE course (dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR) ###Answer: SELECT COUNT(*) FROM department AS T1 JOIN course AS T2 ON T1.dept_code = T2.dept_code WHERE dept_name = ""Computer Info. Systems""" "convert the question into postgresql query using the context values ### Question: How many sections does course ACCT-211 has? ### Context: CREATE TABLE CLASS (class_section VARCHAR, crs_code VARCHAR) ###Answer: SELECT COUNT(DISTINCT class_section) FROM CLASS WHERE crs_code = 'ACCT-211'" "convert the question into postgresql query using the context values ### Question: Find the total credits of all classes offered by each department. ### Context: CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_credit INTEGER, crs_code VARCHAR) ###Answer: SELECT SUM(T1.crs_credit), T1.dept_code FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code GROUP BY T1.dept_code" "convert the question into postgresql query using the context values ### Question: Find the name of the department that offers the largest number of credits of all classes. ### Context: CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_code VARCHAR, crs_credit INTEGER) ###Answer: SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY SUM(T1.crs_credit) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: How many students enrolled in class ACCT-211? ### Context: CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR) ###Answer: SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'" "convert the question into postgresql query using the context values ### Question: What is the first name of each student enrolled in class ACCT-211? ### Context: CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR) ###Answer: SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'" "convert the question into postgresql query using the context values ### Question: What is the first name of students enrolled in class ACCT-211 and got grade C? ### Context: CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR, enroll_grade VARCHAR) ###Answer: SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' AND T2.enroll_grade = 'C'" "convert the question into postgresql query using the context values ### Question: Find the total number of employees. ### Context: CREATE TABLE employee (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM employee" "convert the question into postgresql query using the context values ### Question: How many professors do have a Ph.D. degree? ### Context: CREATE TABLE professor (prof_high_degree VARCHAR) ###Answer: SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.'" "convert the question into postgresql query using the context values ### Question: How many students are enrolled in the class taught by some professor from the accounting department? ### Context: CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE course (crs_code VARCHAR, dept_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR) ###Answer: SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'" "convert the question into postgresql query using the context values ### Question: What is the name of the department that has the largest number of students enrolled? ### Context: CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) ###Answer: SELECT T4.dept_name FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code GROUP BY T3.dept_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: list names of all departments ordered by their names. ### Context: CREATE TABLE department (dept_name VARCHAR) ###Answer: SELECT dept_name FROM department ORDER BY dept_name" "convert the question into postgresql query using the context values ### Question: List the codes of all courses that take place in room KLR209. ### Context: CREATE TABLE CLASS (class_code VARCHAR, class_room VARCHAR) ###Answer: SELECT class_code FROM CLASS WHERE class_room = 'KLR209'" "convert the question into postgresql query using the context values ### Question: List the first name of all employees with job code PROF ordered by their date of birth. ### Context: CREATE TABLE employee (emp_fname VARCHAR, emp_jobcode VARCHAR, emp_dob VARCHAR) ###Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob" "convert the question into postgresql query using the context values ### Question: Find the first names and offices of all professors sorted by alphabetical order of their first name. ### Context: CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname" "convert the question into postgresql query using the context values ### Question: What is the first and last name of the oldest employee? ### Context: CREATE TABLE employee (emp_fname VARCHAR, emp_lname VARCHAR, emp_dob VARCHAR) ###Answer: SELECT emp_fname, emp_lname FROM employee ORDER BY emp_dob LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the first, last name, gpa of the youngest one among students whose GPA is above 3? ### Context: CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_gpa INTEGER, stu_dob VARCHAR) ###Answer: SELECT stu_fname, stu_lname, stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the first name of students who got grade C in any class? ### Context: CREATE TABLE student (stu_num VARCHAR); CREATE TABLE enroll (stu_num VARCHAR) ###Answer: SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'" "convert the question into postgresql query using the context values ### Question: What is the name of department where has the smallest number of professors? ### Context: CREATE TABLE professor (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) ###Answer: SELECT T2.dept_name FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) LIMIT 1" "convert the question into postgresql query using the context values ### Question: What is the name of department where has the largest number of professors with a Ph.D. degree? ### Context: CREATE TABLE professor (dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) ###Answer: SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: What are the first names of the professors who do not teach a class. ### Context: CREATE TABLE employee (emp_fname VARCHAR, emp_jobcode VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num" "convert the question into postgresql query using the context values ### Question: What is the first names of the professors from the history department who do not teach a class. ### Context: CREATE TABLE professor (emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num" "convert the question into postgresql query using the context values ### Question: What is the last name and office of the professor from the history department? ### Context: CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_lname VARCHAR, emp_num VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR) ###Answer: SELECT T1.emp_lname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History'" "convert the question into postgresql query using the context values ### Question: What is department name and office for the professor whose last name is Heffington? ### Context: CREATE TABLE employee (emp_num VARCHAR, emp_lname VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR) ###Answer: SELECT T3.dept_name, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington'" "convert the question into postgresql query using the context values ### Question: Find the last name and hire date of the professor who is in office DRE 102. ### Context: CREATE TABLE professor (emp_num VARCHAR, prof_office VARCHAR); CREATE TABLE employee (emp_lname VARCHAR, emp_hiredate VARCHAR, emp_num VARCHAR) ###Answer: SELECT T1.emp_lname, T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102'" "convert the question into postgresql query using the context values ### Question: What is the code of the course which the student whose last name is Smithson took? ### Context: CREATE TABLE student (stu_num VARCHAR, stu_lname VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR); CREATE TABLE CLASS (crs_code VARCHAR, class_code VARCHAR) ###Answer: SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'" "convert the question into postgresql query using the context values ### Question: What are the description and credit of the course which the student whose last name is Smithson took? ### Context: CREATE TABLE student (stu_num VARCHAR, stu_lname VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_credit VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR) ###Answer: SELECT T4.crs_description, T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson'" "convert the question into postgresql query using the context values ### Question: How many professors who has a either Ph.D. or MA degree? ### Context: CREATE TABLE professor (prof_high_degree VARCHAR) ###Answer: SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA'" "convert the question into postgresql query using the context values ### Question: How many professors who are from either Accounting or Biology department? ### Context: CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (dept_code VARCHAR) ###Answer: SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology'" "convert the question into postgresql query using the context values ### Question: Find the first name of the professor who is teaching two courses with code CIS-220 and QM-261. ### Context: CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261'" "convert the question into postgresql query using the context values ### Question: Find the first name of student who is taking classes from accounting and Computer Info. Systems departments ### Context: CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE course (crs_code VARCHAR, dept_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR) ###Answer: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'" "convert the question into postgresql query using the context values ### Question: What is the average gpa of the students enrolled in the course with code ACCT-211? ### Context: CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_gpa INTEGER, stu_num VARCHAR) ###Answer: SELECT AVG(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'" "convert the question into postgresql query using the context values ### Question: What is the first name, gpa and phone number of the top 5 students with highest gpa? ### Context: CREATE TABLE student (stu_gpa VARCHAR, stu_phone VARCHAR, stu_fname VARCHAR) ###Answer: SELECT stu_gpa, stu_phone, stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5" "convert the question into postgresql query using the context values ### Question: What is the department name of the students with lowest gpa belongs to? ### Context: CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) ###Answer: SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the first name and gpa of the students whose gpa is lower than the average gpa of all students. ### Context: CREATE TABLE student (stu_fname VARCHAR, stu_gpa INTEGER) ###Answer: SELECT stu_fname, stu_gpa FROM student WHERE stu_gpa < (SELECT AVG(stu_gpa) FROM student)" "convert the question into postgresql query using the context values ### Question: Find the name and address of the department that has the highest number of students. ### Context: CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_address VARCHAR, dept_code VARCHAR) ###Answer: SELECT T2.dept_name, T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: Find the name, address, number of students in the departments that have the top 3 highest number of students. ### Context: CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_address VARCHAR, dept_code VARCHAR) ###Answer: SELECT T2.dept_name, T2.dept_address, COUNT(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 3" "convert the question into postgresql query using the context values ### Question: Find the first name and office of the professor who is in the history department and has a Ph.D. degree. ### Context: CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T1.emp_fname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'" "convert the question into postgresql query using the context values ### Question: Find the first names of all instructors who have taught some course and the course code. ### Context: CREATE TABLE CLASS (crs_code VARCHAR, prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T2.emp_fname, T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num" "convert the question into postgresql query using the context values ### Question: Find the first names of all instructors who have taught some course and the course description. ### Context: CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T2.emp_fname, T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code" "convert the question into postgresql query using the context values ### Question: Find the first names and offices of all instructors who have taught some course and also find the course description. ### Context: CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T2.emp_fname, T4.prof_office, T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num" "convert the question into postgresql query using the context values ### Question: Find the first names and offices of all instructors who have taught some course and the course description and the department name. ### Context: CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR) ###Answer: SELECT T2.emp_fname, T4.prof_office, T3.crs_description, T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code" "convert the question into postgresql query using the context values ### Question: Find names of all students who took some course and the course description. ### Context: CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_num VARCHAR) ###Answer: SELECT T1.stu_fname, T1.stu_lname, T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code" "convert the question into postgresql query using the context values ### Question: Find names of all students who took some course and got A or C. ### Context: CREATE TABLE enroll (stu_num VARCHAR, enroll_grade VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_num VARCHAR) ###Answer: SELECT T1.stu_fname, T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'" "convert the question into postgresql query using the context values ### Question: Find the first names of all professors in the Accounting department who is teaching some course and the class room. ### Context: CREATE TABLE CLASS (class_room VARCHAR, prof_num VARCHAR); CREATE TABLE professor (emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T2.emp_fname, T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting'" "convert the question into postgresql query using the context values ### Question: Find the first names and degree of all professors who are teaching some class in Computer Info. Systems department. ### Context: CREATE TABLE professor (prof_high_degree VARCHAR, emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR) ###Answer: SELECT DISTINCT T2.emp_fname, T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems'" "convert the question into postgresql query using the context values ### Question: What is the last name of the student who got a grade A in the class with code 10018. ### Context: CREATE TABLE enroll (stu_num VARCHAR, enroll_grade VARCHAR, class_code VARCHAR); CREATE TABLE student (stu_lname VARCHAR, stu_num VARCHAR) ###Answer: SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018" "convert the question into postgresql query using the context values ### Question: Find the first name and office of history professor who did not get a Ph.D. degree. ### Context: CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) ###Answer: SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree <> 'Ph.D.'" "convert the question into postgresql query using the context values ### Question: Find the first names of professors who are teaching more than one class. ### Context: CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR) ###Answer: SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING COUNT(*) > 1" "convert the question into postgresql query using the context values ### Question: Find the first names of students who took exactly one class. ### Context: CREATE TABLE enroll (stu_num VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR) ###Answer: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING COUNT(*) = 1" "convert the question into postgresql query using the context values ### Question: Find the name of department that offers the class whose description has the word ""Statistics"". ### Context: CREATE TABLE course (dept_code VARCHAR, crs_description VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) ###Answer: SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'" "convert the question into postgresql query using the context values ### Question: What is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class? ### Context: CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR, stu_lname VARCHAR) ###Answer: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'" "convert the question into postgresql query using the context values ### Question: How many clubs are there? ### Context: CREATE TABLE club (Id VARCHAR) ###Answer: SELECT COUNT(*) FROM club" "convert the question into postgresql query using the context values ### Question: List the distinct region of clubs in ascending alphabetical order. ### Context: CREATE TABLE club (Region VARCHAR) ###Answer: SELECT DISTINCT Region FROM club ORDER BY Region" "convert the question into postgresql query using the context values ### Question: What is the average number of gold medals for clubs? ### Context: CREATE TABLE club_rank (Gold INTEGER) ###Answer: SELECT AVG(Gold) FROM club_rank" "convert the question into postgresql query using the context values ### Question: What are the types and countries of competitions? ### Context: CREATE TABLE competition (Competition_type VARCHAR, Country VARCHAR) ###Answer: SELECT Competition_type, Country FROM competition" "convert the question into postgresql query using the context values ### Question: What are the distinct years in which the competitions type is not ""Tournament""? ### Context: CREATE TABLE competition (YEAR VARCHAR, Competition_type VARCHAR) ###Answer: SELECT DISTINCT YEAR FROM competition WHERE Competition_type <> ""Tournament""" "convert the question into postgresql query using the context values ### Question: What are the maximum and minimum number of silver medals for clubs. ### Context: CREATE TABLE club_rank (Silver INTEGER) ###Answer: SELECT MAX(Silver), MIN(Silver) FROM club_rank" "convert the question into postgresql query using the context values ### Question: How many clubs have total medals less than 10? ### Context: CREATE TABLE club_rank (Total INTEGER) ###Answer: SELECT COUNT(*) FROM club_rank WHERE Total < 10" "convert the question into postgresql query using the context values ### Question: List all club names in ascending order of start year. ### Context: CREATE TABLE club (name VARCHAR, Start_year VARCHAR) ###Answer: SELECT name FROM club ORDER BY Start_year" "convert the question into postgresql query using the context values ### Question: List all club names in descending alphabetical order. ### Context: CREATE TABLE club (name VARCHAR) ###Answer: SELECT name FROM club ORDER BY name DESC" "convert the question into postgresql query using the context values ### Question: Please show the names and the players of clubs. ### Context: CREATE TABLE club (name VARCHAR, Club_ID VARCHAR); CREATE TABLE player (Player_id VARCHAR, Club_ID VARCHAR) ###Answer: SELECT T1.name, T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID" "convert the question into postgresql query using the context values ### Question: Show the names of clubs that have players with position ""Right Wing"". ### Context: CREATE TABLE club (name VARCHAR, Club_ID VARCHAR); CREATE TABLE player (Club_ID VARCHAR, Position VARCHAR) ###Answer: SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = ""Right Wing""" "convert the question into postgresql query using the context values ### Question: What is the average points of players from club with name ""AIB"". ### Context: CREATE TABLE player (Points INTEGER, Club_ID VARCHAR); CREATE TABLE club (Club_ID VARCHAR, name VARCHAR) ###Answer: SELECT AVG(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = ""AIB""" "convert the question into postgresql query using the context values ### Question: List the position of players and the average number of points of players of each position. ### Context: CREATE TABLE player (POSITION VARCHAR, Points INTEGER) ###Answer: SELECT POSITION, AVG(Points) FROM player GROUP BY POSITION" "convert the question into postgresql query using the context values ### Question: List the position of players with average number of points scored by players of that position bigger than 20. ### Context: CREATE TABLE player (POSITION VARCHAR, name VARCHAR, Points INTEGER) ###Answer: SELECT POSITION FROM player GROUP BY name HAVING AVG(Points) >= 20" "convert the question into postgresql query using the context values ### Question: List the types of competition and the number of competitions of each type. ### Context: CREATE TABLE competition (Competition_type VARCHAR) ###Answer: SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type" "convert the question into postgresql query using the context values ### Question: List the most common type of competition. ### Context: CREATE TABLE competition (Competition_type VARCHAR) ###Answer: SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1" "convert the question into postgresql query using the context values ### Question: List the types of competition that have at most five competitions of that type. ### Context: CREATE TABLE competition (Competition_type VARCHAR) ###Answer: SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5" "convert the question into postgresql query using the context values ### Question: List the names of clubs that do not have any players. ### Context: CREATE TABLE player (name VARCHAR, Club_ID VARCHAR); CREATE TABLE CLub (name VARCHAR, Club_ID VARCHAR) ###Answer: SELECT name FROM CLub WHERE NOT Club_ID IN (SELECT Club_ID FROM player)"