question
stringlengths 19
224
⌀ | context
stringlengths 30
355
⌀ | answer
stringlengths 20
557
⌀ | input
stringlengths 138
630
| output
stringlengths 20
557
|
---|---|---|---|---|
In which year did the most recent crime happen? | CREATE TABLE perpetrator (YEAR INTEGER) | SELECT MAX(YEAR) FROM perpetrator | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE perpetrator (YEAR INTEGER)
### question:In which year did the most recent crime happen? | SELECT MAX(YEAR) FROM perpetrator |
Report the name of all campuses in Los Angeles county. | CREATE TABLE campuses (campus VARCHAR, county VARCHAR) | SELECT campus FROM campuses WHERE county = "Los Angeles" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, county VARCHAR)
### question:Report the name of all campuses in Los Angeles county. | SELECT campus FROM campuses WHERE county = "Los Angeles" |
What are the names of all campuses located at Chico? | CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR) | SELECT campus FROM campuses WHERE LOCATION = "Chico" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR)
### question:What are the names of all campuses located at Chico? | SELECT campus FROM campuses WHERE LOCATION = "Chico" |
Find all the campuses opened in 1958. | CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR) | SELECT campus FROM campuses WHERE YEAR = 1958 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR)
### question:Find all the campuses opened in 1958. | SELECT campus FROM campuses WHERE YEAR = 1958 |
Find the name of the campuses opened before 1800. | CREATE TABLE campuses (campus VARCHAR, YEAR INTEGER) | SELECT campus FROM campuses WHERE YEAR < 1800 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, YEAR INTEGER)
### question:Find the name of the campuses opened before 1800. | SELECT campus FROM campuses WHERE YEAR < 1800 |
Which campus was opened between 1935 and 1939? | CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR) | SELECT campus FROM campuses WHERE YEAR >= 1935 AND YEAR <= 1939 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR)
### question:Which campus was opened between 1935 and 1939? | SELECT campus FROM campuses WHERE YEAR >= 1935 AND YEAR <= 1939 |
Find the name of the campuses that is in Northridge, Los Angeles or in San Francisco, San Francisco. | CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR, county VARCHAR) | SELECT campus FROM campuses WHERE LOCATION = "Northridge" AND county = "Los Angeles" UNION SELECT campus FROM campuses WHERE LOCATION = "San Francisco" AND county = "San Francisco" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR, county VARCHAR)
### question:Find the name of the campuses that is in Northridge, Los Angeles or in San Francisco, San Francisco. | SELECT campus FROM campuses WHERE LOCATION = "Northridge" AND county = "Los Angeles" UNION SELECT campus FROM campuses WHERE LOCATION = "San Francisco" AND county = "San Francisco" |
What is the campus fee of "San Jose State University" in year 1996? | CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR)
### question:What is the campus fee of "San Jose State University" in year 1996? | 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 |
What is the campus fee of "San Francisco State University" in year 1996? | CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR)
### question:What is the campus fee of "San Francisco State University" in year 1996? | 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 |
Find the count of universities whose campus fee is greater than the average campus fee. | CREATE TABLE csu_fees (campusfee INTEGER) | SELECT COUNT(*) FROM csu_fees WHERE campusfee > (SELECT AVG(campusfee) FROM csu_fees) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE csu_fees (campusfee INTEGER)
### question:Find the count of universities whose campus fee is greater than the average campus fee. | SELECT COUNT(*) FROM csu_fees WHERE campusfee > (SELECT AVG(campusfee) FROM csu_fees) |
Which university is in Los Angeles county and opened after 1950? | CREATE TABLE campuses (campus VARCHAR, county VARCHAR, YEAR VARCHAR) | SELECT campus FROM campuses WHERE county = "Los Angeles" AND YEAR > 1950 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, county VARCHAR, YEAR VARCHAR)
### question:Which university is in Los Angeles county and opened after 1950? | SELECT campus FROM campuses WHERE county = "Los Angeles" AND YEAR > 1950 |
Which year has the most degrees conferred? | CREATE TABLE degrees (YEAR VARCHAR, degrees INTEGER) | SELECT YEAR FROM degrees GROUP BY YEAR ORDER BY SUM(degrees) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE degrees (YEAR VARCHAR, degrees INTEGER)
### question:Which year has the most degrees conferred? | SELECT YEAR FROM degrees GROUP BY YEAR ORDER BY SUM(degrees) DESC LIMIT 1 |
Which campus has the most degrees conferred in all times? | CREATE TABLE degrees (campus VARCHAR, degrees INTEGER) | SELECT campus FROM degrees GROUP BY campus ORDER BY SUM(degrees) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE degrees (campus VARCHAR, degrees INTEGER)
### question:Which campus has the most degrees conferred in all times? | SELECT campus FROM degrees GROUP BY campus ORDER BY SUM(degrees) DESC LIMIT 1 |
Which campus has the most faculties in year 2003? | CREATE TABLE faculty (campus VARCHAR, year VARCHAR, faculty VARCHAR); CREATE TABLE campuses (campus VARCHAR, id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE faculty (campus VARCHAR, year VARCHAR, faculty VARCHAR); CREATE TABLE campuses (campus VARCHAR, id VARCHAR)
### question:Which campus has the most faculties in year 2003? | 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 |
Find the average fee on a CSU campus in 1996 | CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR) | SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 1996 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR)
### question:Find the average fee on a CSU campus in 1996 | SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 1996 |
What is the average fee on a CSU campus in 2005? | CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR) | SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 2005 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR)
### question:What is the average fee on a CSU campus in 2005? | SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 2005 |
report the total number of degrees granted between 1998 and 2002. | CREATE TABLE campuses (campus VARCHAR, id VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, id VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR)
### question:report the total number of degrees granted between 1998 and 2002. | 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 |
For each Orange county campus, report the number of degrees granted after 2000. | CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR)
### question:For each Orange county campus, report the number of degrees granted after 2000. | 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 |
Find the names of the campus which has more faculties in 2002 than every campus in Orange county. | CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR) | 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") | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)
### question:Find the names of the campus which has more faculties in 2002 than every campus in Orange county. | 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") |
What campus had more than 400 total enrollment but more than 200 full time enrollment in year 1956? | CREATE TABLE enrollments (campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE enrollments (campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR)
### question:What campus had more than 400 total enrollment but more than 200 full time enrollment in year 1956? | 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 |
How many campuses are there in Los Angeles county? | CREATE TABLE campuses (county VARCHAR) | SELECT COUNT(*) FROM campuses WHERE county = "Los Angeles" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (county VARCHAR)
### question:How many campuses are there in Los Angeles county? | SELECT COUNT(*) FROM campuses WHERE county = "Los Angeles" |
How many degrees were conferred in "San Jose State University" in 2000? | CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR)
### question:How many degrees were conferred in "San Jose State University" in 2000? | 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 |
What are the degrees conferred in "San Francisco State University" in 2001. | CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR)
### question:What are the degrees conferred in "San Francisco State University" in 2001. | 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 |
How many faculty is there in total in the year of 2002? | CREATE TABLE faculty (faculty INTEGER, YEAR VARCHAR) | SELECT SUM(faculty) FROM faculty WHERE YEAR = 2002 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE faculty (faculty INTEGER, YEAR VARCHAR)
### question:How many faculty is there in total in the year of 2002? | SELECT SUM(faculty) FROM faculty WHERE YEAR = 2002 |
What is the number of faculty lines in campus "Long Beach State University" in 2002? | CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR) | 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" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)
### question:What is the number of faculty lines in campus "Long Beach State University" in 2002? | 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" |
How many faculty lines are there in "San Francisco State University" in year 2004? | CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR) | 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" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)
### question:How many faculty lines are there in "San Francisco State University" in year 2004? | 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" |
List the campus that have between 600 and 1000 faculty lines in year 2004. | CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (campus VARCHAR, faculty VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (campus VARCHAR, faculty VARCHAR)
### question:List the campus that have between 600 and 1000 faculty lines in year 2004. | 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 |
How many faculty lines are there in the university that conferred the most number of degrees in year 2002? | CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR)
### question:How many faculty lines are there in the university that conferred the most number of degrees in year 2002? | 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 |
How many faculty lines are there in the university that conferred the least number of degrees in year 2001? | CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR)
### question:How many faculty lines are there in the university that conferred the least number of degrees in year 2001? | 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 |
How many undergraduates are there in "San Jose State University" in year 2004? | CREATE TABLE discipline_enrollments (undergraduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR) | 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" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE discipline_enrollments (undergraduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR)
### question:How many undergraduates are there in "San Jose State University" in year 2004? | 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" |
What is the number of graduates in "San Francisco State University" in year 2004? | CREATE TABLE discipline_enrollments (graduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR) | 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" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE discipline_enrollments (graduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR)
### question:What is the number of graduates in "San Francisco State University" in year 2004? | 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" |
What is the campus fee of "San Francisco State University" in year 2000? | CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR)
### question:What is the campus fee of "San Francisco State University" in year 2000? | 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 |
Find the campus fee of "San Jose State University" in year 2000. | CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR)
### question:Find the campus fee of "San Jose State University" in year 2000. | 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 |
How many CSU campuses are there? | CREATE TABLE campuses (Id VARCHAR) | SELECT COUNT(*) FROM campuses | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE campuses (Id VARCHAR)
### question:How many CSU campuses are there? | SELECT COUNT(*) FROM campuses |
How many candidates are there? | CREATE TABLE candidate (Id VARCHAR) | SELECT COUNT(*) FROM candidate | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (Id VARCHAR)
### question:How many candidates are there? | SELECT COUNT(*) FROM candidate |
Which poll resource provided the most number of candidate information? | CREATE TABLE candidate (poll_source VARCHAR) | SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY COUNT(*) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (poll_source VARCHAR)
### question:Which poll resource provided the most number of candidate information? | SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY COUNT(*) DESC LIMIT 1 |
what are the top 3 highest support rates? | CREATE TABLE candidate (support_rate VARCHAR) | SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (support_rate VARCHAR)
### question:what are the top 3 highest support rates? | SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3 |
Find the id of the candidate who got the lowest oppose rate. | CREATE TABLE candidate (Candidate_ID VARCHAR, oppose_rate VARCHAR) | SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (Candidate_ID VARCHAR, oppose_rate VARCHAR)
### question:Find the id of the candidate who got the lowest oppose rate. | SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1 |
Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate. | CREATE TABLE candidate (Support_rate VARCHAR, Consider_rate VARCHAR, Oppose_rate VARCHAR, unsure_rate VARCHAR) | SELECT Support_rate, Consider_rate, Oppose_rate FROM candidate ORDER BY unsure_rate | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (Support_rate VARCHAR, Consider_rate VARCHAR, Oppose_rate VARCHAR, unsure_rate VARCHAR)
### question:Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate. | SELECT Support_rate, Consider_rate, Oppose_rate FROM candidate ORDER BY unsure_rate |
which poll source does the highest oppose rate come from? | CREATE TABLE candidate (poll_source VARCHAR, oppose_rate VARCHAR) | SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (poll_source VARCHAR, oppose_rate VARCHAR)
### question:which poll source does the highest oppose rate come from? | SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1 |
List all people names in the order of their date of birth from old to young. | CREATE TABLE people (name VARCHAR, date_of_birth VARCHAR) | SELECT name FROM people ORDER BY date_of_birth | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE people (name VARCHAR, date_of_birth VARCHAR)
### question:List all people names in the order of their date of birth from old to young. | SELECT name FROM people ORDER BY date_of_birth |
Find the average height and weight for all males (sex is M). | CREATE TABLE people (height INTEGER, weight INTEGER, sex VARCHAR) | SELECT AVG(height), AVG(weight) FROM people WHERE sex = 'M' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE people (height INTEGER, weight INTEGER, sex VARCHAR)
### question:Find the average height and weight for all males (sex is M). | SELECT AVG(height), AVG(weight) FROM people WHERE sex = 'M' |
find the names of people who are taller than 200 or lower than 190. | CREATE TABLE people (name VARCHAR, height VARCHAR) | SELECT name FROM people WHERE height > 200 OR height < 190 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE people (name VARCHAR, height VARCHAR)
### question:find the names of people who are taller than 200 or lower than 190. | SELECT name FROM people WHERE height > 200 OR height < 190 |
Find the average and minimum weight for each gender. | CREATE TABLE people (sex VARCHAR, weight INTEGER) | SELECT AVG(weight), MIN(weight), sex FROM people GROUP BY sex | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE people (sex VARCHAR, weight INTEGER)
### question:Find the average and minimum weight for each gender. | SELECT AVG(weight), MIN(weight), sex FROM people GROUP BY sex |
Find the name and gender of the candidate who got the highest support rate. | CREATE TABLE candidate (people_id VARCHAR, support_rate VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (people_id VARCHAR, support_rate VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR)
### question:Find the name and gender of the candidate who got the highest support rate. | 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 |
Find the name of the candidates whose oppose percentage is the lowest for each sex. | CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR)
### question:Find the name of the candidates whose oppose percentage is the lowest for each sex. | 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 |
which gender got the highest average uncertain ratio. | CREATE TABLE candidate (people_id VARCHAR, unsure_rate INTEGER); CREATE TABLE people (sex VARCHAR, people_id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (people_id VARCHAR, unsure_rate INTEGER); CREATE TABLE people (sex VARCHAR, people_id VARCHAR)
### question:which gender got the highest average uncertain ratio. | 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 |
what are the names of people who did not participate in the candidate election. | CREATE TABLE candidate (name VARCHAR, people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR) | SELECT name FROM people WHERE NOT people_id IN (SELECT people_id FROM candidate) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (name VARCHAR, people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR)
### question:what are the names of people who did not participate in the candidate election. | SELECT name FROM people WHERE NOT people_id IN (SELECT people_id FROM candidate) |
Find the names of the candidates whose support percentage is lower than their oppose rate. | CREATE TABLE candidate (people_id VARCHAR, support_rate INTEGER, oppose_rate VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (people_id VARCHAR, support_rate INTEGER, oppose_rate VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR)
### question:Find the names of the candidates whose support percentage is lower than their oppose rate. | 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 |
how many people are there whose weight is higher than 85 for each gender? | CREATE TABLE people (sex VARCHAR, weight INTEGER) | SELECT COUNT(*), sex FROM people WHERE weight > 85 GROUP BY sex | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE people (sex VARCHAR, weight INTEGER)
### question:how many people are there whose weight is higher than 85 for each gender? | SELECT COUNT(*), sex FROM people WHERE weight > 85 GROUP BY sex |
find the highest support percentage, lowest consider rate and oppose rate of all candidates. | CREATE TABLE candidate (support_rate INTEGER, consider_rate INTEGER, oppose_rate INTEGER) | SELECT MAX(support_rate), MIN(consider_rate), MIN(oppose_rate) FROM candidate | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (support_rate INTEGER, consider_rate INTEGER, oppose_rate INTEGER)
### question:find the highest support percentage, lowest consider rate and oppose rate of all candidates. | SELECT MAX(support_rate), MIN(consider_rate), MIN(oppose_rate) FROM candidate |
list all female (sex is F) candidate names in the alphabetical order. | CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR, sex VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR, sex VARCHAR)
### question:list all female (sex is F) candidate names in the alphabetical order. | 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 |
find the name of people whose height is lower than the average. | CREATE TABLE people (name VARCHAR, height INTEGER) | SELECT name FROM people WHERE height < (SELECT AVG(height) FROM people) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE people (name VARCHAR, height INTEGER)
### question:find the name of people whose height is lower than the average. | SELECT name FROM people WHERE height < (SELECT AVG(height) FROM people) |
List all info about all people. | CREATE TABLE people (Id VARCHAR) | SELECT * FROM people | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE people (Id VARCHAR)
### question:List all info about all people. | SELECT * FROM people |
Find the titles of all movies directed by steven spielberg. | CREATE TABLE Movie (title VARCHAR, director VARCHAR) | SELECT title FROM Movie WHERE director = 'Steven Spielberg' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (title VARCHAR, director VARCHAR)
### question:Find the titles of all movies directed by steven spielberg. | SELECT title FROM Movie WHERE director = 'Steven Spielberg' |
What is the name of the movie produced after 2000 and directed by James Cameron? | CREATE TABLE Movie (title VARCHAR, director VARCHAR, YEAR VARCHAR) | SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (title VARCHAR, director VARCHAR, YEAR VARCHAR)
### question:What is the name of the movie produced after 2000 and directed by James Cameron? | SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000 |
How many movies were made before 2000? | CREATE TABLE Movie (YEAR INTEGER) | SELECT COUNT(*) FROM Movie WHERE YEAR < 2000 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (YEAR INTEGER)
### question:How many movies were made before 2000? | SELECT COUNT(*) FROM Movie WHERE YEAR < 2000 |
Who is the director of movie Avatar? | CREATE TABLE Movie (director VARCHAR, title VARCHAR) | SELECT director FROM Movie WHERE title = 'Avatar' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (director VARCHAR, title VARCHAR)
### question:Who is the director of movie Avatar? | SELECT director FROM Movie WHERE title = 'Avatar' |
How many reviewers listed? | CREATE TABLE Reviewer (Id VARCHAR) | SELECT COUNT(*) FROM Reviewer | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (Id VARCHAR)
### question:How many reviewers listed? | SELECT COUNT(*) FROM Reviewer |
What is the id of the reviewer whose name has substring “Mike� | CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR) | SELECT rID FROM Reviewer WHERE name LIKE "%Mike%" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR)
### question:What is the id of the reviewer whose name has substring “Mike� | SELECT rID FROM Reviewer WHERE name LIKE "%Mike%" |
What is the reviewer id of Daniel Lewis? | CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR) | SELECT rID FROM Reviewer WHERE name = "Daniel Lewis" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR)
### question:What is the reviewer id of Daniel Lewis? | SELECT rID FROM Reviewer WHERE name = "Daniel Lewis" |
What is the total number of ratings that has more than 3 stars? | CREATE TABLE Rating (stars INTEGER) | SELECT COUNT(*) FROM Rating WHERE stars > 3 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (stars INTEGER)
### question:What is the total number of ratings that has more than 3 stars? | SELECT COUNT(*) FROM Rating WHERE stars > 3 |
What is the lowest and highest rating star? | CREATE TABLE Rating (stars INTEGER) | SELECT MAX(stars), MIN(stars) FROM Rating | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (stars INTEGER)
### question:What is the lowest and highest rating star? | SELECT MAX(stars), MIN(stars) FROM Rating |
Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year. | CREATE TABLE Movie (mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR) | SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR)
### question:Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year. | SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year |
What are the names of directors who directed movies with 5 star rating? Also return the title of these movies. | CREATE TABLE Movie (director VARCHAR, title VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR) | SELECT T1.director, T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (director VARCHAR, title VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR)
### question:What are the names of directors who directed movies with 5 star rating? Also return the title of these movies. | SELECT T1.director, T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5 |
What is the average rating star for each reviewer? | CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (stars INTEGER, rID VARCHAR) | SELECT T2.name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (stars INTEGER, rID VARCHAR)
### question:What is the average rating star for each reviewer? | SELECT T2.name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name |
Find the titles of all movies that have no ratings. | CREATE TABLE Rating (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) | SELECT title FROM Movie WHERE NOT mID IN (SELECT mID FROM Rating) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
### question:Find the titles of all movies that have no ratings. | SELECT title FROM Movie WHERE NOT mID IN (SELECT mID FROM Rating) |
Find the names of all reviewers who have ratings with a NULL value for the date. | CREATE TABLE Rating (rID VARCHAR); CREATE TABLE Reviewer (rID VARCHAR) | SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (rID VARCHAR); CREATE TABLE Reviewer (rID VARCHAR)
### question:Find the names of all reviewers who have ratings with a NULL value for the date. | SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null" |
What is the average rating stars and title for the oldest movie? | CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER) | 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) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER)
### question:What is the average rating stars and title for the oldest movie? | 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) |
What is the name of the most recent movie? | CREATE TABLE Movie (title VARCHAR, YEAR INTEGER) | SELECT title FROM Movie WHERE YEAR = (SELECT MAX(YEAR) FROM Movie) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (title VARCHAR, YEAR INTEGER)
### question:What is the name of the most recent movie? | SELECT title FROM Movie WHERE YEAR = (SELECT MAX(YEAR) FROM Movie) |
What is the maximum stars and year for the most recent movie? | CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER); CREATE TABLE Movie (year VARCHAR, mID VARCHAR) | 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) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER); CREATE TABLE Movie (year VARCHAR, mID VARCHAR)
### question:What is the maximum stars and year for the most recent movie? | 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) |
What is the names of movies whose created year is after all movies directed by Steven Spielberg? | CREATE TABLE Movie (title VARCHAR, YEAR INTEGER, director VARCHAR) | SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = "Steven Spielberg") | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (title VARCHAR, YEAR INTEGER, director VARCHAR)
### question:What is the names of movies whose created year is after all movies directed by Steven Spielberg? | SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = "Steven Spielberg") |
What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron? | CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR) | 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") | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)
### 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? | 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") |
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. | 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) | 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 | Translate the question into SQL query by using the schema.
### schema: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)
### 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. | 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 |
Find the names of all reviewers who have contributed three or more ratings. | CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR) | SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR)
### question:Find the names of all reviewers who have contributed three or more ratings. | SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3 |
Find the names of all reviewers who rated Gone with the Wind. | CREATE TABLE Movie (mID VARCHAR, title VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) | 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' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (mID VARCHAR, title VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
### question:Find the names of all reviewers who rated Gone with the Wind. | 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' |
Find the names of all directors whose movies are rated by Sarah Martinez. | CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) | 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' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
### question:Find the names of all directors whose movies are rated by Sarah Martinez. | 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' |
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. | 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) | 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 | Translate the question into SQL query by using the schema.
### schema: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)
### 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. | 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 |
Return all reviewer names and movie names together in a single list. | CREATE TABLE Reviewer (name VARCHAR, title VARCHAR); CREATE TABLE Movie (name VARCHAR, title VARCHAR) | SELECT name FROM Reviewer UNION SELECT title FROM Movie | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (name VARCHAR, title VARCHAR); CREATE TABLE Movie (name VARCHAR, title VARCHAR)
### question:Return all reviewer names and movie names together in a single list. | SELECT name FROM Reviewer UNION SELECT title FROM Movie |
Find the titles of all movies not reviewed by Chris Jackson. | 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) | 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' | Translate the question into SQL query by using the schema.
### schema: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)
### question:Find the titles of all movies not reviewed by Chris Jackson. | 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' |
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. | CREATE TABLE Movie (title VARCHAR, director VARCHAR); CREATE TABLE Movie (director VARCHAR, title VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (title VARCHAR, director VARCHAR); CREATE TABLE Movie (director VARCHAR, title VARCHAR)
### 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. | 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 |
For directors who had more than one movie, return the titles and produced years of all movies directed by them. | CREATE TABLE Movie (director VARCHAR, title VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, director VARCHAR) | SELECT T1.title, T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (director VARCHAR, title VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, director VARCHAR)
### question:For directors who had more than one movie, return the titles and produced years of all movies directed by them. | SELECT T1.title, T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title |
What are the names of the directors who made exactly one movie? | CREATE TABLE Movie (director VARCHAR) | SELECT director FROM Movie GROUP BY director HAVING COUNT(*) = 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (director VARCHAR)
### question:What are the names of the directors who made exactly one movie? | SELECT director FROM Movie GROUP BY director HAVING COUNT(*) = 1 |
What are the names of the directors who made exactly one movie excluding director NULL? | CREATE TABLE Movie (director VARCHAR) | SELECT director FROM Movie WHERE director <> "null" GROUP BY director HAVING COUNT(*) = 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Movie (director VARCHAR)
### question:What are the names of the directors who made exactly one movie excluding director NULL? | SELECT director FROM Movie WHERE director <> "null" GROUP BY director HAVING COUNT(*) = 1 |
How many movie reviews does each director get? | CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR) | SELECT COUNT(*), T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR)
### question:How many movie reviews does each director get? | SELECT COUNT(*), T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director |
Find the movies with the highest average rating. Return the movie titles and average rating. | CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
### question:Find the movies with the highest average rating. Return the movie titles and average rating. | 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 |
What are the movie titles and average rating of the movies with the lowest average rating? | CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
### question:What are the movie titles and average rating of the movies with the lowest average rating? | 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 |
What are the names and years of the movies that has the top 3 highest rating star? | CREATE TABLE Rating (mID VARCHAR, stars VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, mID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (mID VARCHAR, stars VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, mID VARCHAR)
### question:What are the names and years of the movies that has the top 3 highest rating star? | 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 |
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. | CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)
### 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. | 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 |
Find the title and star rating of the movie that got the least rating star for each reviewer. | CREATE TABLE Rating (rID VARCHAR, stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (rID VARCHAR, stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
### question:Find the title and star rating of the movie that got the least rating star for each reviewer. | 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 |
Find the title and score of the movie with the lowest rating among all movies directed by each director. | CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)
### question:Find the title and score of the movie with the lowest rating among all movies directed by each director. | 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 |
What is the name of the movie that is rated by most of times? | CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
### question:What is the name of the movie that is rated by most of times? | 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 |
What are the titles of all movies that have rating star is between 3 and 5? | CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, mID VARCHAR) | SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
### question:What are the titles of all movies that have rating star is between 3 and 5? | SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5 |
Find the names of reviewers who had given higher than 3 star ratings. | CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR, stars INTEGER) | SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR, stars INTEGER)
### question:Find the names of reviewers who had given higher than 3 star ratings. | SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3 |
Find the average rating star for each movie that are not reviewed by Brittany Harris. | CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
### question:Find the average rating star for each movie that are not reviewed by Brittany Harris. | 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 |
What are the ids of the movies that are not reviewed by Brittany Harris. | CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) | 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" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
### question:What are the ids of the movies that are not reviewed by Brittany Harris. | 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" |
Find the average rating star for each movie that received at least 2 ratings. | CREATE TABLE Rating (mID VARCHAR, stars INTEGER) | SELECT mID, AVG(stars) FROM Rating GROUP BY mID HAVING COUNT(*) >= 2 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (mID VARCHAR, stars INTEGER)
### question:Find the average rating star for each movie that received at least 2 ratings. | SELECT mID, AVG(stars) FROM Rating GROUP BY mID HAVING COUNT(*) >= 2 |
find the ids of reviewers who did not give 4 star. | CREATE TABLE Rating (rID VARCHAR, stars VARCHAR) | SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (rID VARCHAR, stars VARCHAR)
### question:find the ids of reviewers who did not give 4 star. | SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4 |
Find the ids of reviewers who didn't only give 4 star. | CREATE TABLE Rating (rID VARCHAR, stars VARCHAR) | SELECT rID FROM Rating WHERE stars <> 4 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Rating (rID VARCHAR, stars VARCHAR)
### question:Find the ids of reviewers who didn't only give 4 star. | SELECT rID FROM Rating WHERE stars <> 4 |
What are names of the movies that are either made after 2000 or reviewed by Brittany Harris? | CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR) | 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 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
### question:What are names of the movies that are either made after 2000 or reviewed by Brittany Harris? | 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 |