instruction_seed stringlengths 305 1.28k | response_seed stringclasses 1
value | response stringlengths 7 2.05k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|---|
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE perpetrator (YEAR INTEGER)
Question: In which year did the most recent crime happen?
Here is the SQLite query to answer to the question: In which year did the most recen... | Here is the SQLite query to answer the question of the most recent crime year:
```
SELECT MAX(YEAR) FROM perpetrator;
``` | 1,400 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE perpetrator (YEAR INTEGER)\n\n Question: In which year did the most recent crime happen?\n\nHere is the SQLite query to answer to ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, county VARCHAR)
Question: Report the name of all campuses in Los Angeles county.
Here is the SQLite query to answer to the question: Report the... | Here is the SQLite query to report the name of all campuses in Los Angeles county:
```
SELECT campus FROM campuses WHERE county = "Los Angeles";
``` | 1,401 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, county VARCHAR)\n\n Question: Report the name of all campuses in Los Angeles county.\n\nHere is the SQLi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR)
Question: What are the names of all campuses located at Chico?
Here is the SQLite query to answer to the question: What are t... | Your SQLite query is correct. Here it is wrapped in the appropriate code block:
```
SELECT campus FROM campuses WHERE LOCATION = "Chico";
``` | 1,402 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR)\n\n Question: What are the names of all campuses located at Chico?\n\nHere is the SQLi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR)
Question: Find all the campuses opened in 1958.
Here is the SQLite query to answer to the question: Find all the campuses opened ... | Here is the SQLite query to find all the campuses opened in 1958:
```sql
SELECT campus FROM campuses WHERE YEAR = '1958'
``` | 1,403 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR)\n\n Question: Find all the campuses opened in 1958.\n\nHere is the SQLite query to answer ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, YEAR INTEGER)
Question: Find the name of the campuses opened before 1800.
Here is the SQLite query to answer to the question: Find the name of ... | Your SQLite query to find the names of the campuses opened before 1800 is correct. Here it is wrapped in a code block:
```
SELECT campus FROM campuses WHERE YEAR < 1800;
``` | 1,404 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, YEAR INTEGER)\n\n Question: Find the name of the campuses opened before 1800.\n\nHere is the SQLite quer... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR)
Question: Which campus was opened between 1935 and 1939?
Here is the SQLite query to answer to the question: Which campus was ope... | Your SQLite query to identify the campuses opened between 1935 and 1939 is almost correct, but it’s important to ensure that the `YEAR` column is appropriately treated as an integer for comparison, as it may be stored as a string. Here’s a refined version of your query:
```
SELECT campus FROM campuses WHERE CAST(YEAR ... | 1,405 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, YEAR VARCHAR)\n\n Question: Which campus was opened between 1935 and 1939?\n\nHere is the SQLite query t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR, county VARCHAR)
Question: Find the name of the campuses that is in Northridge, Los Angeles or in San Francisco, San Francisco.... | Here is the SQLite query to answer the question:
```
SELECT campus FROM campuses WHERE (LOCATION = "Northridge" AND county = "Los Angeles")
UNION
SELECT campus FROM campuses WHERE (LOCATION = "San Francisco" AND county = "San Francisco");
``` | 1,406 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, LOCATION VARCHAR, county VARCHAR)\n\n Question: Find the name of the campuses that is in Northridge, Los... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR)
Question: What is the campus fee of "San Jose State University" in year 1996?
Here is the SQLite query to ans... | It seems like there may be a misunderstanding or a mistake in the provided query, given the schema you've outlined. The schema indicates that the `campusfee` field is not present in the `campuses` or `csu_fees` tables. Additionally, there isn't a defined relationship between campuses and campus fees based on the schema... | 1,407 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR)\n\n Question: What is the campus fee of \"San Jose State University\" ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR)
Question: What is the campus fee of "San Francisco State University" in year 1996?
Here is the SQLite query t... | Your initial SQL query has some inaccuracies regarding the table and column names based on the provided schema. It seems like the `campusfee` column does not exist in either of the tables, and there is also no available indication of a relationship between campuses and fees from the schema.
Assuming there is an implie... | 1,408 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE csu_fees (year VARCHAR); CREATE TABLE campuses (id VARCHAR)\n\n Question: What is the campus fee of \"San Francisco State Universi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE csu_fees (campusfee INTEGER)
Question: Find the count of universities whose campus fee is greater than the average campus fee.
Here is the SQLite query to answer to the ... | Here is the SQLite query that answers the question regarding the count of universities whose campus fee is greater than the average campus fee:
```
SELECT COUNT(*) FROM csu_fees WHERE campusfee > (SELECT AVG(campusfee) FROM csu_fees);
``` | 1,409 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE csu_fees (campusfee INTEGER)\n\n Question: Find the count of universities whose campus fee is greater than the average campus fee.... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, county VARCHAR, YEAR VARCHAR)
Question: Which university is in Los Angeles county and opened after 1950?
Here is the SQLite query to answer to ... | The SQLite query you provided is almost correct, but you need to ensure that the `YEAR` column is treated as an integer for proper comparison. If the `YEAR` is stored as a string, you might want to cast it to an integer. Here's the revised query wrapped in code formatting:
```
SELECT campus FROM campuses WHERE county ... | 1,410 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, county VARCHAR, YEAR VARCHAR)\n\n Question: Which university is in Los Angeles county and opened after 1... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE degrees (YEAR VARCHAR, degrees INTEGER)
Question: Which year has the most degrees conferred?
Here is the SQLite query to answer to the question: Which year has the most ... | Your SQL query is correct in finding the year with the most degrees conferred. Here it is wrapped in the requested code block:
```
SELECT YEAR FROM degrees GROUP BY YEAR ORDER BY SUM(degrees) DESC LIMIT 1
``` | 1,411 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE degrees (YEAR VARCHAR, degrees INTEGER)\n\n Question: Which year has the most degrees conferred?\n\nHere is the SQLite query to an... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE degrees (campus VARCHAR, degrees INTEGER)
Question: Which campus has the most degrees conferred in all times?
Here is the SQLite query to answer to the question: Which c... | Your SQLite query is correctly structured to find the campus with the most degrees conferred. Here it is wrapped in the required code block:
```
SELECT campus FROM degrees GROUP BY campus ORDER BY SUM(degrees) DESC LIMIT 1
```
This query groups the records by campus, sums the degrees for each campus, orders the resu... | 1,412 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE degrees (campus VARCHAR, degrees INTEGER)\n\n Question: Which campus has the most degrees conferred in all times?\n\nHere is the S... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE faculty (campus VARCHAR, year VARCHAR, faculty VARCHAR); CREATE TABLE campuses (campus VARCHAR, id VARCHAR)
Question: Which campus has the most faculties in year 2003?
H... | Your SQL query has the right idea but needs some adjustments. Specifically, to find the campus with the most faculties in the year 2003, you need to count the faculties per campus and then order by that count. Here is the corrected query:
```sql
SELECT T1.campus
FROM campuses AS T1
JOIN faculty AS T2 ON T1.campus = ... | 1,413 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE faculty (campus VARCHAR, year VARCHAR, faculty VARCHAR); CREATE TABLE campuses (campus VARCHAR, id VARCHAR)\n\n Question: Which ca... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR)
Question: Find the average fee on a CSU campus in 1996
Here is the SQLite query to answer to the question: Find the average fe... | Here is the correct SQLite query to find the average fee on a CSU campus in 1996:
```
SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = '1996'
``` | 1,414 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR)\n\n Question: Find the average fee on a CSU campus in 1996\n\nHere is the SQLite query ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR)
Question: What is the average fee on a CSU campus in 2005?
Here is the SQLite query to answer to the question: What is the ave... | Here is the SQLite query to find the average fee on a CSU campus in 2005:
```
SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = '2005'
``` | 1,415 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE csu_fees (campusfee INTEGER, YEAR VARCHAR)\n\n Question: What is the average fee on a CSU campus in 2005?\n\nHere is the SQLite qu... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, id VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR)
Question: report the total number of degrees granted between 1... | Your query needs a slight modification as it references a column `id` that isn't present in the context of your schema. It seems that the `degrees` table directly references the `campus` column, which should be the linking point. The `campus` column in the `degrees` table will correspond to the `campus` column in the `... | 1,416 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, id VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR)\n\n Question: report t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR)
Question: For each Orange county campus, repor... | Your SQLite query to report the number of degrees granted after 2000 for each Orange county campus is correctly structured. Here it is wrapped in code format:
```
SELECT T1.campus, SUM(T2.degrees)
FROM campuses AS T1
JOIN degrees AS T2 ON T1.id = T2.campus
WHERE T1.county = "Orange" AND T2.year >= 2000
GROUP BY T1... | 1,417 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE degrees (degrees INTEGER, campus VARCHAR, year VARCHAR)\n\n Qu... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)
Question: Find the names of the campus which has more faculties... | Here is the corrected SQLite query to find the names of the campuses which have more faculties in 2002 than every campus in Orange County:
```sql
SELECT T1.campus
FROM campuses AS T1
JOIN faculty AS T2 ON T1.id = T2.campus
WHERE T2.year = '2002'
GROUP BY T1.campus
HAVING COUNT(*) > (
SELECT MAX(faculty_count)... | 1,418 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (campus VARCHAR, id VARCHAR, county VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)\n\n Question: Find the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE enrollments (campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR)
Question: What campus had more than 400 total enrollment but more than 200 full time enroll... | The provided query has some syntax and logical issues. To correctly retrieve the campuses with the specified enrollment conditions for the year 1956, we need to include conditions for total enrollment and full-time enrollment. However, the columns `totalenrollment_ay` and `FTE_AY` do not exist in the schema provided. A... | 1,419 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE enrollments (campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR)\n\n Question: What campus had more than 400 total e... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (county VARCHAR)
Question: How many campuses are there in Los Angeles county?
Here is the SQLite query to answer to the question: How many campuses are there in... | Here is the SQLite query to answer the question about the number of campuses in Los Angeles county:
```
SELECT COUNT(*) FROM campuses WHERE county = "Los Angeles";
``` | 1,420 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (county VARCHAR)\n\n Question: How many campuses are there in Los Angeles county?\n\nHere is the SQLite query to answer t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR)
Question: How many degrees were conferred in "San Jose State University" in 2000?
Here is the SQLite query to an... | Based on the provided schema, it seems that the tables `degrees` and `campuses` do not include information about the degrees conferred or the year. To accurately write a query, we would need additional details about how degrees and their conferral relate to campuses, especially the data structure containing years and c... | 1,421 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR)\n\n Question: How many degrees were conferred in \"San Jose State Univers... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR)
Question: What are the degrees conferred in "San Francisco State University" in 2001.
Here is the SQLite query t... | The provided SQLite query needs some adjustments to fit the schema and the question correctly. However, I see that the schema you've shared only includes tables for `degrees` and `campuses` without any additional columns that indicate what degrees are associated with specific campuses or the years in which they were co... | 1,422 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE degrees (Id VARCHAR); CREATE TABLE campuses (Id VARCHAR)\n\n Question: What are the degrees conferred in \"San Francisco State Uni... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE faculty (faculty INTEGER, YEAR VARCHAR)
Question: How many faculty is there in total in the year of 2002?
Here is the SQLite query to answer to the question: How many fa... | Here is the SQLite query to answer the question about the total number of faculty in the year 2002:
```sql
SELECT SUM(faculty) FROM faculty WHERE YEAR = '2002';
``` | 1,423 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE faculty (faculty INTEGER, YEAR VARCHAR)\n\n Question: How many faculty is there in total in the year of 2002?\n\nHere is the SQLit... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)
Question: What is the number of faculty lines in campus "Long Beach State Unive... | It seems there is a slight misunderstanding in the provided query regarding the selection of the number of faculty lines. To count the number of faculty lines for the specified campus and year, you should use the `COUNT` function.
Here's the corrected SQLite query:
```sql
SELECT COUNT(*) AS number_of_faculty_lines
F... | 1,424 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)\n\n Question: What is the number of fac... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)
Question: How many faculty lines are there in "San Francisco State University" ... | The query you provided has some inaccuracies. You should be selecting the count of faculty lines instead of attempting to select a 'faculty' column that is not defined in the schema. Below is the corrected SQLite query that counts the number of faculty lines for "San Francisco State University" in the year 2004:
```sq... | 1,425 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE faculty (campus VARCHAR, year VARCHAR)\n\n Question: How many faculty lines ar... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (campus VARCHAR, faculty VARCHAR)
Question: List the campus that have between 600 and 1000 faculty lines in year 2004.
Here i... | It looks like there is a misunderstanding in the provided schema and query because the current schema does not include a year or the necessary structure to count faculty lines. To correctly answer your question, we first need to adjust the schema to properly count the number of faculty per campus for a specific year.
... | 1,426 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (campus VARCHAR, faculty VARCHAR)\n\n Question: List the campus that have between 600 ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR)
Question: How many faculty lines are there in the university that conferr... | The provided SQL query incorrectly communicates the question and contains several mistakes. To answer the question of "How many faculty lines are there in the university that conferred the most number of degrees in year 2002?", we need to properly join the tables based on the correct relationships and also filter and c... | 1,427 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR)\n\n Question: How many faculty li... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR)
Question: How many faculty lines are there in the university that conferr... | The provided query has some issues that need to be addressed, especially in terms of how the tables are related and the logic used to find the university with the least number of degrees.
Assuming that we have a `degrees` table that contains details about degrees conferred and is related to the campuses, the followin... | 1,428 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (id VARCHAR); CREATE TABLE faculty (faculty VARCHAR); CREATE TABLE degrees (Id VARCHAR)\n\n Question: How many faculty li... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE discipline_enrollments (undergraduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR)
Question: How many undergraduates are the... | The provided SQLite query looks mostly correct, but it seems there may be a small incorrect assumption about how the `campus` has been defined in the `campuses` table, specifically regarding ID matching. Assuming that the `discipline_enrollments` table represents campus by the ID from the `campuses` table, it is correc... | 1,429 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE discipline_enrollments (undergraduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR)\n\n ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE discipline_enrollments (graduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR)
Question: What is the number of graduates in "... | Here's the SQLite query to answer the question regarding the number of graduates in "San Francisco State University" in the year 2004:
```sql
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';
``... | 1,430 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE discipline_enrollments (graduate INTEGER, campus VARCHAR, year VARCHAR); CREATE TABLE campuses (id VARCHAR, campus VARCHAR)\n\n Qu... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR)
Question: What is the campus fee of "San Francisco State Un... | Here is the SQLite query to answer the question about the campus fee of "San Francisco State University" in the year 2000:
```sql
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"
``` | 1,431 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR)\n\n Question: What ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR)
Question: Find the campus fee of "San Jose State University... | Here is the SQLite query to find the campus fee of "San Jose State University" in the year 2000:
```
SELECT t1.campusfee
FROM csu_fees AS t1
JOIN campuses AS t2 ON t1.campus = t2.id
WHERE t2.campus = "San Jose State University" AND t1.year = "2000";
``` | 1,432 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (id VARCHAR, campus VARCHAR); CREATE TABLE csu_fees (campusfee VARCHAR, campus VARCHAR, year VARCHAR)\n\n Question: Find ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE campuses (Id VARCHAR)
Question: How many CSU campuses are there?
Here is the SQLite query to answer to the question: How many CSU campuses are there?:
```
SELECT COUNT(*... | Your provided SQLite query is correct for counting the number of entries in the `campuses` table. Here it is wrapped in the requested format:
```
SELECT COUNT(*) FROM campuses;
```
This query will return the total number of CSU campuses stored in the `campuses` table. | 1,433 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE campuses (Id VARCHAR)\n\n Question: How many CSU campuses are there?\n\nHere is the SQLite query to answer to the question: How ma... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (Id VARCHAR)
Question: How many candidates are there?
Here is the SQLite query to answer to the question: How many candidates are there?:
```
SELECT COUNT(*) F... | Here is the SQLite query to answer the question: How many candidates are there?:
```
SELECT COUNT(*) FROM candidate;
``` | 1,434 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (Id VARCHAR)\n\n Question: How many candidates are there?\n\nHere is the SQLite query to answer to the question: How man... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (poll_source VARCHAR)
Question: Which poll resource provided the most number of candidate information?
Here is the SQLite query to answer to the question: Whic... | Here is the SQLite query to answer the question "Which poll resource provided the most number of candidate information?":
```
SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY COUNT(*) DESC LIMIT 1
``` | 1,435 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (poll_source VARCHAR)\n\n Question: Which poll resource provided the most number of candidate information?\n\nHere is th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (support_rate VARCHAR)
Question: what are the top 3 highest support rates?
Here is the SQLite query to answer to the question: what are the top 3 highest suppo... | Your SQLite query looks almost correct, but since `support_rate` is defined as `VARCHAR`, it will sort the values lexicographically instead of numerically. If the values are numeric and you want to treat them as numbers, you should cast them to a numeric type. Here’s the improved version:
```sql
SELECT support_rate
F... | 1,436 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (support_rate VARCHAR)\n\n Question: what are the top 3 highest support rates?\n\nHere is the SQLite query to answer to ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (Candidate_ID VARCHAR, oppose_rate VARCHAR)
Question: Find the id of the candidate who got the lowest oppose rate.
Here is the SQLite query to answer to the qu... | The provided query to find the candidate ID with the lowest oppose rate could be correct if the `oppose_rate` is stored as a numerical value. However, since it's defined as `VARCHAR`, the sorting might not work as expected because it will sort lexicographically instead of numerically.
To ensure you're correctly identi... | 1,437 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (Candidate_ID VARCHAR, oppose_rate VARCHAR)\n\n Question: Find the id of the candidate who got the lowest oppose rate.\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (Support_rate VARCHAR, Consider_rate VARCHAR, Oppose_rate VARCHAR, unsure_rate VARCHAR)
Question: Please list support, consider, and oppose rates for each candi... | Here is the corrected SQLite query to list the support, consider, and oppose rates for each candidate in ascending order by unsure rate:
```
SELECT Support_rate, Consider_rate, Oppose_rate FROM candidate ORDER BY unsure_rate ASC;
``` | 1,438 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (Support_rate VARCHAR, Consider_rate VARCHAR, Oppose_rate VARCHAR, unsure_rate VARCHAR)\n\n Question: Please list suppor... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (poll_source VARCHAR, oppose_rate VARCHAR)
Question: which poll source does the highest oppose rate come from?
Here is the SQLite query to answer to the questi... | Your provided SQLite query is almost correct, but it's important to consider that `oppose_rate` is defined as a VARCHAR type. If `oppose_rate` represents numerical values stored as strings, you will need to convert them to a numeric type for proper comparison.
Here's the corrected query that ensures `oppose_rate` is t... | 1,439 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (poll_source VARCHAR, oppose_rate VARCHAR)\n\n Question: which poll source does the highest oppose rate come from?\n\nHe... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE people (name VARCHAR, date_of_birth VARCHAR)
Question: List all people names in the order of their date of birth from old to young.
Here is the SQLite query to answer to... | Here is the SQLite query to list all people names in the order of their date of birth from old to young:
```
SELECT name FROM people ORDER BY date_of_birth
``` | 1,440 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE people (name VARCHAR, date_of_birth VARCHAR)\n\n Question: List all people names in the order of their date of birth from old to y... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE people (height INTEGER, weight INTEGER, sex VARCHAR)
Question: Find the average height and weight for all males (sex is M).
Here is the SQLite query to answer to the que... | Here is the SQLite query to find the average height and weight for all males (where sex is 'M'):
```
SELECT AVG(height) AS average_height, AVG(weight) AS average_weight FROM people WHERE sex = 'M';
``` | 1,441 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE people (height INTEGER, weight INTEGER, sex VARCHAR)\n\n Question: Find the average height and weight for all males (sex is M).\n\... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE people (name VARCHAR, height VARCHAR)
Question: find the names of people who are taller than 200 or lower than 190.
Here is the SQLite query to answer to the question: f... | It looks like the height column is stored as a string (VARCHAR) in the database schema. To correctly compare height values numerically, you should cast the height to a numeric type in the query. Here's the corrected SQL query:
```
SELECT name FROM people WHERE CAST(height AS INTEGER) > 200 OR CAST(height AS INTEGER) <... | 1,442 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE people (name VARCHAR, height VARCHAR)\n\n Question: find the names of people who are taller than 200 or lower than 190.\n\nHere is... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE people (sex VARCHAR, weight INTEGER)
Question: Find the average and minimum weight for each gender.
Here is the SQLite query to answer to the question: Find the average ... | Here is the SQLite query to find the average and minimum weight for each gender, formatted as you requested:
```sql
SELECT AVG(weight) AS average_weight, MIN(weight) AS minimum_weight, sex
FROM people
GROUP BY sex;
``` | 1,443 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE people (sex VARCHAR, weight INTEGER)\n\n Question: Find the average and minimum weight for each gender.\n\nHere is the SQLite quer... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (people_id VARCHAR, support_rate VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR)
Question: Find the name and gender of the candidat... | Here is the SQLite query to find the name and gender of the candidate who got the highest support rate:
```sql
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;
``` | 1,444 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (people_id VARCHAR, support_rate VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR)\n\n Questi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR)
Question: Find the name of the candidates whose oppose percentage is the... | The query you've provided does not include a calculation for the "oppose percentage," which is essential for finding candidates with the lowest oppose percentage. Assuming that you have a way to calculate the oppose percentage (for example, through additional tables or fields that provide oppose vote counts), let's mod... | 1,445 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, sex VARCHAR, people_id VARCHAR)\n\n Question: Find the name of t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (people_id VARCHAR, unsure_rate INTEGER); CREATE TABLE people (sex VARCHAR, people_id VARCHAR)
Question: which gender got the highest average uncertain ratio.
... | Your query is structured correctly to answer the question of which gender has the highest average uncertain ratio. Here is the code wrapped correctly:
```
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;
```
This query... | 1,446 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (people_id VARCHAR, unsure_rate INTEGER); CREATE TABLE people (sex VARCHAR, people_id VARCHAR)\n\n Question: which gende... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (name VARCHAR, people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR)
Question: what are the names of people who did not participate in the c... | Your SQLite query is correctly structured to identify the names of people who did not participate in the candidate election. Here it is wrapped properly:
```
SELECT name FROM people WHERE NOT people_id IN (SELECT people_id FROM candidate);
```
This query selects the names from the `people` table where the `people_id... | 1,447 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (name VARCHAR, people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR)\n\n Question: what are the name... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (people_id VARCHAR, support_rate INTEGER, oppose_rate VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR)
Question: Find the names of the candidates... | Here is the SQLite query to answer the question about finding the names of the candidates whose support percentage is lower than their oppose rate, formatted as requested:
```
SELECT t1.name
FROM people AS t1
JOIN candidate AS t2 ON t1.people_id = t2.people_id
WHERE t2.support_rate < CAST(t2.oppose_rate AS INTEGER)... | 1,448 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (people_id VARCHAR, support_rate INTEGER, oppose_rate VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR)\n\n ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE people (sex VARCHAR, weight INTEGER)
Question: how many people are there whose weight is higher than 85 for each gender?
Here is the SQLite query to answer to the questi... | Your SQLite query is correct and adequately answers the question. The structure of the query groups the results by gender and counts the number of people who have a weight greater than 85.
Here it is wrapped in code formatting:
```
SELECT COUNT(*), sex FROM people WHERE weight > 85 GROUP BY sex
```
This will retur... | 1,449 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE people (sex VARCHAR, weight INTEGER)\n\n Question: how many people are there whose weight is higher than 85 for each gender?\n\nHe... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (support_rate INTEGER, consider_rate INTEGER, oppose_rate INTEGER)
Question: find the highest support percentage, lowest consider rate and oppose rate of all ca... | Your SQLite query looks correct for the given question. It retrieves the maximum support rate, the minimum consider rate, and the minimum oppose rate from the `candidate` table. Here it is wrapped as requested:
```
SELECT MAX(support_rate), MIN(consider_rate), MIN(oppose_rate) FROM candidate
``` | 1,450 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (support_rate INTEGER, consider_rate INTEGER, oppose_rate INTEGER)\n\n Question: find the highest support percentage, lo... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR, sex VARCHAR)
Question: list all female (sex is F) candidate names in the alphabetical... | Here is the SQLite query to list all female (sex is F) candidate names in alphabetical order:
```
SELECT t1.name
FROM people AS t1
JOIN candidate AS t2 ON t1.people_id = t2.people_id
WHERE t1.sex = 'F'
ORDER BY t1.name;
``` | 1,451 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE candidate (people_id VARCHAR); CREATE TABLE people (name VARCHAR, people_id VARCHAR, sex VARCHAR)\n\n Question: list all female (s... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE people (name VARCHAR, height INTEGER)
Question: find the name of people whose height is lower than the average.
Here is the SQLite query to answer to the question: find ... | Here is the SQLite query to find the names of people whose height is lower than the average:
```
SELECT name FROM people WHERE height < (SELECT AVG(height) FROM people)
``` | 1,452 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE people (name VARCHAR, height INTEGER)\n\n Question: find the name of people whose height is lower than the average.\n\nHere is the... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE people (Id VARCHAR)
Question: List all info about all people.
Here is the SQLite query to answer to the question: List all info about all people.:
```
SELECT * FROM peop... | Here is the SQLite query to list all info about all people:
```
SELECT * FROM people
``` | 1,453 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE people (Id VARCHAR)\n\n Question: List all info about all people.\n\nHere is the SQLite query to answer to the question: List all ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (title VARCHAR, director VARCHAR)
Question: Find the titles of all movies directed by steven spielberg.
Here is the SQLite query to answer to the question: Find th... | Here is the SQLite query to answer the question about finding the titles of all movies directed by Steven Spielberg:
```
SELECT title FROM Movie WHERE director = 'Steven Spielberg'
``` | 1,454 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (title VARCHAR, director VARCHAR)\n\n Question: Find the titles of all movies directed by steven spielberg.\n\nHere is the S... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (title VARCHAR, director VARCHAR, YEAR VARCHAR)
Question: What is the name of the movie produced after 2000 and directed by James Cameron?
Here is the SQLite query... | Here is the SQLite query to answer the question:
```sql
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000;
``` | 1,455 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (title VARCHAR, director VARCHAR, YEAR VARCHAR)\n\n Question: What is the name of the movie produced after 2000 and directed... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (YEAR INTEGER)
Question: How many movies were made before 2000?
Here is the SQLite query to answer to the question: How many movies were made before 2000?:
```
SEL... | Here is the SQLite query to answer the question "How many movies were made before 2000?":
```
SELECT COUNT(*) FROM Movie WHERE YEAR < 2000
``` | 1,456 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (YEAR INTEGER)\n\n Question: How many movies were made before 2000?\n\nHere is the SQLite query to answer to the question: H... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (director VARCHAR, title VARCHAR)
Question: Who is the director of movie Avatar?
Here is the SQLite query to answer to the question: Who is the director of movie A... | Here is the SQLite query to answer the question "Who is the director of movie Avatar?":
```
SELECT director FROM Movie WHERE title = 'Avatar'
``` | 1,457 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (director VARCHAR, title VARCHAR)\n\n Question: Who is the director of movie Avatar?\n\nHere is the SQLite query to answer t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (Id VARCHAR)
Question: How many reviewers listed?
Here is the SQLite query to answer to the question: How many reviewers listed?:
```
SELECT COUNT(*) FROM Revie... | Here is the SQLite query to answer the question "How many reviewers listed?":
```
SELECT COUNT(*) FROM Reviewer;
``` | 1,458 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (Id VARCHAR)\n\n Question: How many reviewers listed?\n\nHere is the SQLite query to answer to the question: How many rev... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR)
Question: What is the id of the reviewer whose name has substring “Mike”?
Here is the SQLite query to answer to the question: What i... | Here is the SQLite query to answer the question about the reviewer whose name has the substring "Mike":
```
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%"
``` | 1,459 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR)\n\n Question: What is the id of the reviewer whose name has substring “Mike”?\n\nHere is the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR)
Question: What is the reviewer id of Daniel Lewis?
Here is the SQLite query to answer to the question: What is the reviewer id of Da... | Here is the SQLite query to answer the question about the reviewer id of Daniel Lewis:
```
SELECT rID FROM Reviewer WHERE name = "Daniel Lewis";
``` | 1,460 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR)\n\n Question: What is the reviewer id of Daniel Lewis?\n\nHere is the SQLite query to answer ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars INTEGER)
Question: What is the total number of ratings that has more than 3 stars?
Here is the SQLite query to answer to the question: What is the total nu... | Your SQLite query to find the total number of ratings that have more than 3 stars is correct. Here it is wrapped in the specified format:
```
SELECT COUNT(*) FROM Rating WHERE stars > 3;
``` | 1,461 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars INTEGER)\n\n Question: What is the total number of ratings that has more than 3 stars?\n\nHere is the SQLite query t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars INTEGER)
Question: What is the lowest and highest rating star?
Here is the SQLite query to answer to the question: What is the lowest and highest rating st... | Your SQLite query is correctly structured to retrieve the lowest and highest rating stars from the `Rating` table. Here it is wrapped as requested:
```
SELECT MAX(stars), MIN(stars) FROM Rating;
``` | 1,462 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars INTEGER)\n\n Question: What is the lowest and highest rating star?\n\nHere is the SQLite query to answer to the ques... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR)
Question: Find all years that have a movie that received a rating of 4 or 5, and sort ... | Your SQL query is almost correct, but there are a couple of minor adjustments needed for syntax and clarity. Here’s the refined query with correct formatting:
```sql
SELECT DISTINCT T1.year
FROM Movie AS T1
JOIN Rating AS T2 ON T1.mID = T2.mID
WHERE T2.stars IN ('4', '5')
ORDER BY T1.year ASC;
```
In this query, ... | 1,463 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR)\n\n Question: Find all years that have a movie... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (director VARCHAR, title VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR)
Question: What are the names of directors who directed movies with ... | Here is the SQLite query to find the names of directors who directed movies with a 5-star rating, along with the titles of those movies:
```sql
SELECT T1.director, T1.title
FROM Movie AS T1
JOIN Rating AS T2 ON T1.mID = T2.mID
WHERE T2.stars = '5';
``` | 1,464 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (director VARCHAR, title VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars VARCHAR)\n\n Question: What are the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (stars INTEGER, rID VARCHAR)
Question: What is the average rating star for each reviewer?
Here is the SQLite qu... | Your SQL query to calculate the average rating stars for each reviewer is correct. Here it is wrapped in the code block as you requested:
```
SELECT T2.name, AVG(T1.stars)
FROM Rating AS T1
JOIN Reviewer AS T2 ON T1.rID = T2.rID
GROUP BY T2.name
```
This query will return the average rating stars for each reviewe... | 1,465 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (stars INTEGER, rID VARCHAR)\n\n Question: What is the average rating st... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
Question: Find the titles of all movies that have no ratings.
Here is the SQLite que... | Your provided SQLite query is correct. It retrieves the titles of all movies that have no ratings by selecting titles from the `Movie` table where the movie ID (`mID`) is not present in the `Rating` table. Here it is formatted as you requested:
```
SELECT title FROM Movie WHERE NOT mID IN (SELECT mID FROM Rating)
``` ... | 1,466 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)\n\n Question: Find the titles of all movies t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (rID VARCHAR); CREATE TABLE Reviewer (rID VARCHAR)
Question: Find the names of all reviewers who have ratings with a NULL value for the date.
Here is the SQLite q... | It looks like you've made a small error in your SQL query, particularly with the handling of NULL values. In SQL, to check for NULL values, you should use the `IS NULL` condition instead of comparing with a string like "null".
Assuming that the `Rating` table includes a column that should be checked for NULL (which yo... | 1,467 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (rID VARCHAR); CREATE TABLE Reviewer (rID VARCHAR)\n\n Question: Find the names of all reviewers who have ratings with a NU... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER)
Question: What is the average rating... | The SQLite query to find the average rating stars and title for the oldest movie can be written as follows:
```sql
SELECT AVG(T1.stars) AS average_rating, T2.title
FROM Rating AS T1
JOIN Movie AS T2 ON T1.mID = T2.mID
WHERE T2.year = (SELECT MIN(year) FROM Movie);
``` | 1,468 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER)... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (title VARCHAR, YEAR INTEGER)
Question: What is the name of the most recent movie?
Here is the SQLite query to answer to the question: What is the name of the most... | Your SQLite query to find the name of the most recent movie looks correct. Here it is wrapped in code format:
```
SELECT title FROM Movie WHERE YEAR = (SELECT MAX(YEAR) FROM Movie)
```
This query selects the title of the movie that has the maximum year from the Movie table. If there are ties, it will return all movi... | 1,469 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (title VARCHAR, YEAR INTEGER)\n\n Question: What is the name of the most recent movie?\n\nHere is the SQLite query to answer... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER); CREATE TABLE Movie (year VARCHAR, mID VARCHAR)
Question: What is the maximum stars and year for th... | It seems there's a minor inconsistency in the schema you provided for the `Movie` table, which is mentioned twice with different column definitions. Assuming you meant to keep just one version of the `Movie` table with the columns `YEAR INTEGER` and `mID VARCHAR`, here is the corrected query:
```sql
SELECT MAX(T1.star... | 1,470 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (YEAR INTEGER); CREATE TABLE Movie (year VARCHAR, mID VARCHAR)\n\n Questio... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (title VARCHAR, YEAR INTEGER, director VARCHAR)
Question: What is the names of movies whose created year is after all movies directed by Steven Spielberg?
Here is ... | Here's the SQLite query to find the names of movies whose created year is after all movies directed by Steven Spielberg:
```
SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = "Steven Spielberg");
``` | 1,471 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (title VARCHAR, YEAR INTEGER, director VARCHAR)\n\n Question: What is the names of movies whose created year is after all mo... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)
Question: What are the titles and directors of the movies whose sta... | Your provided SQLite query has a small mistake where you are using the alias `T1` inside the subquery, which is already used for the outer query. To correct this, you should either change the alias in the subquery or clearly delineate where to get the average stars.
Here's the corrected version of the query:
```sql
... | 1,472 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)\n\n Question: What are the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars VARCHAR, ratingDate VARCHAR, mID VARCHAR, rID VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
Q... | Here is the SQLite query formatted as requested:
```
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;
``` | 1,473 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars VARCHAR, ratingDate VARCHAR, mID VARCHAR, rID VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR)
Question: Find the names of all reviewers who have contributed three or more ratings.
Here is the... | Your provided query has a minor issue with the grouping. We should group by the reviewer ID to count the number of ratings per reviewer, not the rating ID. Here's the corrected query:
```sql
SELECT T2.name
FROM Rating AS T1
JOIN Reviewer AS T2 ON T1.rID = T2.rID
GROUP BY T2.rID
HAVING COUNT(T1.rID) >= 3;
```
Thi... | 1,474 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR)\n\n Question: Find the names of all reviewers who have con... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (mID VARCHAR, title VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
Question: Find the names of all revi... | Here is the SQLite query to find the names of all reviewers who rated "Gone with the Wind":
```
SELECT DISTINCT T3.name
FROM Rating AS T1
JOIN Movie AS T2 ON T1.mID = T2.mID
JOIN Reviewer AS T3 ON T1.rID = T3.rID
WHERE T2.title = 'Gone with the Wind'
``` | 1,475 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (mID VARCHAR, title VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
Question: Find the names of all d... | Here is the SQLite query to find the names of all directors whose movies are rated by Sarah Martinez:
```
SELECT DISTINCT T2.director
FROM Rating AS T1
JOIN Movie AS T2 ON T1.mID = T2.mID
JOIN Reviewer AS T3 ON T1.rID = T3.rID
WHERE T3.name = 'Sarah Martinez'
``` | 1,476 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCH... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars VARCHAR, mID VARCHAR, rID VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR, director VARCHAR)
Que... | Here is the SQLite query to answer the question:
```sql
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;
``` | 1,477 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars VARCHAR, mID VARCHAR, rID VARCHAR); CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Movie (title VARCHA... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (name VARCHAR, title VARCHAR); CREATE TABLE Movie (name VARCHAR, title VARCHAR)
Question: Return all reviewer names and movie names together in a single list.
H... | Your query is almost correct, but since you're looking to combine reviewer names and movie titles into a single list, you might want to ensure that both columns you're selecting are clearly labeled and combined correctly. Here's the corrected SQLite query:
```
SELECT name FROM Reviewer
UNION
SELECT title FROM Movie;... | 1,478 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (name VARCHAR, title VARCHAR); CREATE TABLE Movie (name VARCHAR, title VARCHAR)\n\n Question: Return all reviewer names a... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
... | Here is the SQLite query to find the titles of all movies not reviewed by Chris Jackson:
```
SELECT DISTINCT title
FROM Movie
EXCEPT
SELECT T2.title
FROM Rating AS T1
JOIN Movie AS T2 ON T1.mID = T2.mID
JOIN Reviewer AS T3 ON T1.rID = T3.rID
WHERE T3.name = 'Chris Jackson';
``` | 1,479 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR); CREATE TABLE Movie (title VARCHAR); CREATE TAB... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (title VARCHAR, director VARCHAR); CREATE TABLE Movie (director VARCHAR, title VARCHAR)
Question: For all directors who directed more than one movie, return the tit... | It seems like there is a small issue with the schema definition in your question, as you've defined the same table `Movie` twice with the same structure. However, assuming you meant to create two separate instances or that this was a typo, I'll proceed with the query you provided and adjust it for clarity.
Here’s the ... | 1,480 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (title VARCHAR, director VARCHAR); CREATE TABLE Movie (director VARCHAR, title VARCHAR)\n\n Question: For all directors who ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (director VARCHAR, title VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, director VARCHAR)
Question: For directors who had more than one movie, return th... | It seems there might be a small mistake in your query, as it duplicates the Movie table structure which is likely a typographical error. The `CREATE TABLE` statement lists the `Movie` table twice, which should only exist once.
Assuming the correct schema you intended is:
```sql
CREATE TABLE Movie (title VARCHAR, year ... | 1,481 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (director VARCHAR, title VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, director VARCHAR)\n\n Question: For dire... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (director VARCHAR)
Question: What are the names of the directors who made exactly one movie?
Here is the SQLite query to answer to the question: What are the names... | Your SQLite query is correct. It will return the names of the directors who made exactly one movie by grouping the records by the director's name and filtering the groups to include only those with a count of one. Here it is wrapped in code formatting:
```
SELECT director FROM Movie GROUP BY director HAVING COUNT(*) =... | 1,482 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (director VARCHAR)\n\n Question: What are the names of the directors who made exactly one movie?\n\nHere is the SQLite query... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Movie (director VARCHAR)
Question: What are the names of the directors who made exactly one movie excluding director NULL?
Here is the SQLite query to answer to the ques... | Your provided query is mostly correct, but it contains a slight issue with the comparison. In SQLite, `NULL` should be checked using `IS NOT NULL` instead of comparing it to a string. Here’s the corrected version of your query:
```
SELECT director
FROM Movie
WHERE director IS NOT NULL
GROUP BY director
HAVING COUN... | 1,483 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Movie (director VARCHAR)\n\n Question: What are the names of the directors who made exactly one movie excluding director NULL?\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR)
Question: How many movie reviews does each director get?
Here is the SQLite query to answer to t... | ```sql
SELECT COUNT(*) AS review_count, T1.director
FROM Movie AS T1
JOIN Rating AS T2 ON T1.mID = T2.mID
GROUP BY T1.director;
``` | 1,484 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (director VARCHAR, mID VARCHAR)\n\n Question: How many movie reviews does each director g... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
Question: Find the movies with the highest average rating. Return the movie titles an... | Your SQLite query looks good, but if you want to return all movies with the highest average rating, you need to adjust the query slightly. Here's the refined query that does that:
```sql
WITH AvgRating AS (
SELECT T2.title, AVG(T1.stars) AS average_rating
FROM Rating AS T1
JOIN Movie AS T2 ON T1.mID = T2.m... | 1,485 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)\n\n Question: Find the movies with the highes... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
Question: What are the movie titles and average rating of the movies with the lowest ... | The given SQLite query needs a slight adjustment to correctly identify the movie titles and average ratings of the movies with the lowest average rating. Specifically, we need to ensure that we select the titles and average ratings corresponding to the minimum average rating.
Here's the corrected query:
```sql
SELECT... | 1,486 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)\n\n Question: What are the movie titles and a... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (mID VARCHAR, stars VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, mID VARCHAR)
Question: What are the names and years of the movies that has the top 3... | Your SQLite query is almost correct; however, it may need a small adjustment to ensure that it correctly retrieves the movies with the top 3 highest ratings. Assuming that the `stars` field is stored as a numeric value (even though it's defined as a VARCHAR), the query can be adjusted to convert `stars` from VARCHAR to... | 1,487 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (mID VARCHAR, stars VARCHAR); CREATE TABLE Movie (title VARCHAR, year VARCHAR, mID VARCHAR)\n\n Question: What are the name... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)
Question: For each director, return the director's name together wi... | Your query is close but needs a few adjustments to correctly return the highest-rated movie for each director along with the corresponding rating. Specifically, you'll need to use a subquery to first determine the highest rating for each director and then join that back to the Movie table to get the movie title. Here's... | 1,488 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)\n\n Question: For each dire... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (rID VARCHAR, stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
Question: Find the title and star rating of the movie that got the least... | Your query is close, but it needs adjustment to correctly find the title and star rating of the movie that received the least rating stars for each reviewer. You need to get the minimum star rating for each reviewer first, and then join that result with the Movie table to find the corresponding movie title. Here is the... | 1,489 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (rID VARCHAR, stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)\n\n Question: Find the title and... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)
Question: Find the title and score of the movie with the lowest rat... | The query you provided has a slight issue because it does not correctly identify the movies with the lowest ratings per director. The `MIN` function needs to be used in a subquery to find the minimum rating for each director first, and then we can join back to get the corresponding movie title. Here’s the correct SQL q... | 1,490 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (stars INTEGER, mID VARCHAR); CREATE TABLE Movie (title VARCHAR, director VARCHAR, mID VARCHAR)\n\n Question: Find the titl... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
Question: What is the name of the movie that is rated by most of times?
Here is the SQLite query to... | Here is the SQLite query to answer the question about the name of the movie that is rated the most times:
```
SELECT T2.title
FROM Rating AS T1
JOIN Movie AS T2 ON T1.mID = T2.mID
GROUP BY T2.title
ORDER BY COUNT(*) DESC
LIMIT 1;
``` | 1,491 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)\n\n Question: What is the name of the movie that is rated by... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)
Question: What are the titles of all movies that have rating star is between 3 and 5?... | Your SQLite query is correct and effectively retrieves the titles of all movies that have a rating of between 3 and 5 stars. Here it is wrapped in the specified format:
```
SELECT T2.title
FROM Rating AS T1
JOIN Movie AS T2
ON T1.mID = T2.mID
WHERE T1.stars BETWEEN 3 AND 5;
``` | 1,492 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Movie (title VARCHAR, mID VARCHAR)\n\n Question: What are the titles of all movi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR, stars INTEGER)
Question: Find the names of reviewers who had given higher than 3 star ratings.
He... | Here is the SQLite query to find the names of reviewers who have given ratings higher than 3 stars:
```sql
SELECT T2.name
FROM Rating AS T1
JOIN Reviewer AS T2 ON T1.rID = T2.rID
WHERE T1.stars > 3;
``` | 1,493 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (name VARCHAR, rID VARCHAR); CREATE TABLE Rating (rID VARCHAR, stars INTEGER)\n\n Question: Find the names of reviewers w... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
Question: Find the average rating s... | Here's the correct SQLite query to find the average rating star for each movie that is not reviewed by Brittany Harris. I've made minor adjustments to ensure clarity:
```
SELECT r.mID, AVG(r.stars) AS average_stars
FROM Rating r
WHERE r.mID NOT IN (
SELECT rr.mID
FROM Rating rr
JOIN Reviewer rev ON rr.rID ... | 1,494 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR, stars INTEGER); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
Question: What are the ids of the movies that are ... | Your SQL query to find the ids of movies that are not reviewed by Brittany Harris is correct. Here it is formatted properly:
```sql
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";
```
This query uses the `EXCEPT` clause to re... | 1,495 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Rating (mID VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)\n\n Questi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (mID VARCHAR, stars INTEGER)
Question: Find the average rating star for each movie that received at least 2 ratings.
Here is the SQLite query to answer to the que... | Your provided SQLite query is correct for retrieving the average rating stars for each movie that has received at least 2 ratings. Here is the query wrapped in code formatting:
```
SELECT mID, AVG(stars)
FROM Rating
GROUP BY mID
HAVING COUNT(*) >= 2
``` | 1,496 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (mID VARCHAR, stars INTEGER)\n\n Question: Find the average rating star for each movie that received at least 2 ratings.\n\... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (rID VARCHAR, stars VARCHAR)
Question: find the ids of reviewers who did not give 4 star.
Here is the SQLite query to answer to the question: find the ids of revi... | Your SQLite query is correct for finding the ids of reviewers who did not give a 4-star rating. Here’s the query wrapped in the requested code format:
```
SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4
```
This query uses the `EXCEPT` operator to return `rID` values from the `Rating` table that... | 1,497 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (rID VARCHAR, stars VARCHAR)\n\n Question: find the ids of reviewers who did not give 4 star.\n\nHere is the SQLite query t... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Rating (rID VARCHAR, stars VARCHAR)
Question: Find the ids of reviewers who didn't only give 4 star.
Here is the SQLite query to answer to the question: Find the ids of ... | To correctly find the ids of reviewers who didn't only give 4 stars, we need to consider reviewers who have given ratings other than 4 stars at all. This can be achieved by grouping the ratings by rID and ensuring that at least one of their ratings is not 4 stars. Here’s the correct query to accomplish that:
```sql
SE... | 1,498 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Rating (rID VARCHAR, stars VARCHAR)\n\n Question: Find the ids of reviewers who didn't only give 4 star.\n\nHere is the SQLite que... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR, rID VARCHAR)
Question: What are nam... | The provided SQLite query looks good. It correctly retrieves the titles of movies that are either made after 2000 or reviewed by the reviewer named Brittany Harris. Here's the query wrapped in the requested code format:
```
SELECT DISTINCT T2.title
FROM Rating AS T1
JOIN Movie AS T2 ON T1.mID = T2.mID
JOIN Reviewer... | 1,499 | [
{
"from": "human",
"value": " Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:\n Schema: CREATE TABLE Reviewer (rID VARCHAR, name VARCHAR); CREATE TABLE Movie (title VARCHAR, mID VARCHAR, year VARCHAR); CREATE TABLE Rating (mID VARCHAR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.