Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: How many faculty members did the university that conferred the most degrees in 2002 have? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: How many faculty lines are there in the university that conferred the least number of degrees in year 2001? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: How many faculty members are at the university that gave the least number of degrees in 2001? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: How many undergraduates are there in "San Jose State University" in year 2004? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: How many undergraduates are there at San Jose State [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: What is the number of graduates in "San Francisco State University" in year 2004? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: How many people graduated from San Francisco State University in 2004? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: What is the campus fee of "San Francisco State University" in year 2000? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: In the year 2000, what is the campus fee for San Francisco State University? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: Find the campus fee of "San Jose State University" in year 2000. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: What is the campus fee in the year 2000 for San Jose State University? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: How many CSU campuses are there? [/INST]

Output: SELECT count(*) FROM campuses;


Input:
[INST] Here is a database schema:
Campuses :
Id [ INT ] primary_key
Campus [ TEXT ]
Location [ TEXT ]
County [ TEXT ]
Year [ INT ]

csu_fees :
Campus [ INT ] primary_key csu_fees.Campus = Campuses.Id
Year [ INT ]
CampusFee [ INT ]

degrees :
Year [ INT ] primary_key
Campus [ INT ] degrees.Campus = Campuses.Id
Degrees [ INT ]

discipline_enrollments :
Campus [ INT ] primary_key discipline_enrollments.Campus = Campuses.Id
Discipline [ INT ]
Year [ INT ]
Undergraduate [ INT ]
Graduate [ INT ]

enrollments :
Campus [ INT ] primary_key enrollments.Campus = Campuses.Id
Year [ INT ]
TotalEnrollment_AY [ INT ]
FTE_AY [ INT ]

faculty :
Campus [ INT ] faculty.Campus = Campuses.Id
Year [ INT ]
Faculty [ INT ]

Please write me a SQL statement that answers the following question: What is the total number of campuses? [/INST]

Output: SELECT count(*) FROM campuses;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: How many candidates are there? [/INST]

Output: SELECT count(*) FROM candidate;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Count the number of candidates. [/INST]

Output: SELECT count(*) FROM candidate;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Which poll resource provided the most number of candidate information? [/INST]

Output: SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Return the poll resource associated with the most candidates. [/INST]

Output: SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: what are the top 3 highest support rates? [/INST]

Output: SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Return the top 3 greatest support rates. [/INST]

Output: SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Find the id of the candidate who got the lowest oppose rate. [/INST]

Output: SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What is the id of the candidate with the lowest oppose rate? [/INST]

Output: SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate. [/INST]

Output: SELECT Support_rate ,  Consider_rate ,  Oppose_rate FROM candidate ORDER BY unsure_rate;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the support, consider, and oppose rates of each candidate, ordered ascending by their unsure rate? [/INST]

Output: SELECT Support_rate ,  Consider_rate ,  Oppose_rate FROM candidate ORDER BY unsure_rate;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: which poll source does the highest oppose rate come from? [/INST]

Output: SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Return the poll source corresponding to the candidate who has the oppose rate. [/INST]

Output: SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: List all people names in the order of their date of birth from old to young. [/INST]

Output: SELECT name FROM people ORDER BY date_of_birth;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the names of all people, ordered by their date of birth? [/INST]

Output: SELECT name FROM people ORDER BY date_of_birth;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Find the average height and weight for all males (sex is M). [/INST]

Output: SELECT avg(height) ,  avg(weight) FROM people WHERE sex  =  'M';


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the average height and weight across males (sex is M)? [/INST]

Output: SELECT avg(height) ,  avg(weight) FROM people WHERE sex  =  'M';


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: find the names of people who are taller than 200 or lower than 190. [/INST]

Output: SELECT name FROM people WHERE height  >  200 OR height  <  190;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the names of people who have a height greater than 200 or less than 190? [/INST]

Output: SELECT name FROM people WHERE height  >  200 OR height  <  190;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Find the average and minimum weight for each gender. [/INST]

Output: SELECT avg(weight) ,  min(weight) ,  sex FROM people GROUP BY sex;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the average and minimum weights for people of each sex? [/INST]

Output: SELECT avg(weight) ,  min(weight) ,  sex FROM people GROUP BY sex;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Find the name and gender of the candidate who got the highest support rate. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What is the name and sex of the candidate with the highest support rate? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the candidates whose oppose percentage is the lowest for each sex. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: For each sex, what is the name and sex of the candidate with the oppose rate for their sex? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: which gender got the highest average uncertain ratio. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What is the sex of the candidate who had the highest unsure rate? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: what are the names of people who did not participate in the candidate election. [/INST]

Output: SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate);


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Give the names of people who did not participate in the candidate election. [/INST]

Output: SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate);


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Find the names of the candidates whose support percentage is lower than their oppose rate. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the names of candidates who have a lower support rate than oppose rate? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: how many people are there whose weight is higher than 85 for each gender? [/INST]

Output: SELECT count(*) ,  sex FROM people WHERE weight  >  85 GROUP BY sex;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Count the number of people of each sex who have a weight higher than 85. [/INST]

Output: SELECT count(*) ,  sex FROM people WHERE weight  >  85 GROUP BY sex;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: find the highest support percentage, lowest consider rate and oppose rate of all candidates. [/INST]

Output: SELECT max(support_rate) ,  min(consider_rate) ,  min(oppose_rate) FROM candidate;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: Return the maximum support rate, minimum consider rate, and minimum oppose rate across all candidates? [/INST]

Output: SELECT max(support_rate) ,  min(consider_rate) ,  min(oppose_rate) FROM candidate;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: list all female (sex is F) candidate names in the alphabetical order. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the names of all female candidates in alphabetical order (sex is F)? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: find the name of people whose height is lower than the average. [/INST]

Output: SELECT name FROM people WHERE height  <  (SELECT avg(height) FROM people);


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What are the names of people who are shorter than average? [/INST]

Output: SELECT name FROM people WHERE height  <  (SELECT avg(height) FROM people);


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: List all info about all people. [/INST]

Output: SELECT * FROM people;


Input:
[INST] Here is a database schema:
candidate :
Candidate_ID [ INT ] primary_key
People_ID [ INT ] candidate.People_ID = people.People_ID
Poll_Source [ TEXT ]
Date [ TEXT ]
Support_rate [ INT ]
Consider_rate [ INT ]
Oppose_rate [ INT ]
Unsure_rate [ INT ]

people :
People_ID [ INT ] primary_key
Sex [ TEXT ]
Name [ TEXT ]
Date_of_Birth [ TEXT ]
Height [ INT ]
Weight [ INT ]

Please write me a SQL statement that answers the following question: What is all the information about all people? [/INST]

Output: SELECT * FROM people;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the titles of all movies directed by steven spielberg. [/INST]

Output: SELECT title FROM Movie WHERE director = 'Steven Spielberg';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all movies directed by Steven Spielberg? [/INST]

Output: SELECT title FROM Movie WHERE director = 'Steven Spielberg';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the movie produced after 2000 and directed by James Cameron? [/INST]

Output: SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR  >  2000;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles of all movies that James Cameron directed after 2000? [/INST]

Output: SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR  >  2000;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: How many movies were made before 2000? [/INST]

Output: SELECT count(*) FROM Movie WHERE YEAR  <  2000;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: How many movies were made before 2000? [/INST]

Output: SELECT count(*) FROM Movie WHERE YEAR  <  2000;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Who is the director of movie Avatar? [/INST]

Output: SELECT director FROM Movie WHERE title  = 'Avatar';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Who directed Avatar? [/INST]

Output: SELECT director FROM Movie WHERE title  = 'Avatar';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: How many reviewers listed? [/INST]

Output: SELECT count(*) FROM Reviewer;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: How many reviewers are there? [/INST]

Output: SELECT count(*) FROM Reviewer;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id of the reviewer whose name has substring “Mike”? [/INST]

Output: SELECT rID FROM Reviewer WHERE name LIKE "%Mike%";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id of the reviewer whose name includes the word "Mike"? [/INST]

Output: SELECT rID FROM Reviewer WHERE name LIKE "%Mike%";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the reviewer id of Daniel Lewis? [/INST]

Output: SELECT rID FROM Reviewer WHERE name  =  "Daniel Lewis";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id of the reviewer named Daniel Lewis? [/INST]

Output: SELECT rID FROM Reviewer WHERE name  =  "Daniel Lewis";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total number of ratings that has more than 3 stars? [/INST]

Output: SELECT count(*) FROM Rating WHERE stars  >  3;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: How many movie ratings have more than 3 stars? [/INST]

Output: SELECT count(*) FROM Rating WHERE stars  >  3;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the lowest and highest rating star? [/INST]

Output: SELECT max(stars) ,  min(stars) FROM Rating;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the maximum and mininum number of stars a rating can receive? [/INST]

Output: SELECT max(stars) ,  min(stars) FROM Rating;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year. [/INST]

Output: SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  >=  4 ORDER BY T1.year;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently? [/INST]

Output: SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  >=  4 ORDER BY T1.year;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of directors who directed movies with 5 star rating? Also return the title of these movies. [/INST]

Output: SELECT T1.director ,  T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  =  5;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the directors who created a movie with a 5 star rating, and what was the name of those movies? [/INST]

Output: SELECT T1.director ,  T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  =  5;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average rating star for each reviewer? [/INST]

Output: SELECT T2.name ,  avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T2.name;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average number of stars that each reviewer awards for a movie? [/INST]

Output: SELECT T2.name ,  avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T2.name;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the titles of all movies that have no ratings. [/INST]

Output: SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles of all movies that have not been rated? [/INST]

Output: SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of all reviewers who have ratings with a NULL value for the date. [/INST]

Output: SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID  =  T2.rID WHERE ratingDate  =  "null";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different names of all reviewers whose ratings do not have a date field? [/INST]

Output: SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID  =  T2.rID WHERE ratingDate  =  "null";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average rating stars and title for the oldest movie? [/INST]

Output: 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);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For the oldest movie listed, what is its average rating and title? [/INST]

Output: 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);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the most recent movie? [/INST]

Output: SELECT title FROM Movie WHERE YEAR  =  (SELECT max(YEAR) FROM Movie);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the title of the newest movie? [/INST]

Output: SELECT title FROM Movie WHERE YEAR  =  (SELECT max(YEAR) FROM Movie);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the maximum stars and year for the most recent movie? [/INST]

Output: 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);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is highest rating for the most recent movie and when was it released? [/INST]

Output: 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);


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the names of movies whose created year is after all movies directed by Steven Spielberg? [/INST]

Output: SELECT title FROM Movie WHERE YEAR  >  (SELECT max(YEAR) FROM Movie WHERE director  =  "Steven Spielberg");


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all movies that were created after the most recent Steven Spielberg film? [/INST]

Output: SELECT title FROM Movie WHERE YEAR  >  (SELECT max(YEAR) FROM Movie WHERE director  =  "Steven Spielberg");


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following 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? [/INST]

Output: 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");


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles and directors of all movies that have a rating higher than the average James Cameron film rating? [/INST]

Output: 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");


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following 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. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the reviewer name, film title, movie rating, and rating date  for every movie ordered by reviewer name, movie title, then finally rating? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of all reviewers who have contributed three or more ratings. [/INST]

Output: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T1.rID HAVING COUNT(*)  >=  3;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all reviewers that have rated 3 or more movies? [/INST]

Output: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T1.rID HAVING COUNT(*)  >=  3;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of all reviewers who rated Gone with the Wind. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all the different reviewers who rates Gone with the Wind? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of all directors whose movies are rated by Sarah Martinez. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all directors whose movies have been reviewed by Sarah Martinez? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following 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. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different reviewer names, movie titles, and stars for every rating where the reviewer had the same name as the director? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Return all reviewer names and movie names together in a single list. [/INST]

Output: SELECT name FROM Reviewer UNION SELECT title FROM Movie;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all the reviewers and movie names? [/INST]

Output: SELECT name FROM Reviewer UNION SELECT title FROM Movie;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the titles of all movies not reviewed by Chris Jackson. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles of all movies that were not reviewed by Chris Jackson? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following 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. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For all directors who have directed more than one movie, what movies have they directed and what are their names? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For directors who had more than one movie, return the titles and produced years of all movies directed by them. [/INST]

Output: SELECT T1.title ,  T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director  =  T2.director WHERE T1.title != T2.title;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For each director who directed more than one movie, what are the titles and dates of release for all those movies? [/INST]

Output: SELECT T1.title ,  T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director  =  T2.director WHERE T1.title != T2.title;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the directors who made exactly one movie? [/INST]

Output: SELECT director FROM Movie GROUP BY director HAVING count(*)  =  1;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all directors who made one movie? [/INST]

Output: SELECT director FROM Movie GROUP BY director HAVING count(*)  =  1;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the directors who made exactly one movie excluding director NULL? [/INST]

Output: SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*)  =  1;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all directors who have made one movie except for the director named NULL? [/INST]

Output: SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*)  =  1;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: How many movie reviews does each director get? [/INST]

Output: SELECT count(*) ,  T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID GROUP BY T1.director;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For each director, how many reviews have they received? [/INST]

Output: SELECT count(*) ,  T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID GROUP BY T1.director;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the movies with the highest average rating. Return the movie titles and average rating. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the movie titles with the highest average rating and what are those ratings? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the movie titles and average rating of the movies with the lowest average rating? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles and average ratings for all movies that have the lowest average rating? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and years of the movies that has the top 3 highest rating star? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and years released for the movies with the top 3 highest ratings? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following 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. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For each director, what are the titles and ratings for all the movies they reviewed? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the title and star rating of the movie that got the least rating star for each reviewer. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For each reviewer id, what is the title and rating for the movie with the smallest rating? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the title and score of the movie with the lowest rating among all movies directed by each director. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For each director, what is the title and score of their most poorly rated movie? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the movie that is rated by most of times? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the movie that has been reviewed the most? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles of all movies that have rating star is between 3 and 5? [/INST]

Output: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T1.stars BETWEEN 3 AND 5;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles of all movies that have between 3 and 5 stars? [/INST]

Output: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T1.stars BETWEEN 3 AND 5;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of reviewers who had given higher than 3 star ratings. [/INST]

Output: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  >  3;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the reviewers who have rated a movie more than 3 stars before? [/INST]

Output: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  >  3;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the average rating star for each movie that are not reviewed by Brittany Harris. [/INST]

Output: SELECT mID ,  avg(stars) FROM Rating WHERE mID NOT 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average rating for each movie that has never been reviewed by Brittany Harris? [/INST]

Output: SELECT mID ,  avg(stars) FROM Rating WHERE mID NOT 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the movies that are not reviewed by Brittany Harris. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of all moviest hat have not been reviewed by Britanny Harris? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the average rating star for each movie that received at least 2 ratings. [/INST]

Output: SELECT mID ,  avg(stars) FROM Rating GROUP BY mID HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: For each movie that received more than 3 reviews, what is the average rating? [/INST]

Output: SELECT mID ,  avg(stars) FROM Rating GROUP BY mID HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: find the ids of reviewers who did not give 4 star. [/INST]

Output: SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars  =  4;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of all reviewers who did not give 4 stars? [/INST]

Output: SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars  =  4;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: Find the ids of reviewers who didn't only give 4 star. [/INST]

Output: SELECT rID FROM Rating WHERE stars != 4;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of all reviewers who have not given 4 stars at least once? [/INST]

Output: SELECT rID FROM Rating WHERE stars != 4;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are names of the movies that are either made after 2000 or reviewed by Brittany Harris? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all movies that were made after 2000 or reviewed by Brittany Harris? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are names of the movies that are either made before 1980 or directed by James Cameron? [/INST]

Output: SELECT title FROM Movie WHERE director  =  "James Cameron" OR YEAR   <  1980;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all movies made before 1980 or had James Cameron as the director? [/INST]

Output: SELECT title FROM Movie WHERE director  =  "James Cameron" OR YEAR   <  1980;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of reviewers who had rated 3 star and 4 star? [/INST]

Output: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  =  3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  =  4;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all reviewers that have given 3 or 4 stars for reviews? [/INST]

Output: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  =  3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  =  4;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of movies that get 3 star and 4 star? [/INST]

Output: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T1.stars  =  3 INTERSECT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T1.stars  =  4;


Input:
[INST] Here is a database schema:
Movie :
mID [ INT ] primary_key
title [ TEXT ]
year [ INT ]
director [ TEXT ]

Reviewer :
rID [ INT ] primary_key
name [ TEXT ]

Rating :
rID [ INT ] Rating.rID = Reviewer.rID
mID [ INT ] Rating.mID = Movie.mID
stars [ INT ]
ratingDate [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all movies that received 3 or 4 stars? [/INST]

Output: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T1.stars  =  3 INTERSECT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T1.stars  =  4;


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: How many counties are there? [/INST]

Output: SELECT count(*) FROM county_public_safety;


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: Count the number of countries. [/INST]

Output: SELECT count(*) FROM county_public_safety;


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: List the names of counties in descending order of population. [/INST]

Output: SELECT Name FROM county_public_safety ORDER BY Population DESC;


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: What are the names of the counties of public safety, ordered by population descending? [/INST]

Output: SELECT Name FROM county_public_safety ORDER BY Population DESC;


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: List the distinct police forces of counties whose location is not on east side. [/INST]

Output: SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION != "East";


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: What are the different police forces of counties that are not located in the East? [/INST]

Output: SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION != "East";


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: What are the minimum and maximum crime rate of counties? [/INST]

Output: SELECT min(Crime_rate) ,  max(Crime_rate) FROM county_public_safety;


Input:
[INST] Here is a database schema:
county_public_safety :
County_ID [ INT ] primary_key
Name [ TEXT ]
Population [ INT ]
Police_officers [ INT ]
Residents_per_officer [ INT ]
Case_burden [ INT ]
Crime_rate [ INT ]
Police_force [ TEXT ]
Location [ TEXT ]

city :
City_ID [ INT ] primary_key
County_ID [ INT ] city.County_ID = county_public_safety.County_ID
Name [ TEXT ]
White [ INT ]
Black [ INT ]
Amerindian [ INT ]
Asian [ INT ]
Multiracial [ INT ]
Hispanic [ INT ]

Please write me a SQL statement that answers the following question: Return the minimum and maximum crime rates across all counties. [/INST]

Output: SELECT min(Crime_rate) ,  max(Crime_rate) FROM county_public_safety;