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 orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Question: What is the name of the customer who has the most orders?
Her... | Your SQLite query to find the name of the customer who has the most orders is correct. Here it is wrapped in the requested code format:
```
SELECT T1.customer_name
FROM customers AS T1
JOIN orders AS T2 ON T1.customer_id = T2.customer_id
GROUP BY T1.customer_id
ORDER BY COUNT(*) DESC
LIMIT 1
``` | 3,900 | [
{
"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 orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)\n\n Question: What is the name o... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR)
Question: What is the customer id of the customer who has the most orders?
Here is the SQLite ... | Your SQLite query to find the customer ID of the customer who has the most orders is correct. Here it is wrapped properly:
```
SELECT T1.customer_id
FROM customers AS T1
JOIN orders AS T2 ON T1.customer_id = T2.customer_id
GROUP BY T1.customer_id
ORDER BY COUNT(*) DESC
LIMIT 1;
```
This query joins the `custome... | 3,901 | [
{
"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 (customer_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR)\n\n Question: What is the customer id of the customer w... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (order_id VARCHAR, order_status VARCHAR, customer_id VARCHAR)
Question: Give me a list of id a... | Here is the SQLite query you requested:
```
SELECT T2.order_id, T2.order_status
FROM customers AS T1
JOIN orders AS T2 ON T1.customer_id = T2.customer_id
WHERE T1.customer_name = "Jeramie"
``` | 3,902 | [
{
"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 (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (order_id VARCHAR, order_status VARCHAR, customer_id VARC... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (date_order_placed VARCHAR, customer_id VARCHAR)
Question: Find the dates of orders which belo... | Here is the SQLite query to find the dates of orders which belong to the customer named "Jeramie":
```
SELECT T2.date_order_placed FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
``` | 3,903 | [
{
"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 (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (date_order_placed VARCHAR, customer_id VARCHAR)\n\n Q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE orders (customer_id VARCHAR, date_order_placed VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Question: Give me the names of customers who ... | Here is the correct SQLite query to answer the question:
```
SELECT T1.customer_name
FROM customers AS T1
JOIN orders AS T2 ON T1.customer_id = T2.customer_id
WHERE T2.date_order_placed >= "2009-01-01" AND T2.date_order_placed < "2010-01-01";
```
Note that I changed the upper bound of the date condition to `< "20... | 3,904 | [
{
"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 orders (customer_id VARCHAR, date_order_placed VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)\n\n Q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE order_items (product_id VARCHAR, order_id VARCHAR); CREATE TABLE orders (order_id VARCHAR, date_order_placed VARCHAR)
Question: Give me a list of distinct product ids fro... | Here is the SQLite query to answer the question: Give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01:
```
SELECT DISTINCT T2.product_id
FROM orders AS T1
JOIN order_items AS T2 ON T1.order_id = T2.order_id
WHERE T1.date_order_placed >= "1975-01-01" AND T1.date_order_placed < ... | 3,905 | [
{
"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 order_items (product_id VARCHAR, order_id VARCHAR); CREATE TABLE orders (order_id VARCHAR, date_order_placed VARCHAR)\n\n Question... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE orders (customer_id VARCHAR, order_status VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Question: Find the names of the customers who have... | Here is the SQLite query to find the names of the customers who have order status both "On Road" and "Shipped":
```sql
SELECT T1.customer_name
FROM customers AS T1
JOIN orders AS T2 ON T1.customer_id = T2.customer_id
WHERE T2.order_status = "On Road"
INTERSECT
SELECT T1.customer_name
FROM customers AS T1
JOIN o... | 3,906 | [
{
"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 orders (customer_id VARCHAR, order_status VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_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 customers (customer_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR, order_status VARCHAR)
Question: Find the id of the customers who have order status both "On Roa... | Here is the SQLite query to find the id of customers who have order status both "On Road" and "Shipped":
```
SELECT T1.customer_id
FROM orders AS T1
WHERE T1.order_status = 'On Road'
INTERSECT
SELECT T2.customer_id
FROM orders AS T2
WHERE T2.order_status = 'Shipped';
```
This query selects customer IDs from th... | 3,907 | [
{
"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 (customer_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR, order_status VARCHAR)\n\n Question: Find the id of the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE shipments (order_id VARCHAR, shipment_tracking_number VARCHAR); CREATE TABLE orders (date_order_placed VARCHAR, order_id VARCHAR)
Question: When was the order placed whos... | Your query is correctly structured to retrieve the date an order was placed based on a specific shipment tracking number. However, I noticed there is a small detail in the condition: the shipment tracking number should be enclosed in single quotes since it is a string. Here’s the refined version of your SQLite query:
... | 3,908 | [
{
"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 shipments (order_id VARCHAR, shipment_tracking_number VARCHAR); CREATE TABLE orders (date_order_placed VARCHAR, order_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 orders (date_order_placed VARCHAR, order_id VARCHAR); CREATE TABLE shipments (order_id VARCHAR, invoice_number VARCHAR)
Question: What is the placement date of the order ... | Here's the SQLite query to answer the question about the placement date of the order whose invoice number is 10:
```
SELECT T1.date_order_placed
FROM orders AS T1
JOIN shipments AS T2 ON T1.order_id = T2.order_id
WHERE T2.invoice_number = '10'
``` | 3,909 | [
{
"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 orders (date_order_placed VARCHAR, order_id VARCHAR); CREATE TABLE shipments (order_id VARCHAR, invoice_number 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 orders (order_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR); CREATE TABLE products (product_id VARCHAR)
Question: List the count and id of ... | Your SQLite query looks mostly correct, but to ensure clarity and to specify the join conditions properly with explicit JOIN syntax, I've slightly reformatted it. Here’s the adjusted query wrapped as requested:
```sql
SELECT COUNT(*) AS product_count, T3.product_id
FROM orders AS T1
JOIN order_items AS T2 ON T1.orde... | 3,910 | [
{
"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 orders (order_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR); CREATE TABLE products (product_id VARCHAR... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE orders (order_id VARCHAR); CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR)
Question: Lis... | Here is the SQLite query to answer the question: List the name and count of each product in all orders:
```
SELECT T3.product_name, COUNT(*) AS product_count
FROM orders AS T1
JOIN order_items AS T2 ON T1.order_id = T2.order_id
JOIN products AS T3 ON T2.product_id = T3.product_id
GROUP BY T3.product_id, T3.product_nam... | 3,911 | [
{
"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 orders (order_id VARCHAR); CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE order_items (order_id VARCH... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE shipments (order_id VARCHAR, shipment_date INTEGER)
Question: Find the ids of orders which are shipped after 2000-01-01.
Here is the SQLite query to answer to the questi... | Here is the corrected SQLite query to find the IDs of orders which are shipped after 2000-01-01:
```sql
SELECT order_id FROM shipments WHERE shipment_date > strftime('%s', '2000-01-01');
```
In this query, we use `strftime` to convert the date string '2000-01-01' into a timestamp (in seconds since the epoch) for prop... | 3,912 | [
{
"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 shipments (order_id VARCHAR, shipment_date INTEGER)\n\n Question: Find the ids of orders which are shipped after 2000-01-01.\n\nHe... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE shipments (order_id VARCHAR, shipment_date INTEGER)
Question: Find the id of the order which is shipped most recently.
Here is the SQLite query to answer to the question... | Your SQLite query is correct for finding the id of the order that was shipped most recently. Here it is wrapped as per your request:
```
SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments)
``` | 3,913 | [
{
"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 shipments (order_id VARCHAR, shipment_date INTEGER)\n\n Question: Find the id of the order which is shipped most recently.\n\nHere... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE products (product_name VARCHAR)
Question: List the names of all distinct products in alphabetical order.
Here is the SQLite query to answer to the question: List the nam... | Here is the SQLite query to list the names of all distinct products in alphabetical order:
```
SELECT DISTINCT product_name FROM products ORDER BY product_name;
``` | 3,914 | [
{
"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 (product_name VARCHAR)\n\n Question: List the names of all distinct products in alphabetical order.\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 orders (order_id VARCHAR, date_order_placed VARCHAR)
Question: List the ids of all distinct orders ordered by placed date.
Here is the SQLite query to answer to the ques... | Your provided SQLite query looks good, but it needs a slight correction: since you're ordering by `date_order_placed`, ensure that the column type is suitable for sorting dates. If `date_order_placed` is stored as a string, it should follow a format that allows string comparison to correctly reflect chronological order... | 3,915 | [
{
"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 orders (order_id VARCHAR, date_order_placed VARCHAR)\n\n Question: List the ids of all distinct orders ordered by placed date.\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE orders (order_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR)
Question: What is the id of the order which has the most items?
Here is the SQLite query to answer... | Your SQLite query to find the order ID with the most items is correct. Here it is wrapped in a code block for clarity:
```sql
SELECT T1.order_id
FROM orders AS T1
JOIN order_items AS T2 ON T1.order_id = T2.order_id
GROUP BY T1.order_id
ORDER BY COUNT(*) DESC
LIMIT 1;
```
This query does the following:
- It join... | 3,916 | [
{
"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 orders (order_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR)\n\n Question: What is the id of the order which has the mos... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE invoices (invoice_number VARCHAR, invoice_date VARCHAR)
Question: Find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.
Here is the SQLite qu... | Here is the SQLite query to find the invoice numbers which are created before 1989-09-03 or after 2007-12-25:
```
SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
``` | 3,917 | [
{
"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 invoices (invoice_number VARCHAR, invoice_date VARCHAR)\n\n Question: Find the invoice numbers which are created before 1989-09-03... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE invoices (invoice_details VARCHAR, invoice_date VARCHAR)
Question: Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.
Here is... | Here is the SQLite query to find the distinct details of invoices created before 1989-09-03 or after 2007-12-25:
```sql
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
``` | 3,918 | [
{
"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 invoices (invoice_details VARCHAR, invoice_date VARCHAR)\n\n Question: Find the distinct details of invoices which are created bef... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Question: For each customer who has at least two orders, find the custom... | Your SQLite query is correctly structured to achieve the desired results. Here is the formatted SQL code:
```
SELECT T2.customer_name, COUNT(*)
FROM orders AS T1
JOIN customers AS T2 ON T1.customer_id = T2.customer_id
GROUP BY T2.customer_id
HAVING COUNT(*) >= 2
```
This query joins the `orders` table with the `... | 3,919 | [
{
"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 orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)\n\n Question: For each customer ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Question: Find the name of the customers who have at most two orders.
H... | Here is the SQLite query to find the name of the customers who have at most two orders:
```
SELECT T2.customer_name
FROM orders AS T1
JOIN customers AS T2 ON T1.customer_id = T2.customer_id
GROUP BY T2.customer_id
HAVING COUNT(*) <= 2;
``` | 3,920 | [
{
"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 orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_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 products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR, order_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VA... | Here is the SQLite query to answer the question: List the names of the customers who have once bought product "food":
```
SELECT T1.customer_name
FROM customers AS T1
JOIN orders AS T2 ON T1.customer_id = T2.customer_id
JOIN order_items AS T3 ON T2.order_id = T3.order_id
JOIN products AS T4 ON T3.product_id = T4.p... | 3,921 | [
{
"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 (product_name VARCHAR, product_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR, order_id VARCHAR); CREATE TABLE custom... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE orders (customer_id VARCHAR, order_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VA... | Here's the SQLite query to list the names of customers who have once canceled the purchase of the product "food" (where the item status is "Cancel"):
```sql
SELECT T1.customer_name
FROM customers AS T1
JOIN orders AS T2 ON T1.customer_id = T2.customer_id
JOIN order_items AS T3 ON T2.order_id = T3.order_id
JOIN product... | 3,922 | [
{
"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 orders (customer_id VARCHAR, order_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE pro... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE architect (gender VARCHAR)
Question: How many architects are female?
Here is the SQLite query to answer to the question: How many architects are female?:
```
SELECT COUN... | Here is the SQLite query to answer the question of how many architects are female:
```
SELECT COUNT(*) FROM architect WHERE gender = 'female';
``` | 3,923 | [
{
"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 architect (gender VARCHAR)\n\n Question: How many architects are female?\n\nHere is the SQLite query to answer to the question: Ho... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE architect (name VARCHAR, nationality VARCHAR, id VARCHAR, gender VARCHAR)
Question: List the name, nationality and id of all male architects ordered by their names lexico... | Your SQLite query to list the name, nationality, and id of all male architects ordered by their names lexicographically is correct.
Here it is wrapped in the specified format:
```
SELECT name, nationality, id FROM architect WHERE gender = 'male' ORDER BY name
``` | 3,924 | [
{
"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 architect (name VARCHAR, nationality VARCHAR, id VARCHAR, gender VARCHAR)\n\n Question: List the name, nationality and id of all m... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE architect (name VARCHAR, id VARCHAR); CREATE TABLE bridge (length_meters INTEGER, architect_id VARCHAR)
Question: What is the maximum length in meters for the bridges and... | The SQLite query you provided will successfully retrieve the maximum bridge length along with the corresponding architect's name. However, it will return multiple rows if multiple architects have bridges of the same maximum length, which may not be the desired behavior. To get just one row with the maximum length and o... | 3,925 | [
{
"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 architect (name VARCHAR, id VARCHAR); CREATE TABLE bridge (length_meters INTEGER, architect_id VARCHAR)\n\n Question: What is the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE bridge (length_feet INTEGER)
Question: What is the average length in feet of the bridges?
Here is the SQLite query to answer to the question: What is the average length ... | Your query to calculate the average length in feet of the bridges is correct. Here it is wrapped in the requested formatting:
```
SELECT AVG(length_feet) FROM bridge;
``` | 3,926 | [
{
"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 bridge (length_feet INTEGER)\n\n Question: What is the average length in feet of the bridges?\n\nHere is the SQLite query to answe... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE mill (name VARCHAR, built_year VARCHAR, TYPE VARCHAR)
Question: What are the names and year of construction for the mills of 'Grondzeiler' type?
Here is the SQLite query... | Here is the SQLite query to answer the question about the names and year of construction for the mills of 'Grondzeiler' type:
```sql
SELECT name, built_year FROM mill WHERE TYPE = 'Grondzeiler'
``` | 3,927 | [
{
"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 mill (name VARCHAR, built_year VARCHAR, TYPE VARCHAR)\n\n Question: What are the names and year of construction for the mills of '... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE mill (Id VARCHAR); CREATE TABLE architect (name VARCHAR, nationality VARCHAR, id VARCHAR)
Question: What are the distinct names and nationalities of the architects who ha... | Your provided query seems to have a small issue since the `mill` table does not have an `architect_id` column in the schema you provided. Assuming the `mill` table should relate to the `architect` table, I will proceed with a modified assumption that the `mill` table should include a reference to the architect's id.
I... | 3,928 | [
{
"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 mill (Id VARCHAR); CREATE TABLE architect (name VARCHAR, nationality VARCHAR, id VARCHAR)\n\n Question: What are the distinct name... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE mill (name VARCHAR, LOCATION VARCHAR)
Question: What are the names of the mills which are not located in 'Donceel'?
Here is the SQLite query to answer to the question: W... | Here is the SQLite query to find the names of the mills that are not located in 'Donceel':
```
SELECT name FROM mill WHERE LOCATION <> 'Donceel'
``` | 3,929 | [
{
"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 mill (name VARCHAR, LOCATION VARCHAR)\n\n Question: What are the names of the mills which are not located in 'Donceel'?\n\nHere is... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE architect (Id VARCHAR); CREATE TABLE mill (type VARCHAR, architect_id VARCHAR)
Question: What are the distinct types of mills that are built by American or Canadian archi... | It looks like your SQL query is almost correct, but there is a small issue. The `architect` table as per the provided schema does not include a `nationality` column. To execute your query properly, that column must be defined in the `architect` table. Assuming the `nationality` column exists, the query should look like... | 3,930 | [
{
"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 architect (Id VARCHAR); CREATE TABLE mill (type VARCHAR, architect_id VARCHAR)\n\n Question: What are the distinct types of mills ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE architect (id VARCHAR, name VARCHAR); CREATE TABLE bridge (architect_id VARCHAR)
Question: What are the ids and names of the architects who built at least 3 bridges ?
He... | Here is the SQLite query to answer the question regarding the ids and names of the architects who built at least 3 bridges:
```
SELECT T1.id, T1.name
FROM architect AS T1
JOIN bridge AS T2 ON T1.id = T2.architect_id
GROUP BY T1.id
HAVING COUNT(*) >= 3
``` | 3,931 | [
{
"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 architect (id VARCHAR, name VARCHAR); CREATE TABLE bridge (architect_id VARCHAR)\n\n Question: What are the ids and names of the a... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE architect (id VARCHAR, name VARCHAR, nationality VARCHAR); CREATE TABLE mill (architect_id VARCHAR)
Question: What is the id, name and nationality of the architect who bu... | Here is the SQLite query to answer the question regarding the architect who built the most mills:
```
SELECT T1.id, T1.name, T1.nationality
FROM architect AS T1
JOIN mill AS T2 ON T1.id = T2.architect_id
GROUP BY T1.id, T1.name, T1.nationality
ORDER BY COUNT(T2.architect_id) DESC
LIMIT 1;
``` | 3,932 | [
{
"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 architect (id VARCHAR, name VARCHAR, nationality VARCHAR); CREATE TABLE mill (architect_id VARCHAR)\n\n Question: What is the id, ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE mill (architect_id VARCHAR); CREATE TABLE architect (id VARCHAR, name VARCHAR, gender VARCHAR); CREATE TABLE bridge (architect_id VARCHAR)
Question: What are the ids, nam... | Here's the SQLite query that retrieves the ids, names, and genders of architects who built two bridges or one mill, according to the specified database schema:
```
SELECT T1.id, T1.name, T1.gender
FROM architect AS T1
JOIN bridge AS T2 ON T1.id = T2.architect_id
GROUP BY T1.id
HAVING COUNT(*) = 2
UNION
SELECT T1... | 3,933 | [
{
"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 mill (architect_id VARCHAR); CREATE TABLE architect (id VARCHAR, name VARCHAR, gender VARCHAR); CREATE TABLE bridge (architect_id VAR... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE bridge (LOCATION VARCHAR, name VARCHAR)
Question: What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?
Here is the SQLite query to answer to the qu... | Your provided SQLite query is correct for retrieving the locations of the bridges named 'Kolob Arch' or 'Rainbow Bridge'. Here is the wrapped code as requested:
```
SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge';
``` | 3,934 | [
{
"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 bridge (LOCATION VARCHAR, name VARCHAR)\n\n Question: What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE mill (name VARCHAR)
Question: Which of the mill names contains the french word 'Moulin'?
Here is the SQLite query to answer to the question: Which of the mill names cont... | Sure! Here is the SQLite query to find mill names that contain the French word 'Moulin':
```sql
SELECT name FROM mill WHERE name LIKE '%Moulin%';
``` | 3,935 | [
{
"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 mill (name VARCHAR)\n\n Question: Which of the mill names contains the french word 'Moulin'?\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 architect (Id VARCHAR); CREATE TABLE mill (name VARCHAR, architect_id VARCHAR); CREATE TABLE bridge (architect_id VARCHAR, length_meters INTEGER)
Question: What are the d... | Here is the SQLite query to answer the question:
```
SELECT DISTINCT T1.name
FROM mill AS T1
JOIN architect AS T2 ON T1.architect_id = T2.id
JOIN bridge AS T3 ON T3.architect_id = T2.id
WHERE T3.length_meters > 80;
``` | 3,936 | [
{
"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 architect (Id VARCHAR); CREATE TABLE mill (name VARCHAR, architect_id VARCHAR); CREATE TABLE bridge (architect_id VARCHAR, length_met... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE mill (TYPE VARCHAR)
Question: What is the most common mill type, and how many are there?
Here is the SQLite query to answer to the question: What is the most common mill... | Your query to find the most common mill type and the count of that type looks correct. Here is the formatted query wrapped in code tags:
```sql
SELECT TYPE, COUNT(*)
FROM mill
GROUP BY TYPE
ORDER BY COUNT(*) DESC
LIMIT 1;
```
This query will give you the mill type that occurs the most frequently in the `mill` ta... | 3,937 | [
{
"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 mill (TYPE VARCHAR)\n\n Question: What is the most common mill type, and how many are 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 mill (id VARCHAR, architect_id VARCHAR, built_year INTEGER); CREATE TABLE architect (id VARCHAR, architect_id VARCHAR, built_year INTEGER)
Question: How many architects h... | The SQLite query you provided looks mostly correct, but there is a small error in the architecture table attribute names. The column for the architect id in the architect table should just refer to `id`.
Here’s the corrected query formatted properly:
```
SELECT COUNT(*)
FROM architect
WHERE id NOT IN (SELECT archi... | 3,938 | [
{
"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 mill (id VARCHAR, architect_id VARCHAR, built_year INTEGER); CREATE TABLE architect (id VARCHAR, architect_id VARCHAR, built_year INT... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE bridge (name VARCHAR, architect_id VARCHAR, length_feet VARCHAR); CREATE TABLE architect (id VARCHAR, nationality VARCHAR)
Question: show the name of all bridges that was... | Here is the SQLite query to answer the question about showing the names of all bridges designed by American architects, sorted by the bridge length in feet:
```
SELECT t1.name
FROM bridge AS t1
JOIN architect AS t2 ON t1.architect_id = t2.id
WHERE t2.nationality = 'American'
ORDER BY t1.length_feet;
``` | 3,939 | [
{
"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 bridge (name VARCHAR, architect_id VARCHAR, length_feet VARCHAR); CREATE TABLE architect (id VARCHAR, nationality VARCHAR)\n\n Que... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE book_club (Id VARCHAR)
Question: How many book clubs are there?
Here is the SQLite query to answer to the question: How many book clubs are there?:
```
SELECT COUNT(*) F... | Here is the SQLite query to answer the question: How many book clubs are there?:
```
SELECT COUNT(*) FROM book_club
``` | 3,940 | [
{
"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 book_club (Id VARCHAR)\n\n Question: How many book clubs 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 book_club (book_title VARCHAR, author_or_editor VARCHAR, YEAR INTEGER)
Question: show the titles, and authors or editors for all books made after the year 1989.
Here is ... | Here is the SQLite query to answer the question:
```
SELECT book_title, author_or_editor FROM book_club WHERE YEAR > 1989
``` | 3,941 | [
{
"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 book_club (book_title VARCHAR, author_or_editor VARCHAR, YEAR INTEGER)\n\n Question: show the titles, and authors or editors for a... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE book_club (publisher VARCHAR)
Question: Show all distinct publishers for books.
Here is the SQLite query to answer to the question: Show all distinct publishers for book... | Here is the SQLite query to show all distinct publishers for books:
```
SELECT DISTINCT publisher FROM book_club;
``` | 3,942 | [
{
"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 book_club (publisher VARCHAR)\n\n Question: Show all distinct publishers for books.\n\nHere is the SQLite query to answer to the q... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE book_club (YEAR VARCHAR, book_title VARCHAR, publisher VARCHAR)
Question: Show the years, book titles, and publishers for all books, in descending order by year.
Here is... | Here is the SQLite query to answer the question, formatted as requested:
```
SELECT YEAR, book_title, publisher FROM book_club ORDER BY YEAR DESC;
``` | 3,943 | [
{
"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 book_club (YEAR VARCHAR, book_title VARCHAR, publisher VARCHAR)\n\n Question: Show the years, book titles, and publishers for all ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE book_club (publisher VARCHAR)
Question: Show all publishers and the number of books for each publisher.
Here is the SQLite query to answer to the question: Show all publ... | Here is the SQLite query to show all publishers and the number of books for each publisher, wrapped in the requested format:
```
SELECT publisher, COUNT(*) AS number_of_books FROM book_club GROUP BY publisher;
``` | 3,944 | [
{
"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 book_club (publisher VARCHAR)\n\n Question: Show all publishers and the number of books for each publisher.\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 book_club (publisher VARCHAR)
Question: What is the publisher with most number of books?
Here is the SQLite query to answer to the question: What is the publisher with m... | Your SQLite query is almost correct for finding the publisher with the most number of books. However, it assumes that the `book_club` table directly contains a count of books per publisher, which may not be the case given your schema.
If we assume there could be another table that records book information (for instan... | 3,945 | [
{
"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 book_club (publisher VARCHAR)\n\n Question: What is the publisher with most number of books?\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 book_club (category VARCHAR)
Question: Show all book categories and the number of books in each category.
Here is the SQLite query to answer to the question: Show all bo... | Here is the SQLite query to answer the question you provided:
```
SELECT category, COUNT(*) AS number_of_books FROM book_club GROUP BY category
``` | 3,946 | [
{
"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 book_club (category VARCHAR)\n\n Question: Show all book categories and the number of books in each category.\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 book_club (category VARCHAR, YEAR INTEGER)
Question: List categories that have at least two books after year 1989.
Here is the SQLite query to answer to the question: Li... | Here is the SQLite query to answer the question:
```
SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING COUNT(*) >= 2
``` | 3,947 | [
{
"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 book_club (category VARCHAR, YEAR INTEGER)\n\n Question: List categories that have at least two books after year 1989.\n\nHere is ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE book_club (publisher VARCHAR, YEAR VARCHAR)
Question: Show publishers with a book published in 1989 and a book in 1990.
Here is the SQLite query to answer to the questio... | Here is the SQLite query to answer the question: Show publishers with a book published in 1989 and a book in 1990:
```sql
SELECT publisher
FROM book_club
WHERE YEAR = '1989'
INTERSECT
SELECT publisher
FROM book_club
WHERE YEAR = '1990';
``` | 3,948 | [
{
"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 book_club (publisher VARCHAR, YEAR VARCHAR)\n\n Question: Show publishers with a book published in 1989 and a book in 1990.\n\nHer... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE book_club (publisher VARCHAR, YEAR VARCHAR)
Question: Show all publishers which do not have a book in 1989.
Here is the SQLite query to answer to the question: Show all ... | Your SQLite query to find all publishers which do not have a book in 1989 is correct. Here it is again wrapped in the appropriate code block:
```
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = '1989';
```
This query uses the `EXCEPT` operator to return all publishers from the `bo... | 3,949 | [
{
"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 book_club (publisher VARCHAR, YEAR VARCHAR)\n\n Question: Show all publishers which do not have a book in 1989.\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 movie (title VARCHAR, YEAR VARCHAR, director VARCHAR, budget_million VARCHAR)
Question: Show all movie titles, years, and directors, ordered by budget.
Here is the SQLit... | Here is the corrected SQLite query to show all movie titles, years, and directors, ordered by budget:
```
SELECT title, YEAR, director FROM movie ORDER BY budget_million ASC;
```
Make sure to use `ASC` to specify the ascending order if needed, although it is the default order. | 3,950 | [
{
"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 VARCHAR, director VARCHAR, budget_million VARCHAR)\n\n Question: Show all movie titles, years, and 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: How many movie directors are there?
Here is the SQLite query to answer to the question: How many movie directors are there?:
```
SELEC... | Your provided SQLite query is correct to count the number of distinct movie directors in the `movie` table. Here it is wrapped as you requested:
```
SELECT COUNT(DISTINCT director) FROM movie;
``` | 3,951 | [
{
"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: How many movie directors are there?\n\nHere is the SQLite query to answer to the question: ... | |
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, gross_worldwide VARCHAR)
Question: What is the title and director for the movie with highest worldwide gross in the ... | The provided SQLite query is almost correct, but it needs to account for the fact that the `gross_worldwide` column is stored as a `VARCHAR`, which means you need to convert it to a numeric type for proper ordering. Here is the corrected query:
```sql
SELECT title, director
FROM movie
WHERE YEAR <= '2000'
ORDER BY ... | 3,952 | [
{
"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, gross_worldwide VARCHAR)\n\n Question: What is the title and director for th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE movie (director VARCHAR, YEAR VARCHAR)
Question: Show all director names who have a movie in both year 1999 and 2000.
Here is the SQLite query to answer to the question:... | Your SQLite query is correct and effectively retrieves the names of directors who have movies in both 1999 and 2000. Here’s the query wrapped in code formatting:
```
SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999;
```
This query uses the `INTERSECT` operator to re... | 3,953 | [
{
"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, YEAR VARCHAR)\n\n Question: Show all director names who have a movie in both year 1999 and 2000.\n\nHere ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE movie (director VARCHAR, YEAR VARCHAR)
Question: Show all director names who have a movie in the year 1999 or 2000.
Here is the SQLite query to answer to the question: S... | Here is the correct SQLite query to show all director names who have a movie in the year 1999 or 2000:
```
SELECT director FROM movie WHERE YEAR IN ('1999', '2000');
```
This query utilizes the `IN` clause which is a more concise way to express the condition for multiple values. Note that the `YEAR` values are treat... | 3,954 | [
{
"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, YEAR VARCHAR)\n\n Question: Show all director names who have a movie in the year 1999 or 2000.\n\nHere is... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE movie (budget_million INTEGER, YEAR INTEGER)
Question: What is the average, maximum, and minimum budget for all movies before 2000.
Here is the SQLite query to answer to... | Here is the SQLite query to answer the question regarding the average, maximum, and minimum budget for all movies before 2000:
```
SELECT AVG(budget_million) AS average_budget, MAX(budget_million) AS maximum_budget, MIN(budget_million) AS minimum_budget
FROM movie
WHERE YEAR < 2000;
``` | 3,955 | [
{
"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 (budget_million INTEGER, YEAR INTEGER)\n\n Question: What is the average, maximum, and minimum budget for all movies before ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE culture_company (company_name VARCHAR, book_club_id VARCHAR); CREATE TABLE book_club (book_club_id VARCHAR, publisher VARCHAR)
Question: List all company names with a boo... | Here is the SQLite query to answer the question: List all company names with a book published by Alyson:
```
SELECT T1.company_name
FROM culture_company AS T1
JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id
WHERE T2.publisher = 'Alyson'
``` | 3,956 | [
{
"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 culture_company (company_name VARCHAR, book_club_id VARCHAR); CREATE TABLE book_club (book_club_id VARCHAR, publisher VARCHAR)\n\n ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE movie (title VARCHAR, movie_id VARCHAR); CREATE TABLE culture_company (movie_id VARCHAR, book_club_id VARCHAR, incorporated_in VARCHAR); CREATE TABLE book_club (book_title VAR... | Here is the SQLite query to answer the question: Show the movie titles and book titles for all companies in China:
```
SELECT T1.title, T3.book_title
FROM movie AS T1
JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id
JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id
WHERE T2.incorporated_in = 'China'... | 3,957 | [
{
"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, movie_id VARCHAR); CREATE TABLE culture_company (movie_id VARCHAR, book_club_id VARCHAR, incorporated_in VARCHA... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE movie (movie_id VARCHAR, year VARCHAR); CREATE TABLE culture_company (company_name VARCHAR, movie_id VARCHAR)
Question: Show all company names with a movie directed in ye... | Certainly! Here is the SQLite query wrapped in the appropriate code block:
```
SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = '1999'
``` | 3,958 | [
{
"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 (movie_id VARCHAR, year VARCHAR); CREATE TABLE culture_company (company_name VARCHAR, movie_id VARCHAR)\n\n Question: Show a... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (Id VARCHAR)
Question: How many singers do we have?
Here is the SQLite query to answer to the question: How many singers do we have?:
```
SELECT COUNT(*) FROM sin... | Here is the SQLite query to answer the question "How many singers do we have?":
```
SELECT COUNT(*) FROM singer;
``` | 3,959 | [
{
"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 singer (Id VARCHAR)\n\n Question: How many singers do we have?\n\nHere is the SQLite query to answer to the question: How many sin... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (name VARCHAR, country VARCHAR, age VARCHAR)
Question: Show name, country, age for all singers ordered by age from the oldest to the youngest.
Here is the SQLite ... | Here is the SQLite query to answer the question you provided:
```
SELECT name, country, age FROM singer ORDER BY age DESC
``` | 3,960 | [
{
"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 singer (name VARCHAR, country VARCHAR, age VARCHAR)\n\n Question: Show name, country, age for all singers ordered by age from the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (age INTEGER, country VARCHAR)
Question: What is the average, minimum, and maximum age of all singers from France?
Here is the SQLite query to answer to the quest... | Here is the SQLite query to answer the question about the average, minimum, and maximum age of all singers from France:
```
SELECT AVG(age) AS average_age, MIN(age) AS minimum_age, MAX(age) AS maximum_age FROM singer WHERE country = 'France'
``` | 3,961 | [
{
"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 singer (age INTEGER, country VARCHAR)\n\n Question: What is the average, minimum, and maximum age of all singers from France?\n\nH... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (song_name VARCHAR, song_release_year VARCHAR, age VARCHAR)
Question: Show the name and the release year of the song by the youngest singer.
Here is the SQLite qu... | Here is the SQLite query to show the name and the release year of the song by the youngest singer:
```
SELECT song_name, song_release_year FROM singer ORDER BY age ASC LIMIT 1
``` | 3,962 | [
{
"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 singer (song_name VARCHAR, song_release_year VARCHAR, age VARCHAR)\n\n Question: Show the name and the release year of the song by... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (country VARCHAR, age INTEGER)
Question: What are all distinct countries where singers above age 20 are from?
Here is the SQLite query to answer to the question: ... | Here is the SQLite query to answer the question regarding distinct countries where singers above age 20 are from:
```
SELECT DISTINCT country FROM singer WHERE age > 20
``` | 3,963 | [
{
"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 singer (country VARCHAR, age INTEGER)\n\n Question: What are all distinct countries where singers above age 20 are from?\n\nHere i... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (country VARCHAR)
Question: Show all countries and the number of singers in each country.
Here is the SQLite query to answer to the question: Show all countries a... | Here is the SQLite query to answer the question "Show all countries and the number of singers in each country.":
```
SELECT country, COUNT(*) FROM singer GROUP BY country
``` | 3,964 | [
{
"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 singer (country VARCHAR)\n\n Question: Show all countries and the number of singers in each country.\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 singer (song_name VARCHAR, age INTEGER)
Question: List all song names by singers above the average age.
Here is the SQLite query to answer to the question: List all song... | Here is the SQLite query to list all song names by singers above the average age:
```
SELECT song_name FROM singer WHERE age > (SELECT AVG(age) FROM singer);
``` | 3,965 | [
{
"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 singer (song_name VARCHAR, age INTEGER)\n\n Question: List all song names by singers above the average age.\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 stadium (LOCATION VARCHAR, name VARCHAR, capacity INTEGER)
Question: Show location and name for all stadiums with a capacity between 5000 and 10000.
Here is the SQLite q... | ```sql
SELECT LOCATION, name FROM stadium WHERE capacity BETWEEN 5000 AND 10000;
``` | 3,966 | [
{
"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 stadium (LOCATION VARCHAR, name VARCHAR, capacity INTEGER)\n\n Question: Show location and name for all stadiums with a capacity b... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE stadium (average VARCHAR, capacity INTEGER)
Question: What is the maximum capacity and the average of all stadiums ?
Here is the SQLite query to answer to the question: ... | The SQLite query you provided needs a slight adjustment, as using `average` without any aggregate function will not give you a meaningful result alongside `MAX(capacity)`. You should calculate the average of the capacities. Here’s the correct version of the query that calculates both the maximum capacity and the averag... | 3,967 | [
{
"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 stadium (average VARCHAR, capacity INTEGER)\n\n Question: What is the maximum capacity and the average of all stadiums ?\n\nHere i... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE stadium (capacity INTEGER)
Question: What is the average and maximum capacities for all stadiums ?
Here is the SQLite query to answer to the question: What is the averag... | Here is the SQLite query to calculate the average and maximum capacities for all stadiums:
```
SELECT AVG(capacity) AS average_capacity, MAX(capacity) AS maximum_capacity FROM stadium;
``` | 3,968 | [
{
"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 stadium (capacity INTEGER)\n\n Question: What is the average and maximum capacities for all stadiums ?\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 stadium (name VARCHAR, capacity VARCHAR, average VARCHAR)
Question: What is the name and capacity for the stadium with highest average attendance?
Here is the SQLite que... | Here is the SQLite query to answer the question:
```
SELECT name, capacity FROM stadium ORDER BY average DESC LIMIT 1
``` | 3,969 | [
{
"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 stadium (name VARCHAR, capacity VARCHAR, average VARCHAR)\n\n Question: What is the name and capacity for the stadium with highest... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE concert (YEAR VARCHAR)
Question: How many concerts are there in year 2014 or 2015?
Here is the SQLite query to answer to the question: How many concerts are there in yea... | Your provided SQLite query is almost correct, but since the `YEAR` column is defined as a VARCHAR, you should compare it with string values. Here's the corrected version:
```sql
SELECT COUNT(*) FROM concert WHERE YEAR = '2014' OR YEAR = '2015'
``` | 3,970 | [
{
"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 concert (YEAR VARCHAR)\n\n Question: How many concerts are there in year 2014 or 2015?\n\nHere is the SQLite query to answer to th... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR)
Question: Show the stadium name and the number of concerts in each stadium.
Here is... | Your query is almost correct, but it would be clearer and more consistent if you explicitly count the concerts associated with each stadium while correctly addressing the grouping. Additionally, it would be a good idea to include the stadium name in the `GROUP BY` clause for better readability and to comply with SQL st... | 3,971 | [
{
"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 stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR)\n\n Question: Show the stadium name and the ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, year VARCHAR)
Question: Show the stadium name and capacity with mo... | Here is the SQLite query to show the stadium name and capacity with the most number of concerts in the year 2014 or after:
```sql
SELECT T2.name, T2.capacity
FROM concert AS T1
JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id
WHERE T1.year >= '2014'
GROUP BY T2.stadium_id
ORDER BY COUNT(*) DESC
LIMIT 1;
``` | 3,972 | [
{
"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 stadium (name VARCHAR, capacity VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, year VARCHAR)\n\n Question... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE concert (stadium_id VARCHAR, year INTEGER); CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, stadium_id VARCHAR)
Question: What is the name and capacity of the stadi... | Your SQLite query to find the name and capacity of the stadium with the most concerts after 2013 looks good. Here's the code wrapped correctly:
```
SELECT t2.name, t2.capacity
FROM concert AS t1
JOIN stadium AS t2 ON t1.stadium_id = t2.stadium_id
WHERE t1.year > 2013
GROUP BY t2.stadium_id
ORDER BY COUNT(*) DESC ... | 3,973 | [
{
"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 concert (stadium_id VARCHAR, year INTEGER); CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, stadium_id VARCHAR)\n\n Question... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE concert (YEAR VARCHAR)
Question: Which year has most number of concerts?
Here is the SQLite query to answer to the question: Which year has most number of concerts?:
```... | Your SQLite query is correct for determining which year has the most number of concerts. Here it is wrapped in the requested code block:
```
SELECT YEAR FROM concert GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1
``` | 3,974 | [
{
"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 concert (YEAR VARCHAR)\n\n Question: Which year has most number of concerts?\n\nHere is the SQLite query to answer to the question... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (name VARCHAR, stadium_id VARCHAR)
Question: Show the stadium names without any concert.
Here is the SQL... | Your query is well-structured to find stadium names that do not have any associated concerts. Here’s the SQLite query wrapped in code formatting:
```sql
SELECT name FROM stadium WHERE stadium_id NOT IN (SELECT stadium_id FROM concert);
```
This query selects the names of stadiums from the `stadium` table where the `... | 3,975 | [
{
"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 stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (name VARCHAR, stadium_id VARCHAR)\n\n Question: Show the stadium... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (country VARCHAR, age INTEGER)
Question: Show countries where a singer above age 40 and a singer below 30 are from.
Here is the SQLite query to answer to the ques... | Your provided query uses the `INTERSECT` operator, which is a correct approach to find common countries where there are both singers above age 40 and singers below age 30. However, it's important to clarify that this query will return countries that have both types of singers, which aligns with the question.
Here's th... | 3,976 | [
{
"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 singer (country VARCHAR, age INTEGER)\n\n Question: Show countries where a singer above age 40 and a singer below 30 are from.\n\n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, year VARCHAR); CREATE TABLE stadium (name VARCHAR)
Question: Show names for all stad... | Your SQLite query looks good, but it has a minor issue because the `stadium` table is created twice in the schema definition. Assuming you meant to have a single table, here is the corrected version of your query, properly formatted:
```sql
SELECT name
FROM stadium
WHERE stadium_id NOT IN (
SELECT stadium_id
... | 3,977 | [
{
"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 stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, year VARCHAR); CREATE TABLE stadium (name VARCH... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme VARCHAR, concert_id VARCHAR)
Question: Show the name and theme for all concerts ... | The given SQLite query is almost correct, but it is missing a `GROUP BY` clause that includes the concert name and theme to ensure proper aggregation. Here is the corrected version of the query:
```
SELECT T2.concert_name, T2.theme, COUNT(*) AS singer_count
FROM singer_in_concert AS T1
JOIN concert AS T2 ON T1.conce... | 3,978 | [
{
"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 singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme VARCHAR, concert_id 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 singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme VARCHAR, concert_id VARCHAR)
Question: What are the names , themes , and number ... | Here is the SQLite query to answer the question about the names, themes, and number of singers for every concert:
```
SELECT t2.concert_name, t2.theme, COUNT(*) AS number_of_singers
FROM singer_in_concert AS t1
JOIN concert AS t2 ON t1.concert_id = t2.concert_id
GROUP BY t2.concert_id;
``` | 3,979 | [
{
"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 singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme VARCHAR, concert_id 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 singer_in_concert (singer_id VARCHAR); CREATE TABLE singer (name VARCHAR, singer_id VARCHAR)
Question: List singer names and number of concerts for each singer.
Here is ... | Here is the SQLite query to list singer names and the number of concerts for each singer:
```
SELECT T2.name, COUNT(*) AS concert_count
FROM singer_in_concert AS T1
JOIN singer AS T2 ON T1.singer_id = T2.singer_id
GROUP BY T2.singer_id;
``` | 3,980 | [
{
"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 singer_in_concert (singer_id VARCHAR); CREATE TABLE singer (name VARCHAR, singer_id VARCHAR)\n\n Question: List singer names and n... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer_in_concert (singer_id VARCHAR, concert_id VARCHAR); CREATE TABLE concert (concert_id VARCHAR, year VARCHAR); CREATE TABLE singer (name VARCHAR, singer_id VARCHAR)
... | Here is the SQLite query to answer the question: List all singer names in concerts in year 2014:
```
SELECT T2.name
FROM singer_in_concert AS T1
JOIN singer AS T2 ON T1.singer_id = T2.singer_id
JOIN concert AS T3 ON T1.concert_id = T3.concert_id
WHERE T3.year = '2014';
``` | 3,981 | [
{
"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 singer_in_concert (singer_id VARCHAR, concert_id VARCHAR); CREATE TABLE concert (concert_id VARCHAR, year VARCHAR); CREATE TABLE sing... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE singer (name VARCHAR, country VARCHAR, song_name VARCHAR)
Question: what is the name and nation of the singer who have a song having 'Hey' in its name?
Here is the SQLit... | Your provided SQLite query to retrieve the name and country of the singer who has a song with 'Hey' in its name is correct. Here it is wrapped in code format:
```
SELECT name, country FROM singer WHERE song_name LIKE '%Hey%'
``` | 3,982 | [
{
"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 singer (name VARCHAR, country VARCHAR, song_name VARCHAR)\n\n Question: what is the name and nation of the singer who have a song ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE stadium (name VARCHAR, location VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, Year VARCHAR)
Question: Find the name and location of the stadiums... | Your provided SQLite query correctly addresses the requirement to find the name and location of the stadiums where concerts occurred in both 2014 and 2015. Here’s the query wrapped in the requested formatting:
```
SELECT T2.name, T2.location
FROM concert AS T1
JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id
WHE... | 3,983 | [
{
"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 stadium (name VARCHAR, location VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, Year VARCHAR)\n\n Question... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE concert (stadium_id VARCHAR, capacity VARCHAR); CREATE TABLE stadium (stadium_id VARCHAR, capacity VARCHAR)
Question: Find the number of concerts happened in the stadium ... | Your SQLite query appears to be correct and effectively retrieves the number of concerts that happened in the stadium with the highest capacity. Here it is wrapped in code formatting:
```
SELECT COUNT(*) FROM concert WHERE stadium_id = (SELECT stadium_id FROM stadium ORDER BY capacity DESC LIMIT 1);
```
This query f... | 3,984 | [
{
"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 concert (stadium_id VARCHAR, capacity VARCHAR); CREATE TABLE stadium (stadium_id VARCHAR, capacity 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 pets (weight INTEGER)
Question: Find the number of pets whose weight is heavier than 10.
Here is the SQLite query to answer to the question: Find the number of pets whos... | Here is the SQLite query to find the number of pets whose weight is heavier than 10:
```
SELECT COUNT(*) FROM pets WHERE weight > 10
``` | 3,985 | [
{
"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 pets (weight INTEGER)\n\n Question: Find the number of pets whose weight is heavier than 10.\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 pets (weight VARCHAR, pet_age VARCHAR)
Question: Find the weight of the youngest dog.
Here is the SQLite query to answer to the question: Find the weight of the youngest... | Your SQLite query is almost correct, but it assumes that the pet ages are stored in a way that allows for proper ordering when sorted as strings. If pet_age needs to be treated numerically, you might want to cast it accordingly. However, based on the schema you've provided (where both weight and pet_age are VARCHAR), t... | 3,986 | [
{
"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 pets (weight VARCHAR, pet_age VARCHAR)\n\n Question: Find the weight of the youngest dog.\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 pets (petType VARCHAR, weight INTEGER)
Question: Find the maximum weight for each type of pet. List the maximum weight and pet type.
Here is the SQLite query to answer t... | Your provided SQL query is correct for finding the maximum weight for each type of pet. Here is the query wrapped in code format as you requested:
```
SELECT MAX(weight), petType FROM pets GROUP BY petType
``` | 3,987 | [
{
"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 pets (petType VARCHAR, weight INTEGER)\n\n Question: Find the maximum weight for each type of pet. List the maximum weight and pet... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student (stuid VARCHAR, age INTEGER); CREATE TABLE has_pet (stuid VARCHAR)
Question: Find number of pets owned by students who are older than 20.
Here is the SQLite quer... | ```sql
SELECT COUNT(*)
FROM student AS T1
JOIN has_pet AS T2 ON T1.stuid = T2.stuid
WHERE T1.age > 20;
``` | 3,988 | [
{
"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 student (stuid VARCHAR, age INTEGER); CREATE TABLE has_pet (stuid VARCHAR)\n\n Question: Find number of pets owned by students who... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CREATE TABLE student (stuid VARCHAR, sex VARCHAR)
Question: Find the number of... | Here is the SQLite query to find the number of dog pets that are raised by female students (with sex F):
```
SELECT COUNT(*)
FROM student AS T1
JOIN has_pet AS T2 ON T1.stuid = T2.stuid
JOIN pets AS T3 ON T2.petid = T3.petid
WHERE T1.sex = 'F' AND T3.pettype = 'dog'
``` | 3,989 | [
{
"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 has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CREATE TABLE student (stuid VARCHAR, sex ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE pets (pettype VARCHAR)
Question: Find the number of distinct type of pets.
Here is the SQLite query to answer to the question: Find the number of distinct type of pets.:... | Sure! Here is the SQLite query to find the number of distinct types of pets:
```
SELECT COUNT(DISTINCT pettype) FROM pets;
``` | 3,990 | [
{
"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 pets (pettype VARCHAR)\n\n Question: Find the number of distinct type of pets.\n\nHere is the SQLite query to answer to the questi... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (Fname VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
Question: Find the first n... | Here is the SQLite query to find the first name of students who have either a cat or dog as a pet:
```
SELECT DISTINCT T1.Fname
FROM student AS T1
JOIN has_pet AS T2 ON T1.stuid = T2.stuid
JOIN pets AS T3 ON T3.petid = T2.petid
WHERE T3.pettype IN ('cat', 'dog');
``` | 3,991 | [
{
"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 has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (Fname VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettyp... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student (fname VARCHAR, stuid VARCHAR); CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
Question: Find the first n... | Here is the SQLite query to find the first names of students who have both cat and dog pets:
```
SELECT t1.fname
FROM student AS t1
JOIN has_pet AS t2 ON t1.stuid = t2.stuid
JOIN pets AS t3 ON t3.petid = t2.petid
WHERE t3.pettype = 'cat'
INTERSECT
SELECT t1.fname
FROM student AS t1
JOIN has_pet AS t2 ON t1.stu... | 3,992 | [
{
"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 student (fname VARCHAR, stuid VARCHAR); CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettyp... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (Fname VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
Question: What are the stu... | Here is the SQLite query to find the students' first names who have both cats and dogs as pets:
```sql
SELECT T1.Fname
FROM student AS T1
JOIN has_pet AS T2 ON T1.stuid = T2.stuid
JOIN pets AS T3 ON T3.petid = T2.petid
WHERE T3.pettype = 'cat'
INTERSECT
SELECT T1.Fname
FROM student AS T1
JOIN has_pet AS T2 ON ... | 3,993 | [
{
"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 has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (Fname VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettyp... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE student (stuid VARCHAR); CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CREATE TABLE student (major VARCHAR, age VARC... | Here is the SQLite query to find the major and age of students who do not have a cat pet:
```sql
SELECT major, age
FROM student
WHERE stuid NOT IN (
SELECT T1.stuid
FROM student AS T1
JOIN has_pet AS T2 ON T1.stuid = T2.stuid
JOIN pets AS T3 ON T3.petid = T2.petid
WHERE T3.pettype = 'cat'
);
... | 3,994 | [
{
"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 student (stuid VARCHAR); CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CRE... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CREATE TABLE student (stuid VARCHAR)
Question: Find the id of students who do ... | Here is the SQLite query to find the id of students who do not have a cat pet:
```sql
SELECT stuid FROM student
EXCEPT
SELECT T1.stuid
FROM student AS T1
JOIN has_pet AS T2 ON T1.stuid = T2.stuid
JOIN pets AS T3 ON T3.petid = T2.petid
WHERE T3.pettype = 'cat';
``` | 3,995 | [
{
"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 has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CREATE TABLE student (stuid VARCHAR)\n\n ... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (fname VARCHAR, age VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
Question: Fin... | Here is the SQLite query to find the first name and age of students who have a dog but do not have a cat as a pet:
```
SELECT T1.fname, T1.age
FROM student AS T1
JOIN has_pet AS T2 ON T1.stuid = T2.stuid
JOIN pets AS T3 ON T3.petid = T2.petid
WHERE T3.pettype = 'dog'
AND T1.stuid NOT IN (
SELECT T1.stuid
... | 3,996 | [
{
"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 has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (fname VARCHAR, age VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VA... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE pets (pettype VARCHAR, weight VARCHAR, pet_age VARCHAR)
Question: Find the type and weight of the youngest pet.
Here is the SQLite query to answer to the question: Find ... | Your SQLite query is correctly structured to retrieve the type and weight of the youngest pet from the `pets` table. Here it is wrapped in the specified format:
```
SELECT pettype, weight FROM pets ORDER BY pet_age LIMIT 1
```
This query orders the pets by their age (in ascending order) and limits the result to just... | 3,997 | [
{
"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 pets (pettype VARCHAR, weight VARCHAR, pet_age VARCHAR)\n\n Question: Find the type and weight of the youngest pet.\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 pets (petid VARCHAR, weight VARCHAR, pet_age INTEGER)
Question: Find the id and weight of all pets whose age is older than 1.
Here is the SQLite query to answer to the q... | Here is the SQLite query to find the id and weight of all pets whose age is older than 1:
```
SELECT petid, weight FROM pets WHERE pet_age > 1
``` | 3,998 | [
{
"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 pets (petid VARCHAR, weight VARCHAR, pet_age INTEGER)\n\n Question: Find the id and weight of all pets whose age is older than 1.\... | |
Write SQLite query to answer the following question given the database schema. Please wrap your code answer using ```:
Schema: CREATE TABLE pets (pettype VARCHAR, pet_age INTEGER)
Question: Find the average and maximum age for each type of pet.
Here is the SQLite query to answer to the question: Find the ave... | Your SQLite query to find the average and maximum age for each type of pet is correct. Here it is wrapped properly in code format:
```
SELECT AVG(pet_age) AS average_age, MAX(pet_age) AS maximum_age, pettype
FROM pets
GROUP BY pettype;
```
This query will return the average and maximum age of pets for each distinc... | 3,999 | [
{
"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 pets (pettype VARCHAR, pet_age INTEGER)\n\n Question: Find the average and maximum age for each type of pet.\n\nHere is the SQLite... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.