text
stringlengths
182
1.07k
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