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 endowment (donator_name VARCHAR, amount INTEGER) Question: List each donator name and the amount of endowment in descending order of the amount of endowment. Here is the...
Here is the SQLite query to list each donator name and the amount of endowment in descending order of the amount of endowment: ``` SELECT donator_name, SUM(amount) AS total_amount FROM endowment GROUP BY donator_name ORDER BY total_amount DESC ```
1,100
[ { "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 endowment (donator_name VARCHAR, amount INTEGER)\n\n Question: List each donator name and the amount of endowment in descending or...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE endowment (school_name VARCHAR, school_id VARCHAR); CREATE TABLE school (school_name VARCHAR, school_id VARCHAR) Question: List the names of the schools without any endow...
Here is the SQLite query to answer the question of listing the names of the schools without any endowment: ``` SELECT school_name FROM school WHERE school_id NOT IN (SELECT school_id FROM endowment); ```
1,101
[ { "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 endowment (school_name VARCHAR, school_id VARCHAR); CREATE TABLE school (school_name VARCHAR, school_id VARCHAR)\n\n Question: Lis...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE school (school_name VARCHAR, school_id VARCHAR); CREATE TABLE endowment (school_id VARCHAR, amount INTEGER) Question: List all the names of schools with an endowment amou...
Here is the SQLite query to answer the question of listing all the names of schools with an endowment amount smaller than or equal to 10: ```sql SELECT T2.school_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.school_id HAVING SUM(T1.amount) <= 10; ```
1,102
[ { "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 school (school_name VARCHAR, school_id VARCHAR); CREATE TABLE endowment (school_id VARCHAR, amount INTEGER)\n\n Question: List all...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE school (school_id VARCHAR, school_name VARCHAR); CREATE TABLE endowment (donator_name VARCHAR, school_id VARCHAR) Question: Show the names of donors who donated to both s...
Here is the SQLite query to show the names of donors who donated to both school "Glenn" and "Triton": ``` SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn' INTERSECT SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.scho...
1,103
[ { "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 school (school_id VARCHAR, school_name VARCHAR); CREATE TABLE endowment (donator_name VARCHAR, school_id VARCHAR)\n\n Question: Sh...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE endowment (donator_name VARCHAR, amount INTEGER) Question: Show the names of all the donors except those whose donation amount less than 9. Here is the SQLite query to a...
Here is the SQLite query to show the names of all the donors except those whose donation amount is less than 9: ``` SELECT donator_name FROM endowment WHERE amount >= 9; ```
1,104
[ { "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 endowment (donator_name VARCHAR, amount INTEGER)\n\n Question: Show the names of all the donors except those whose donation amount...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE endowment (amount VARCHAR, donator_name VARCHAR) Question: List the amount and donor name for the largest amount of donation. Here is the SQLite query to answer to the q...
Your SQLite query looks good, but since the `amount` column is defined as `VARCHAR`, you should convert it to a numeric type for accurate sorting. Here’s the adjusted query: ``` SELECT amount, donator_name FROM endowment ORDER BY CAST(amount AS INTEGER) DESC LIMIT 1 ``` This will ensure that you correctly identify t...
1,105
[ { "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 endowment (amount VARCHAR, donator_name VARCHAR)\n\n Question: List the amount and donor name for the largest amount of donation.\...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE budget (budgeted VARCHAR, YEAR VARCHAR) Question: How many budgets are above 3000 in year 2001 or before? Here is the SQLite query to answer to the question: How many bu...
Your SQLite query is almost correct, but since the `YEAR` column is of type VARCHAR, you should ensure that the comparison is done correctly as the year values should be treated numerically. Here’s the corrected version of your query wrapped in code blocks: ```sql SELECT COUNT(*) FROM budget WHERE budgeted > 3000 AND ...
1,106
[ { "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 budget (budgeted VARCHAR, YEAR VARCHAR)\n\n Question: How many budgets are above 3000 in year 2001 or before?\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 budget (budgeted VARCHAR, invested VARCHAR, school_id VARCHAR, year VARCHAR); CREATE TABLE school (school_name VARCHAR, school_id VARCHAR) Question: Show each school name...
Here is the SQLite query to answer the question: ``` SELECT T2.school_name, T1.budgeted, T1.invested FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.year >= '2002' ```
1,107
[ { "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 budget (budgeted VARCHAR, invested VARCHAR, school_id VARCHAR, year VARCHAR); CREATE TABLE school (school_name VARCHAR, school_id VAR...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE endowment (donator_name VARCHAR) Question: Show all donor names. Here is the SQLite query to answer to the question: Show all donor names.: ``` SELECT DISTINCT donator_n...
Here is the SQLite query to answer the question "Show all donor names." wrapped in code formatting: ``` SELECT DISTINCT donator_name FROM endowment; ```
1,108
[ { "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 endowment (donator_name VARCHAR)\n\n Question: Show all donor names.\n\nHere is the SQLite query to answer to the question: Show a...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE budget (budgeted INTEGER, invested VARCHAR) Question: How many budget record has a budget amount smaller than the invested amount? Here is the SQLite query to answer to ...
Your query has a small issue because you are comparing the `budgeted` integer value with `invested`, which is of type `VARCHAR`. To compare them correctly, you need to cast `invested` to an integer. Here’s the corrected SQLite query: ``` SELECT COUNT(*) FROM budget WHERE budgeted < CAST(invested AS INTEGER) ``` This...
1,109
[ { "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 budget (budgeted INTEGER, invested VARCHAR)\n\n Question: How many budget record has a budget amount smaller than the invested amo...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE budget (budgeted INTEGER, school_id VARCHAR); CREATE TABLE school (school_id VARCHAR, school_name VARCHAR) Question: What is the total budget amount for school "Glenn" in...
Here is the SQLite query to answer the question regarding the total budget amount for school "Glenn" in all years: ```sql SELECT SUM(T1.budgeted) FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn'; ```
1,110
[ { "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 budget (budgeted INTEGER, school_id VARCHAR); CREATE TABLE school (school_id VARCHAR, school_name VARCHAR)\n\n Question: What is t...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE endowment (school_id VARCHAR, amount INTEGER); CREATE TABLE budget (school_id VARCHAR, budgeted INTEGER); CREATE TABLE school (school_name VARCHAR, school_id VARCHAR) Que...
Your query is almost correct, but to accurately retrieve schools that have a total budget amount greater than 100 or a total endowment greater than 10, we should ensure that we appropriately handle cases where a school might not have entries in both the `budget` and `endowment` tables. A better approach would be to use...
1,111
[ { "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 endowment (school_id VARCHAR, amount INTEGER); CREATE TABLE budget (school_id VARCHAR, budgeted INTEGER); CREATE TABLE school (school...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE school (School_name VARCHAR, school_id VARCHAR); CREATE TABLE endowment (school_id VARCHAR, amount INTEGER) Question: Find the names of schools that have more than one do...
Here is the SQLite query to find the names of schools that have more than one donator with a donation amount above 8.5, wrapped in code formatting: ```sql SELECT T2.School_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.amount > 8.5 GROUP BY T1.school_id HAVING COUNT(*) > 1; ``...
1,112
[ { "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 school (School_name VARCHAR, school_id VARCHAR); CREATE TABLE endowment (school_id VARCHAR, amount INTEGER)\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 endowment (school_id VARCHAR, amount INTEGER) Question: Find the number of schools that have more than one donator whose donation amount is less than 8.5. Here is the SQ...
It looks like there was a small error in the query you provided; you're grouping by schools that have donations greater than 8.5 instead of less than. To find the number of schools that have more than one donation with amounts less than 8.5, you should modify the query. Here’s the correct query: ```sql SELECT COUNT(*)...
1,113
[ { "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 endowment (school_id VARCHAR, amount INTEGER)\n\n Question: Find the number of schools that have more than one donator whose donat...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE school (School_name VARCHAR, Mascot VARCHAR, IHSAA_Football_Class VARCHAR, school_id VARCHAR); CREATE TABLE budget (school_id VARCHAR, total_budget_percent_invested VARCHAR, t...
Your request indicates a need to filter schools based on budgeted amounts or founding years, but the provided schema does not include founding year details to directly filter schools founded before 2003. Additionally, it seems there are some syntax errors in the query. Assuming you have the founding year data in the ...
1,114
[ { "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 school (School_name VARCHAR, Mascot VARCHAR, IHSAA_Football_Class VARCHAR, school_id VARCHAR); CREATE TABLE budget (school_id VARCHAR...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (Id VARCHAR) Question: How many buildings are there? Here is the SQLite query to answer to the question: How many buildings are there?: ``` SELECT COUNT(*) FROM...
Here is the SQLite query to answer the question: How many buildings are there?: ``` SELECT COUNT(*) FROM building; ```
1,115
[ { "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 building (Id VARCHAR)\n\n Question: How many buildings are there?\n\nHere is the SQLite query to answer to the question: How many ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (name VARCHAR, street_address VARCHAR, floors VARCHAR) Question: Show the name, street address, and number of floors for all buildings ordered by the number of f...
Here is the SQLite query to show the name, street address, and number of floors for all buildings ordered by the number of floors: ``` SELECT name, street_address, floors FROM building ORDER BY floors ```
1,116
[ { "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 building (name VARCHAR, street_address VARCHAR, floors VARCHAR)\n\n Question: Show the name, street address, and number of floors ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (name VARCHAR, height_feet VARCHAR) Question: What is the name of the tallest building? Here is the SQLite query to answer to the question: What is the name of ...
Your query looks correct for finding the name of the tallest building based on height. However, since the `height_feet` column is of type VARCHAR, it may not always sort correctly if heights are stored in non-numeric strings. It is generally recommended to convert the heights to integers for correct ordering. Here's an...
1,117
[ { "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 building (name VARCHAR, height_feet VARCHAR)\n\n Question: What is the name of the tallest building?\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 building (floors INTEGER) Question: What are the average, maximum, and minimum number of floors for all buildings? Here is the SQLite query to answer to the question: Wh...
Here is the SQLite query to answer the question regarding the average, maximum, and minimum number of floors for all buildings: ``` SELECT AVG(floors) AS average_floors, MAX(floors) AS max_floors, MIN(floors) AS min_floors FROM building ```
1,118
[ { "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 building (floors INTEGER)\n\n Question: What are the average, maximum, and minimum number of floors for all buildings?\n\nHere is ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (height_feet INTEGER, floors INTEGER) Question: Show the number of buildings with a height above the average or a number of floors above the average. Here is th...
Here is the SQLite query to answer the question: ``` SELECT COUNT(*) FROM building WHERE height_feet > (SELECT AVG(height_feet) FROM building) OR floors > (SELECT AVG(floors) FROM building); ```
1,119
[ { "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 building (height_feet INTEGER, floors INTEGER)\n\n Question: Show the number of buildings with a height above the average or a num...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (name VARCHAR, height_feet VARCHAR, floors VARCHAR) Question: List the names of buildings with at least 200 feet of height and with at least 20 floors. Here is ...
Your query is almost correct, but we need to ensure that we are handling the height and floors as integers since they are stored as VARCHAR in the database. You should convert the values to integers in the WHERE clause. Here’s the corrected SQL query: ```sql SELECT name FROM building WHERE CAST(height_feet AS INTEGER...
1,120
[ { "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 building (name VARCHAR, height_feet VARCHAR, floors VARCHAR)\n\n Question: List the names of buildings with at least 200 feet of h...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (institution VARCHAR, LOCATION VARCHAR, founded VARCHAR, TYPE VARCHAR) Question: Show the names and locations of institutions that are founded after 1990 and ...
Here is the SQLite query to answer the question: ```sql SELECT institution, LOCATION FROM institution WHERE founded > '1990' AND TYPE = 'Private'; ```
1,121
[ { "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 institution (institution VARCHAR, LOCATION VARCHAR, founded VARCHAR, TYPE VARCHAR)\n\n Question: Show the names and locations of i...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (TYPE VARCHAR, enrollment INTEGER) Question: Show institution types, along with the number of institutions and total enrollment for each type. Here is the SQ...
Your SQLite query is correctly structured to retrieve the institution types along with the count of institutions and total enrollment for each type. Here it is wrapped in code formatting: ``` SELECT TYPE, COUNT(*) AS institution_count, SUM(enrollment) AS total_enrollment FROM institution GROUP BY TYPE; ``` This qu...
1,122
[ { "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 institution (TYPE VARCHAR, enrollment INTEGER)\n\n Question: Show institution types, along with the number of institutions and tot...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (TYPE VARCHAR) Question: Show the institution type with the largest number of institutions. Here is the SQLite query to answer to the question: Show the inst...
Your SQLite query correctly retrieves the institution type with the largest number of institutions. Here's the query wrapped in the appropriate format: ``` SELECT TYPE FROM institution GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1; ``` This query groups the institutions by type, counts the number of institutions in e...
1,123
[ { "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 institution (TYPE VARCHAR)\n\n Question: Show the institution type with the largest number of institutions.\n\nHere is the SQLite ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (TYPE VARCHAR, founded VARCHAR, enrollment VARCHAR) Question: Show the institution type with an institution founded after 1990 and an institution with at leas...
It looks like you're trying to query the `institution` table for records that meet specific criteria. However, `founded` and `enrollment` should be treated as numerical values in your comparisons. Since `founded` is likely stored as a string (VARCHAR), you'll need to ensure you're comparing it correctly. Assuming the `...
1,124
[ { "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 institution (TYPE VARCHAR, founded VARCHAR, enrollment VARCHAR)\n\n Question: Show the institution type with an institution founde...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (name VARCHAR, building_id VARCHAR); CREATE TABLE institution (name VARCHAR, building_id VARCHAR) Question: Show the name of buildings that do not have any insti...
Your SQLite query is correct. It effectively retrieves the names of buildings that do not have any associated institutions by using a subquery to check for the existence of `building_id` in the `institution` table. Here it is wrapped in code format: ``` SELECT name FROM building WHERE NOT building_id IN (SELECT buildi...
1,125
[ { "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 building (name VARCHAR, building_id VARCHAR); CREATE TABLE institution (name VARCHAR, building_id VARCHAR)\n\n Question: Show the ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (name VARCHAR, building_id VARCHAR); CREATE TABLE building (name VARCHAR); CREATE TABLE institution (building_id VARCHAR, founded VARCHAR) Question: Show the nam...
There seems to be a minor issue in the database schema you provided, as it contains the table `building` defined twice. Assuming the second instance of the `building` table is a typographical error and you meant to define the `institution` table only once alongside the `building` table, here’s how the query would be co...
1,126
[ { "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 building (name VARCHAR, building_id VARCHAR); CREATE TABLE building (name VARCHAR); CREATE TABLE institution (building_id VARCHAR, fo...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (name VARCHAR, building_id VARCHAR); CREATE TABLE institution (building_id VARCHAR) Question: For each building, show the name of the building and the number of ...
The SQLite query you've provided is mostly correct but it needs a small adjustment to include the `GROUP BY` clause according to the selected columns. Here’s the corrected version of the query: ```sql SELECT T1.name, COUNT(T2.building_id) AS institution_count FROM building AS T1 LEFT JOIN institution AS T2 ON T1.build...
1,127
[ { "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 building (name VARCHAR, building_id VARCHAR); CREATE TABLE institution (building_id VARCHAR)\n\n Question: For each building, show...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE building (name VARCHAR, height_feet VARCHAR, building_id VARCHAR); CREATE TABLE institution (building_id VARCHAR, founded INTEGER) Question: Show the names and heights of...
Here is the SQLite query to answer the question about buildings with at least two institutions founded after 1880: ``` SELECT T1.name, T1.height_feet FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded > 1880 GROUP BY T1.building_id HAVING COUNT(*) >= 2; ```
1,128
[ { "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 building (name VARCHAR, height_feet VARCHAR, building_id VARCHAR); CREATE TABLE institution (building_id VARCHAR, founded INTEGER)\n\...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (TYPE VARCHAR) Question: Show all the distinct institution types. Here is the SQLite query to answer to the question: Show all the distinct institution types...
Here is the SQLite query to show all the distinct institution types: ``` SELECT DISTINCT TYPE FROM institution; ```
1,129
[ { "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 institution (TYPE VARCHAR)\n\n Question: Show all the distinct institution types.\n\nHere is the SQLite query to answer to the que...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (institution VARCHAR, institution_id VARCHAR); CREATE TABLE protein (institution_id VARCHAR) Question: Show institution names along with the number of protein...
Your SQL query is almost correct, but you should group by the `institution` name instead of `institution_id` in order to get the correct count associated with each institution. Here is the corrected query: ```sql SELECT T1.institution, COUNT(T2.institution_id) AS protein_count FROM institution AS T1 JOIN protein AS ...
1,130
[ { "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 institution (institution VARCHAR, institution_id VARCHAR); CREATE TABLE protein (institution_id VARCHAR)\n\n Question: Show instit...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (institution_id VARCHAR, founded VARCHAR, type VARCHAR); CREATE TABLE protein (institution_id VARCHAR) Question: How many proteins are associated with an inst...
Here’s the SQLite query to answer the question: ```sql SELECT COUNT(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id WHERE T1.founded > '1880' OR T1.type = 'Private'; ```
1,131
[ { "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 institution (institution_id VARCHAR, founded VARCHAR, type VARCHAR); CREATE TABLE protein (institution_id VARCHAR)\n\n Question: H...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE institution (institution VARCHAR, institution_id VARCHAR); CREATE TABLE protein (protein_name VARCHAR, institution_id VARCHAR) Question: Show the protein name and the ins...
Your provided SQLite query is correctly structured to retrieve the protein names along with their corresponding institution names. Here it is wrapped as requested: ``` SELECT T2.protein_name, T1.institution FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id; ```
1,132
[ { "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 institution (institution VARCHAR, institution_id VARCHAR); CREATE TABLE protein (protein_name VARCHAR, institution_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 institution (institution_id VARCHAR, building_id VARCHAR); CREATE TABLE building (building_id VARCHAR, floors VARCHAR); CREATE TABLE protein (institution_id VARCHAR) Ques...
Your SQLite query to find out how many proteins are associated with an institution in a building with at least 20 floors is structured correctly. Here it is formatted as requested: ``` SELECT COUNT(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id JOIN building AS T3 ON T3.buildi...
1,133
[ { "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 institution (institution_id VARCHAR, building_id VARCHAR); CREATE TABLE building (building_id VARCHAR, floors VARCHAR); CREATE TABLE ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE protein (institution_id VARCHAR); CREATE TABLE institution (institution_id VARCHAR) Question: How many institutions do not have an associated protein in our record? Here...
Your query is almost correct, but it's generally a good practice to use `NOT EXISTS` instead of `NOT IN` when you're dealing with subqueries, as it can handle null values more elegantly. Here's the refined query: ``` SELECT COUNT(*) FROM institution i WHERE NOT EXISTS (SELECT 1 FROM protein p WHERE p.institution_id ...
1,134
[ { "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 protein (institution_id VARCHAR); CREATE TABLE institution (institution_id VARCHAR)\n\n Question: How many institutions do not hav...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (LOCATION VARCHAR, capacity INTEGER) Question: Show all the locations where no cinema has capacity over 800. Here is the SQLite query to answer to the question: S...
Your SQLite query is correct for finding all locations where no cinema has a capacity over 800. Here it is wrapped in the requested code format: ``` SELECT LOCATION FROM cinema EXCEPT SELECT LOCATION FROM cinema WHERE capacity > 800; ``` This query first retrieves all the locations from the `cinema` table, and then ...
1,135
[ { "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 cinema (LOCATION VARCHAR, capacity INTEGER)\n\n Question: Show all the locations where no cinema has capacity over 800.\n\nHere is...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (LOCATION VARCHAR, openning_year VARCHAR) Question: Show all the locations where some cinemas were opened in both year 2010 and year 2011. Here is the SQLite quer...
Here is the SQLite query to answer the question: ```sql SELECT LOCATION FROM cinema WHERE openning_year = '2010' INTERSECT SELECT LOCATION FROM cinema WHERE openning_year = '2011'; ```
1,136
[ { "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 cinema (LOCATION VARCHAR, openning_year VARCHAR)\n\n Question: Show all the locations where some cinemas were opened in both year ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (Id VARCHAR) Question: How many cinema do we have? Here is the SQLite query to answer to the question: How many cinema do we have?: ``` SELECT COUNT(*) FROM cinem...
Here is the SQLite query to answer the question "How many cinema do we have?": ``` SELECT COUNT(*) FROM cinema ```
1,137
[ { "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 cinema (Id VARCHAR)\n\n Question: How many cinema do we have?\n\nHere is the SQLite query to answer to the question: How many cine...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (name VARCHAR, openning_year VARCHAR, capacity VARCHAR) Question: Show name, opening year, and capacity for each cinema. Here is the SQLite query to answer to the...
Here is the SQLite query to answer the question: ``` SELECT name, openning_year, capacity FROM cinema; ```
1,138
[ { "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 cinema (name VARCHAR, openning_year VARCHAR, capacity VARCHAR)\n\n Question: Show name, opening year, and capacity for each cinema...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (name VARCHAR, LOCATION VARCHAR, capacity INTEGER) Question: Show the cinema name and location for cinemas with capacity above average. Here is the SQLite query t...
Here is the SQLite query wrapped in the appropriate code format: ``` SELECT name, LOCATION FROM cinema WHERE capacity > (SELECT AVG(capacity) FROM cinema) ```
1,139
[ { "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 cinema (name VARCHAR, LOCATION VARCHAR, capacity INTEGER)\n\n Question: Show the cinema name and location for cinemas with capacit...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (LOCATION VARCHAR) Question: What are all the locations with a cinema? Here is the SQLite query to answer to the question: What are all the locations with a cinem...
Here is the SQLite query to answer the question about all the locations with a cinema: ``` SELECT DISTINCT LOCATION FROM cinema ```
1,140
[ { "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 cinema (LOCATION VARCHAR)\n\n Question: What are all the locations with a cinema?\n\nHere is the SQLite query to answer to the que...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (name VARCHAR, openning_year VARCHAR) Question: Show all the cinema names and opening years in descending order of opening year. Here is the SQLite query to answe...
Here is the SQLite query to answer the question: ``` SELECT name, openning_year FROM cinema ORDER BY openning_year DESC ```
1,141
[ { "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 cinema (name VARCHAR, openning_year VARCHAR)\n\n Question: Show all the cinema names and opening years in descending order of open...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (name VARCHAR, LOCATION VARCHAR, capacity VARCHAR) Question: What are the name and location of the cinema with the largest capacity? Here is the SQLite query to a...
Your SQLite query to find the name and location of the cinema with the largest capacity is almost correct, but since capacity is stored as a VARCHAR, it's important to convert it to an INTEGER for proper sorting. Here’s the revised query: ```sql SELECT name, LOCATION FROM cinema ORDER BY CAST(capacity AS INTEGER) DE...
1,142
[ { "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 cinema (name VARCHAR, LOCATION VARCHAR, capacity VARCHAR)\n\n Question: What are the name and location of the cinema with the larg...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (capacity INTEGER, openning_year VARCHAR) Question: Show the average, minimum, and maximum capacity for all the cinemas opened in year 2011 or later. Here is the ...
Here is the SQLite query to show the average, minimum, and maximum capacity for all the cinemas opened in the year 2011 or later: ``` SELECT AVG(capacity) AS average_capacity, MIN(capacity) AS minimum_capacity, MAX(capacity) AS maximum_capacity FROM cinema WHERE openning_year >= '2011'; ```
1,143
[ { "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 cinema (capacity INTEGER, openning_year VARCHAR)\n\n Question: Show the average, minimum, and maximum capacity for all the cinemas...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (LOCATION VARCHAR) Question: Show each location and the number of cinemas there. Here is the SQLite query to answer to the question: Show each location and the nu...
Here is the SQLite query to answer the question "Show each location and the number of cinemas there": ``` SELECT LOCATION, COUNT(*) FROM cinema GROUP BY LOCATION ```
1,144
[ { "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 cinema (LOCATION VARCHAR)\n\n Question: Show each location and the number of cinemas there.\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 cinema (LOCATION VARCHAR, openning_year VARCHAR) Question: What is the location with the most cinemas opened in year 2010 or later? Here is the SQLite query to answer to...
Your SQLite query is correct and effectively retrieves the location with the most cinemas that opened in 2010 or later. Here is the formatted SQL code: ``` SELECT LOCATION FROM cinema WHERE openning_year >= 2010 GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1; ``` This query counts the number of cinemas per lo...
1,145
[ { "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 cinema (LOCATION VARCHAR, openning_year VARCHAR)\n\n Question: What is the location with the most cinemas opened in year 2010 or l...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (LOCATION VARCHAR, capacity INTEGER) Question: Show all the locations with at least two cinemas with capacity above 300. Here is the SQLite query to answer to the...
Here is the SQLite query to answer the question of showing all the locations with at least two cinemas with a capacity above 300: ``` SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) >= 2; ```
1,146
[ { "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 cinema (LOCATION VARCHAR, capacity INTEGER)\n\n Question: Show all the locations with at least two cinemas with capacity above 300...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE film (title VARCHAR, directed_by VARCHAR) Question: Show the title and director for all films. Here is the SQLite query to answer to the question: Show the title and dir...
Here is the SQLite query to answer the question: Show the title and director for all films: ``` SELECT title, directed_by FROM film ```
1,147
[ { "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 film (title VARCHAR, directed_by VARCHAR)\n\n Question: Show the title and director for all films.\n\nHere is the SQLite query to ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE film (directed_by VARCHAR) Question: Show all directors. Here is the SQLite query to answer to the question: Show all directors.: ``` SELECT DISTINCT directed_by FROM fi...
Your SQLite query to show all directors from the `film` table is correct. Here it is wrapped up as you requested: ``` SELECT DISTINCT directed_by FROM film ```
1,148
[ { "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 film (directed_by VARCHAR)\n\n Question: Show all directors.\n\nHere is the SQLite query to answer to the question: Show all direc...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE film (directed_by VARCHAR) Question: List all directors along with the number of films directed by each director. Here is the SQLite query to answer to the question: Lis...
Here is the SQLite query to answer the question: List all directors along with the number of films directed by each director: ```sql SELECT directed_by, COUNT(*) AS film_count FROM film GROUP BY directed_by; ```
1,149
[ { "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 film (directed_by VARCHAR)\n\n Question: List all directors along with the number of films directed by each director.\n\nHere is t...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE schedule (show_times_per_day INTEGER, cinema_id VARCHAR); CREATE TABLE cinema (name VARCHAR, cinema_id VARCHAR) Question: What is total number of show times per dat for e...
Your provided SQLite query is almost correct, but there is a small issue with the `GROUP BY` clause. To ensure that you also group by the cinema's name and maintain clarity in the result set, here's the corrected version: ```sql SELECT T2.name, SUM(T1.show_times_per_day) AS total_show_times FROM schedule AS T1 JOIN ci...
1,150
[ { "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 schedule (show_times_per_day INTEGER, cinema_id VARCHAR); CREATE TABLE cinema (name VARCHAR, cinema_id 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 film (title VARCHAR, film_id VARCHAR); CREATE TABLE schedule (price INTEGER, film_id VARCHAR) Question: What are the title and maximum price of each film? Here is the SQ...
Here is the SQLite query to answer the question "What are the title and maximum price of each film?": ``` SELECT T2.title, MAX(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.title; ``` This query joins the `schedule` and `film` tables based on the `film_id`, selects the film ...
1,151
[ { "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 film (title VARCHAR, film_id VARCHAR); CREATE TABLE schedule (price INTEGER, film_id VARCHAR)\n\n Question: What are the title and...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE schedule (date VARCHAR, price VARCHAR, film_id VARCHAR, cinema_id VARCHAR); CREATE TABLE cinema (name VARCHAR, cinema_id VARCHAR); CREATE TABLE film (title VARCHAR, film_id VA...
Here is the SQLite query to answer the question of showing cinema name, film title, date, and price for each record in the schedule: ``` SELECT T3.name, T2.title, T1.date, T1.price FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN cinema AS T3 ON T1.cinema_id = T3.cinema_id; ```
1,152
[ { "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 schedule (date VARCHAR, price VARCHAR, film_id VARCHAR, cinema_id VARCHAR); CREATE TABLE cinema (name VARCHAR, cinema_id VARCHAR); CR...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE schedule (title VARCHAR, directed_by VARCHAR, film_id VARCHAR); CREATE TABLE film (title VARCHAR, directed_by VARCHAR, film_id VARCHAR) Question: What are the title and d...
Your query is correct for finding the titles and directors of the films that do not have any schedule. Here it is wrapped in the requested format: ``` SELECT title, directed_by FROM film WHERE film_id NOT IN (SELECT film_id FROM schedule); ```
1,153
[ { "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 schedule (title VARCHAR, directed_by VARCHAR, film_id VARCHAR); CREATE TABLE film (title VARCHAR, directed_by VARCHAR, film_id VARCHA...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE schedule (film_id VARCHAR, show_times_per_day INTEGER); CREATE TABLE film (directed_by VARCHAR, film_id VARCHAR) Question: Show director with the largest number of show t...
Your SQLite query is correctly structured to find the director with the largest number of show times in total. Here it is wrapped in code formatting: ```sql SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.directed_by ORDER BY SUM(T1.show_times_per_day) DESC LIMIT 1...
1,154
[ { "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 schedule (film_id VARCHAR, show_times_per_day INTEGER); CREATE TABLE film (directed_by VARCHAR, film_id VARCHAR)\n\n Question: Sho...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE cinema (LOCATION VARCHAR, capacity INTEGER) Question: Find the locations that have more than one movie theater with capacity above 300. Here is the SQLite query to answe...
Here is the SQLite query to find the locations that have more than one movie theater with capacity above 300: ```sql SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) > 1; ```
1,155
[ { "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 cinema (LOCATION VARCHAR, capacity INTEGER)\n\n Question: Find the locations that have more than one movie theater with capacity a...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE film (title VARCHAR) Question: How many films have the word 'Dummy' in their titles? Here is the SQLite query to answer to the question: How many films have the word 'Du...
Your SQLite query to count the number of films that have the word 'Dummy' in their titles is correct. Here it is wrapped in code formatting: ``` SELECT COUNT(*) FROM film WHERE title LIKE "%Dummy%" ```
1,156
[ { "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 film (title VARCHAR)\n\n Question: How many films have the word 'Dummy' in their titles?\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 discount_coupons (coupon_id VARCHAR, coupon_amount VARCHAR); CREATE TABLE customers (good_or_bad_customer VARCHAR, coupon_id VARCHAR) Question: Are the customers holding ...
Here is the SQLite query that answers the question about whether customers holding coupons with an amount of 500 are classified as bad or good: ``` SELECT T1.good_or_bad_customer FROM customers AS T1 JOIN discount_coupons AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.coupon_amount = '500' ``` Note that I have en...
1,157
[ { "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 discount_coupons (coupon_id VARCHAR, coupon_amount VARCHAR); CREATE TABLE customers (good_or_bad_customer VARCHAR, coupon_id VARCHAR)...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE bookings (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR) Question: How many bookings did each customer make? List the customer id,...
Your provided SQLite query is almost correct, but there's a minor issue regarding how you're referencing the `first_name`. You need to select `first_name` from the `Customers` table. Here's the corrected version of the SQL query that accomplishes your requirements: ```sql SELECT C.customer_id, C.first_name, COUNT(B.cu...
1,158
[ { "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 bookings (customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR)\n\n Question: How many bookings d...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE Payments (customer_id VARCHAR, amount_paid INTEGER) Question: What is the maximum total amount paid by a customer? List the customer id and amount. Here is the SQLite qu...
Your provided SQLite query is almost correct, but it needs a slight adjustment to ensure the maximum total amount is accurately retrieved alongside the customer id in a more precise format. Here is the refined query: ``` SELECT customer_id, SUM(amount_paid) AS total_amount FROM Payments GROUP BY customer_id ORDER BY t...
1,159
[ { "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 Payments (customer_id VARCHAR, amount_paid INTEGER)\n\n Question: What is the maximum total amount paid by a customer? List the cu...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE Payments (booking_id VARCHAR); CREATE TABLE Bookings (booking_id VARCHAR, amount_of_refund VARCHAR) Question: What are the id and the amount of refund of the booking that...
Your SQLite query looks correct for the given requirements. It joins the `Bookings` table with the `Payments` table, groups the results by `booking_id`, counts the number of payments for each booking, orders the results in descending order by the count, and limits the result to the top booking with the most payments. ...
1,160
[ { "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 Payments (booking_id VARCHAR); CREATE TABLE Bookings (booking_id VARCHAR, amount_of_refund VARCHAR)\n\n Question: What are the id ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE products_booked (product_id VARCHAR) Question: What is the id of the product that is booked for 3 times? Here is the SQLite query to answer to the question: What is the ...
Here is the SQLite query to answer the question about the product that is booked for 3 times, wrapped in code formatting: ``` SELECT product_id FROM products_booked GROUP BY product_id HAVING COUNT(*) = 3 ```
1,161
[ { "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 products_booked (product_id VARCHAR)\n\n Question: What is the id of the product that is booked for 3 times?\n\nHere is the SQLite...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE products_for_hire (product_description VARCHAR, product_id VARCHAR); CREATE TABLE products_booked (product_id VARCHAR, booked_amount VARCHAR) Question: What is the produc...
Here is the SQLite query to answer the question regarding the product description of the product booked with an amount of 102.76: ``` SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = '102.76'; ``` Note that `booked_amou...
1,162
[ { "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 products_for_hire (product_description VARCHAR, product_id VARCHAR); CREATE TABLE products_booked (product_id VARCHAR, booked_amount ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE bookings (booking_start_date VARCHAR, booking_end_date VARCHAR, booking_id VARCHAR); CREATE TABLE products_booked (product_id VARCHAR, booking_id VARCHAR); CREATE TABLE Produc...
Here is the SQLite query to answer the question regarding the booking start and end dates for the product named 'Book collection A': ``` SELECT T3.booking_start_date, T3.booking_end_date FROM Products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id = T2.product_id JOIN bookings AS T3 ON T2.booking_id = T...
1,163
[ { "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 bookings (booking_start_date VARCHAR, booking_end_date VARCHAR, booking_id VARCHAR); CREATE TABLE products_booked (product_id VARCHAR...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE view_product_availability (product_id VARCHAR, available_yn VARCHAR); CREATE TABLE products_for_hire (product_name VARCHAR, product_id VARCHAR) Question: What are the nam...
Your query is almost correct, but the value for `available_yn` should be checked against the string '1' instead of the integer 1, since `available_yn` is likely stored as a string. Here’s the updated query wrapped in code format: ``` SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire ...
1,164
[ { "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 view_product_availability (product_id VARCHAR, available_yn VARCHAR); CREATE TABLE products_for_hire (product_name VARCHAR, product_i...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE products_for_hire (product_type_code VARCHAR) Question: How many different product types are there? Here is the SQLite query to answer to the question: How many differen...
Your SQLite query to count the number of different product types is correct. Here it is wrapped in code formatting as you requested: ``` SELECT COUNT(DISTINCT product_type_code) FROM products_for_hire; ```
1,165
[ { "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 products_for_hire (product_type_code VARCHAR)\n\n Question: How many different product types are there?\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 customers (first_name VARCHAR, last_name VARCHAR, gender_mf VARCHAR, good_or_bad_customer VARCHAR) Question: What are the first name, last name, and gender of all the goo...
Here is the SQLite query that answers your question: ``` SELECT first_name, last_name, gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name; ```
1,166
[ { "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 customers (first_name VARCHAR, last_name VARCHAR, gender_mf VARCHAR, good_or_bad_customer VARCHAR)\n\n Question: What are the firs...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE payments (amount_due INTEGER) Question: What is the average amount due for all the payments? Here is the SQLite query to answer to the question: What is the average amou...
Here is the SQLite query to answer the question about the average amount due for all the payments: ``` SELECT AVG(amount_due) FROM payments ```
1,167
[ { "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 payments (amount_due INTEGER)\n\n Question: What is the average amount due for all the payments?\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 products_booked (booked_count INTEGER) Question: What are the maximum, minimum, and average booked count for the products booked? Here is the SQLite query to answer to t...
Your SQLite query is correct for retrieving the maximum, minimum, and average booked count from the `products_booked` table. Here it is wrapped in the requested format: ``` SELECT MAX(booked_count), MIN(booked_count), AVG(booked_count) FROM products_booked; ```
1,168
[ { "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 products_booked (booked_count INTEGER)\n\n Question: What are the maximum, minimum, and average booked count for the products book...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE payments (payment_type_code VARCHAR) Question: What are all the distinct payment types? Here is the SQLite query to answer to the question: What are all the distinct pay...
Here is the SQLite query to answer the question about obtaining all the distinct payment types: ``` SELECT DISTINCT payment_type_code FROM payments; ```
1,169
[ { "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 payments (payment_type_code VARCHAR)\n\n Question: What are all the distinct payment types?\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 Products_for_hire (daily_hire_cost VARCHAR, product_name VARCHAR) Question: What are the daily hire costs for the products with substring 'Book' in its name? Here is the...
Here is the SQLite query to answer the question regarding the daily hire costs for the products with the substring 'Book' in their name: ``` SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%' ```
1,170
[ { "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 Products_for_hire (daily_hire_cost VARCHAR, product_name VARCHAR)\n\n Question: What are the daily hire costs for the products wit...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE products_booked (product_id VARCHAR, booked_amount INTEGER); CREATE TABLE Products_for_hire (product_id VARCHAR, booked_amount INTEGER) Question: How many products are ne...
Here is the SQLite query to answer the question of how many products are never booked with an amount higher than 200: ``` SELECT COUNT(*) FROM Products_for_hire WHERE product_id NOT IN ( SELECT product_id FROM products_booked WHERE booked_amount > 200 ); ```
1,171
[ { "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 products_booked (product_id VARCHAR, booked_amount INTEGER); CREATE TABLE Products_for_hire (product_id VARCHAR, booked_amount INTEGE...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE Discount_Coupons (coupon_amount VARCHAR, coupon_id VARCHAR); CREATE TABLE customers (coupon_id VARCHAR, good_or_bad_customer VARCHAR) Question: What are the coupon amount...
Here is the SQLite query to find the coupon amounts of the coupons owned by both good and bad customers: ``` SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1...
1,172
[ { "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 Discount_Coupons (coupon_amount VARCHAR, coupon_id VARCHAR); CREATE TABLE customers (coupon_id VARCHAR, good_or_bad_customer VARCHAR)...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE payments (payment_date VARCHAR, amount_paid VARCHAR, payment_type_code VARCHAR) Question: What are the payment date of the payment with amount paid higher than 300 or wit...
Here's the SQLite query to answer the question regarding payment dates for payments with an amount paid higher than 300 or with a payment type of 'Check': ```sql SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'; ```
1,173
[ { "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 payments (payment_date VARCHAR, amount_paid VARCHAR, payment_type_code VARCHAR)\n\n Question: What are the payment date of the pay...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE products_for_hire (product_name VARCHAR, product_description VARCHAR, product_type_code VARCHAR, daily_hire_cost VARCHAR) Question: What are the names and descriptions of...
Here is the corrected SQLite query to answer the question regarding products of 'Cutlery' type with a daily hire cost lower than 20: ```sql SELECT product_name, product_description FROM products_for_hire WHERE product_type_code = 'Cutlery' AND CAST(daily_hire_cost AS REAL) < 20; ``` Note: The `daily_hire_cost` is...
1,174
[ { "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 products_for_hire (product_name VARCHAR, product_description VARCHAR, product_type_code VARCHAR, daily_hire_cost VARCHAR)\n\n Ques...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone (Id VARCHAR) Question: How many phones are there? Here is the SQLite query to answer to the question: How many phones are there?: ``` SELECT COUNT(*) FROM phone ``...
Here is the SQLite query to answer the question: How many phones are there?: ``` SELECT COUNT(*) FROM phone; ```
1,175
[ { "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 phone (Id VARCHAR)\n\n Question: How many phones are there?\n\nHere is the SQLite query to answer to the question: How many phones...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone (Name VARCHAR, Price VARCHAR) Question: List the names of phones in ascending order of price. Here is the SQLite query to answer to the question: List the names of...
Your provided query is correct, but since the `Price` column is defined as `VARCHAR`, sorting might not yield the expected numerical order if the prices are stored in a non-standard format (e.g., including currency symbols). If the prices are purely numeric but stored as strings, it would be better to convert them to...
1,176
[ { "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 phone (Name VARCHAR, Price VARCHAR)\n\n Question: List the names of phones in ascending order of price.\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 phone (Memory_in_G VARCHAR, Carrier VARCHAR) Question: What are the memories and carriers of phones? Here is the SQLite query to answer to the question: What are the mem...
Here is the SQLite query to answer the question about the memories and carriers of phones, wrapped as you requested: ``` SELECT Memory_in_G, Carrier FROM phone; ```
1,177
[ { "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 phone (Memory_in_G VARCHAR, Carrier VARCHAR)\n\n Question: What are the memories and carriers of phones?\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 phone (Carrier VARCHAR, Memory_in_G INTEGER) Question: List the distinct carriers of phones with memories bigger than 32. Here is the SQLite query to answer to the quest...
Your SQLite query is correct. Here it is wrapped in code blocks for clarity: ``` SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G > 32 ``` This query will return a list of unique carriers for phones that have more than 32 gigabytes of memory.
1,178
[ { "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 phone (Carrier VARCHAR, Memory_in_G INTEGER)\n\n Question: List the distinct carriers of phones with memories bigger than 32.\n\nH...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone (Name VARCHAR, Carrier VARCHAR) Question: Show the names of phones with carrier either "Sprint" or "TMobile". Here is the SQLite query to answer to the question: S...
Here is the SQLite query to show the names of phones with carrier either "Sprint" or "TMobile": ``` SELECT Name FROM phone WHERE Carrier = "Sprint" OR Carrier = "TMobile"; ```
1,179
[ { "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 phone (Name VARCHAR, Carrier VARCHAR)\n\n Question: Show the names of phones with carrier either \"Sprint\" or \"TMobile\".\n\nHer...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone (Carrier VARCHAR, Price VARCHAR) Question: What is the carrier of the most expensive phone? Here is the SQLite query to answer to the question: What is the carrier...
The SQLite query you provided is almost correct, but there's a small issue with the `Price` field. Assuming that `Price` is stored as a VARCHAR, it's important to ensure that we convert it to a numeric type for proper ordering, especially if the prices contain currency symbols or other characters. Here's the revised q...
1,180
[ { "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 phone (Carrier VARCHAR, Price VARCHAR)\n\n Question: What is the carrier of the most expensive phone?\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 phone (Carrier VARCHAR) Question: Show different carriers of phones together with the number of phones with each carrier. Here is the SQLite query to answer to the quest...
Your SQLite query is correct for the given question. Here it is wrapped properly: ``` SELECT Carrier, COUNT(*) FROM phone GROUP BY Carrier; ```
1,181
[ { "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 phone (Carrier VARCHAR)\n\n Question: Show different carriers of phones together with the number of phones with each carrier.\n\nH...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone (Carrier VARCHAR) Question: Show the most frequently used carrier of the phones. Here is the SQLite query to answer to the question: Show the most frequently used ...
Your provided SQLite query is correct for the question asked. It will successfully retrieve the most frequently used carrier from the `phone` table. Here it is wrapped in code: ``` SELECT Carrier FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC LIMIT 1; ``` This query groups the records by `Carrier`, counts how ma...
1,182
[ { "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 phone (Carrier VARCHAR)\n\n Question: Show the most frequently used carrier of the phones.\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 phone (Carrier VARCHAR, Memory_in_G INTEGER) Question: Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64. Here is...
Here is the SQLite query to answer the question you provided: ```sql SELECT Carrier FROM phone WHERE Carrier IN ( SELECT Carrier FROM phone WHERE Memory_in_G < 32 ) AND Carrier IN ( SELECT Carrier FROM phone WHERE Memory_in_G > 64 ); ```
1,183
[ { "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 phone (Carrier VARCHAR, Memory_in_G INTEGER)\n\n Question: Show the carriers that have both phones with memory smaller than 32 and...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE market (District VARCHAR, Market_ID VARCHAR); CREATE TABLE phone_market (Market_ID VARCHAR, Phone_ID VARCHAR) Questio...
Here is the SQLite query to answer the question "Show the names of phones and the districts of markets they are on": ``` SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID; ```
1,184
[ { "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 phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE market (District VARCHAR, Market_ID VARCHAR); CREATE TABLE phone_market (Market_...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE market (District VARCHAR, Market_ID VARCHAR, Ranking VARCHAR); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Market_ID VARCHAR, Phone_ID VARC...
Here is the SQLite query to show the names of phones and the districts of markets they are in, ordered by the ranking of the market in ascending order: ```sql SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID ORDER BY ...
1,185
[ { "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 market (District VARCHAR, Market_ID VARCHAR, Ranking VARCHAR); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE phon...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE market (Market_ID VARCHAR, Num_of_shops INTEGER); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Market_ID VARCHAR, Phone_ID VARCHAR) Que...
Here is the SQLite query to answer the question "Show the names of phones that are on market with number of shops greater than 50": ``` SELECT T3.Name FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID WHERE T2.Num_of_shops > 50 ```
1,186
[ { "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 market (Market_ID VARCHAR, Num_of_shops INTEGER); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Mar...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone_market (Num_of_stock INTEGER, Phone_ID VARCHAR); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR) Question: For each phone, show its names and total number of st...
Here is the SQLite query to answer the question of showing each phone's names along with the total number of stocks: ``` SELECT T2.Name, SUM(T1.Num_of_stock) AS Total_Stocks FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name; ```
1,187
[ { "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 phone_market (Num_of_stock INTEGER, Phone_ID VARCHAR); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR)\n\n Question: For each ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone_market (Phone_ID VARCHAR, Num_of_stock INTEGER); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR) Question: Show the names of phones that have total number of st...
Your SQL query looks correct for the given schema and question. It correctly joins the two tables, groups by the phone names, filters for stocks greater than 2000, and orders the results as requested. Here is the code wrapped as requested: ``` SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = ...
1,188
[ { "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 phone_market (Phone_ID VARCHAR, Num_of_stock INTEGER); CREATE TABLE phone (Name VARCHAR, Phone_ID VARCHAR)\n\n Question: Show the ...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE phone (Name VARCHAR, Phone_id VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Name VARCHAR, Phone_id VARCHAR, Phone_ID VARCHAR) Question: List the names of phones ...
Your SQLite query is mostly correct, but there is a minor adjustment that can improve its clarity. In your schema, both tables have columns named `Phone_id` and `Phone_ID`. To avoid confusion, make sure the case sensitivity (if applicable) is correct. Here’s your query wrapped in the appropriate format: ```sql SELECT...
1,189
[ { "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 phone (Name VARCHAR, Phone_id VARCHAR, Phone_ID VARCHAR); CREATE TABLE phone_market (Name VARCHAR, Phone_id VARCHAR, Phone_ID VARCHAR...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (Id VARCHAR) Question: How many gas companies are there? Here is the SQLite query to answer to the question: How many gas companies are there?: ``` SELECT COUNT(...
To determine how many gas companies are there based on the given schema, you would need to specify what defines a gas company within the `company` table. Assuming that the table `company` contains various companies and you are interested in counting only those that are classified as gas companies, you might need an add...
1,190
[ { "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 company (Id VARCHAR)\n\n Question: How many gas companies 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 company (company VARCHAR, rank VARCHAR, Sales_billion VARCHAR) Question: List the company name and rank for all companies in the decreasing order of their sales. Here is...
Your provided SQLite query is correct for the task you described. Here it is wrapped in code blocks as requested: ```sql SELECT company, rank FROM company ORDER BY Sales_billion DESC; ```
1,191
[ { "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 company (company VARCHAR, rank VARCHAR, Sales_billion VARCHAR)\n\n Question: List the company name and rank for all companies in t...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (company VARCHAR, main_industry VARCHAR, headquarters VARCHAR) Question: Show the company name and the main industry for all companies whose headquarters are not ...
Here is the SQLite query to answer the question: ``` SELECT company, main_industry FROM company WHERE headquarters <> 'USA' ```
1,192
[ { "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 company (company VARCHAR, main_industry VARCHAR, headquarters VARCHAR)\n\n Question: Show the company name and the main industry f...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (company VARCHAR, headquarters VARCHAR, market_value VARCHAR) Question: Show all company names and headquarters in the descending order of market value. Here is ...
The SQLite query you've provided is almost correct, but you should ensure that the `market_value` is being interpreted correctly for sorting, especially if it is stored as a string. If the `market_value` represents numeric values and is stored as a string, you should convert it to a numeric type for accurate ordering. ...
1,193
[ { "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 company (company VARCHAR, headquarters VARCHAR, market_value VARCHAR)\n\n Question: Show all company names and headquarters in the...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (market_value INTEGER) Question: Show minimum, maximum, and average market value for all companies. Here is the SQLite query to answer to the question: Show mini...
Here is the SQLite query to answer the question: ```sql SELECT MIN(market_value) AS min_market_value, MAX(market_value) AS max_market_value, AVG(market_value) AS avg_market_value FROM company; ```
1,194
[ { "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 company (market_value INTEGER)\n\n Question: Show minimum, maximum, and average market value for all companies.\n\nHere is the SQL...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (main_industry VARCHAR) Question: Show all main industry for all companies. Here is the SQLite query to answer to the question: Show all main industry for all co...
Your provided SQLite query is correct for the given schema and question. Here it is wrapped in the appropriate formatting: ``` SELECT DISTINCT main_industry FROM company; ```
1,195
[ { "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 company (main_industry VARCHAR)\n\n Question: Show all main industry for all companies.\n\nHere is the SQLite query to answer to t...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (headquarters VARCHAR) Question: List all headquarters and the number of companies in each headquarter. Here is the SQLite query to answer to the question: List ...
Your provided SQLite query is correct. Here is the query wrapped as requested: ``` SELECT headquarters, COUNT(*) FROM company GROUP BY headquarters; ```
1,196
[ { "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 company (headquarters VARCHAR)\n\n Question: List all headquarters and the number of companies in each headquarter.\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 company (main_industry VARCHAR, market_value INTEGER) Question: Show all main industry and total market value in each industry. Here is the SQLite query to answer to the...
Your provided SQLite query is correctly structured to answer the question. It groups the entries by `main_industry` and calculates the total `market_value` for each industry. Here is the query wrapped in code format for clarity: ``` SELECT main_industry, SUM(market_value) FROM company GROUP BY main_industry; ```
1,197
[ { "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 company (main_industry VARCHAR, market_value INTEGER)\n\n Question: Show all main industry and total market value in each industry...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (main_industry VARCHAR, market_value INTEGER) Question: List the main industry with highest total market value and its number of companies. Here is the SQLite qu...
Your query is almost correct, but you need to sum the market values within the `ORDER BY` clause. Additionally, you should select both the summed market value and the company count for clarity. Here's the corrected version of the SQLite query: ``` SELECT main_industry, COUNT(*) AS number_of_companies, SUM(market_value...
1,198
[ { "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 company (main_industry VARCHAR, market_value INTEGER)\n\n Question: List the main industry with highest total market value and its...
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```: Schema: CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR) Question: Show headquarters with at least two companies in the banking industry. Here is the SQLite query to answer...
Your SQLite query to retrieve headquarters with at least two companies in the banking industry is correct. Here it is, properly formatted: ``` SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING COUNT(*) >= 2 ``` This query selects the `headquarters` from the `company` table...
1,199
[ { "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 company (headquarters VARCHAR, main_industry VARCHAR)\n\n Question: Show headquarters with at least two companies in the banking i...