answer
stringlengths
18
557
context
stringlengths
27
489
question
stringlengths
12
244
text
stringlengths
275
1.7k
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
CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
What is the name of the customer who has the most orders?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer...
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
CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR)
What is the customer id of the customer who has the most orders?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR) [/INST] Base...
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"
CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (order_id VARCHAR, order_status VARCHAR, customer_id VARCHAR)
Give me a list of id and status of orders which belong to the customer named "Jeramie".
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (order_id VARCHAR...
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"
CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (date_order_placed VARCHAR, customer_id VARCHAR)
Find the dates of orders which belong to the customer named "Jeramie".
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE orders (date_order_placed VARCHA...
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"
CREATE TABLE orders (customer_id VARCHAR, date_order_placed VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Give me the names of customers who have placed orders between 2009-01-01 and 2010-01-01.
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE orders (customer_id VARCHAR, date_order_placed VARCHAR);...
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 <= "1976-01-01"
CREATE TABLE order_items (product_id VARCHAR, order_id VARCHAR); CREATE TABLE orders (order_id VARCHAR, date_order_placed VARCHAR)
Give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01?
<s>[INST] Given the following SQL query and context: Query: 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 <= "1976-01-01" Context: CREATE TABLE order_items (product_id VARCHAR, order_id VARCHAR); CR...
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 orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
CREATE TABLE orders (customer_id VARCHAR, order_status VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Find the names of the customers who have order status both "On Road" and "Shipped".
<s>[INST] Given the following SQL query and context: Query: 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 orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_statu...
SELECT T1.customer_id 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_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE orders (customer_id VARCHAR, order_status VARCHAR)
Find the id of the customers who have order status both "On Road" and "Shipped".
<s>[INST] Given the following SQL query and context: Query: SELECT T1.customer_id 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_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = ...
SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.shipment_tracking_number = 3452
CREATE TABLE shipments (order_id VARCHAR, shipment_tracking_number VARCHAR); CREATE TABLE orders (date_order_placed VARCHAR, order_id VARCHAR)
When was the order placed whose shipment tracking number is 3452? Give me the date.
<s>[INST] Given the following SQL query and context: Query: SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.shipment_tracking_number = 3452 Context: CREATE TABLE shipments (order_id VARCHAR, shipment_tracking_number VARCHAR); CREATE TABLE orders (date_order_place...
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
CREATE TABLE orders (date_order_placed VARCHAR, order_id VARCHAR); CREATE TABLE shipments (order_id VARCHAR, invoice_number VARCHAR)
What is the placement date of the order whose invoice number is 10?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE orders (date_order_placed VARCHAR, order_id VARCHAR); CREATE TABLE shipments (order_id VARCHAR, invoice_number VA...
SELECT COUNT(*), T3.product_id FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
CREATE TABLE orders (order_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR); CREATE TABLE products (product_id VARCHAR)
List the count and id of each product in all the orders.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), T3.product_id FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id Context: CREATE TABLE orders (order_id VARCHAR); CREATE TABLE order_items (order_i...
SELECT T3.product_name, COUNT(*) FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
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)
List the name and count of each product in all orders.
<s>[INST] Given the following SQL query and context: Query: SELECT T3.product_name, COUNT(*) FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id Context: CREATE TABLE orders (order_id VARCHAR); CREATE TABLE products (product_...
SELECT order_id FROM shipments WHERE shipment_date > "2000-01-01"
CREATE TABLE shipments (order_id VARCHAR, shipment_date INTEGER)
Find the ids of orders which are shipped after 2000-01-01.
<s>[INST] Given the following SQL query and context: Query: SELECT order_id FROM shipments WHERE shipment_date > "2000-01-01" Context: CREATE TABLE shipments (order_id VARCHAR, shipment_date INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the ids of orders which are shipped after 20...
SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments)
CREATE TABLE shipments (order_id VARCHAR, shipment_date INTEGER)
Find the id of the order which is shipped most recently.
<s>[INST] Given the following SQL query and context: Query: SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments) Context: CREATE TABLE shipments (order_id VARCHAR, shipment_date INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the id of the ...
SELECT DISTINCT product_name FROM products ORDER BY product_name
CREATE TABLE products (product_name VARCHAR)
List the names of all distinct products in alphabetical order.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT product_name FROM products ORDER BY product_name Context: CREATE TABLE products (product_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the names of all distinct products in alphabetical order. The ans...
SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed
CREATE TABLE orders (order_id VARCHAR, date_order_placed VARCHAR)
List the ids of all distinct orders ordered by placed date.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed Context: CREATE TABLE orders (order_id VARCHAR, date_order_placed VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the ids of all distinct orders ordered by pla...
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
CREATE TABLE orders (order_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR)
What is the id of the order which has the most items?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE orders (order_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR) [/INST] Based on the provi...
SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
CREATE TABLE invoices (invoice_number VARCHAR, invoice_date VARCHAR)
Find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.
<s>[INST] Given the following SQL query and context: Query: SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25" Context: CREATE TABLE invoices (invoice_number VARCHAR, invoice_date VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the i...
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
CREATE TABLE invoices (invoice_details VARCHAR, invoice_date VARCHAR)
Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25" Context: CREATE TABLE invoices (invoice_details VARCHAR, invoice_date VARCHAR) [/INST] Based on the provided SQL query and context, your question is:...
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
CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
For each customer who has at least two orders, find the customer name and number of orders made.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer...
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
CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
Find the name of the customers who have at most two orders.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE orders (customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHA...
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id HAVING COUNT(*) >= 1
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 VARCHAR); CREATE TABLE order_items (product_id VARCHAR, order_id VARCHAR)
List the names of the customers who have once bought product "food".
<s>[INST] Given the following SQL query and context: Query: SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id ...
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T3.order_item_status = "Cancel" AND T4.product_name = "food" GROUP BY T1.customer_id HAVING COUNT(*) >= 1
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 VARCHAR); CREATE TABLE order_items (product_id VARCHAR, order_item_status VARCHAR, order_id VARCHAR)
List the names of customers who have once canceled the purchase of the product "food" (the item status is "Cancel").
<s>[INST] Given the following SQL query and context: Query: SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T3.order_item_status = "Cancel" AND T4.product_na...
SELECT COUNT(*) FROM architect WHERE gender = 'female'
CREATE TABLE architect (gender VARCHAR)
How many architects are female?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM architect WHERE gender = 'female' Context: CREATE TABLE architect (gender VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many architects are female? The answer to your question is: SELECT COUNT(*) FROM ...
SELECT name, nationality, id FROM architect WHERE gender = 'male' ORDER BY name
CREATE TABLE architect (name VARCHAR, nationality VARCHAR, id VARCHAR, gender VARCHAR)
List the name, nationality and id of all male architects ordered by their names lexicographically.
<s>[INST] Given the following SQL query and context: Query: SELECT name, nationality, id FROM architect WHERE gender = 'male' ORDER BY name Context: CREATE TABLE architect (name VARCHAR, nationality VARCHAR, id VARCHAR, gender VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the name...
SELECT MAX(T1.length_meters), T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id
CREATE TABLE architect (name VARCHAR, id VARCHAR); CREATE TABLE bridge (length_meters INTEGER, architect_id VARCHAR)
What is the maximum length in meters for the bridges and what are the architects' names?
<s>[INST] Given the following SQL query and context: Query: SELECT MAX(T1.length_meters), T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id Context: CREATE TABLE architect (name VARCHAR, id VARCHAR); CREATE TABLE bridge (length_meters INTEGER, architect_id VARCHAR) [/INST] Based on the provided ...
SELECT AVG(length_feet) FROM bridge
CREATE TABLE bridge (length_feet INTEGER)
What is the average length in feet of the bridges?
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(length_feet) FROM bridge Context: CREATE TABLE bridge (length_feet INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the average length in feet of the bridges? The answer to your question is: SELECT AVG(length_f...
SELECT name, built_year FROM mill WHERE TYPE = 'Grondzeiler'
CREATE TABLE mill (name VARCHAR, built_year VARCHAR, TYPE VARCHAR)
What are the names and year of construction for the mills of 'Grondzeiler' type?
<s>[INST] Given the following SQL query and context: Query: SELECT name, built_year FROM mill WHERE TYPE = 'Grondzeiler' Context: CREATE TABLE mill (name VARCHAR, built_year VARCHAR, TYPE VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the names and year of construction for the ...
SELECT DISTINCT T1.name, T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id
CREATE TABLE mill (Id VARCHAR); CREATE TABLE architect (name VARCHAR, nationality VARCHAR, id VARCHAR)
What are the distinct names and nationalities of the architects who have ever built a mill?
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT T1.name, T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id Context: CREATE TABLE mill (Id VARCHAR); CREATE TABLE architect (name VARCHAR, nationality VARCHAR, id VARCHAR) [/INST] Based on the provided SQL query and ...
SELECT name FROM mill WHERE LOCATION <> 'Donceel'
CREATE TABLE mill (name VARCHAR, LOCATION VARCHAR)
What are the names of the mills which are not located in 'Donceel'?
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM mill WHERE LOCATION <> 'Donceel' Context: CREATE TABLE mill (name VARCHAR, LOCATION VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the names of the mills which are not located in 'Donceel'? The answer ...
SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'
CREATE TABLE architect (Id VARCHAR); CREATE TABLE mill (type VARCHAR, architect_id VARCHAR)
What are the distinct types of mills that are built by American or Canadian architects?
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian' Context: CREATE TABLE architect (Id VARCHAR); CREATE TABLE mill (type VARCHAR, architect_id VARCHAR) [/INST...
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
CREATE TABLE architect (id VARCHAR, name VARCHAR); CREATE TABLE bridge (architect_id VARCHAR)
What are the ids and names of the architects who built at least 3 bridges ?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE architect (id VARCHAR, name VARCHAR); CREATE TABLE bridge (architect_id VARCHAR) [/INST] Based on the provided SQL...
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 ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE architect (id VARCHAR, name VARCHAR, nationality VARCHAR); CREATE TABLE mill (architect_id VARCHAR)
What is the id, name and nationality of the architect who built most mills?
<s>[INST] Given the following SQL query and context: Query: 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 ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE architect (id VARCHAR, name VARCHAR, nationality VARCHAR); CREATE TABLE mill (architect_id...
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.id, T1.name, T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 1
CREATE TABLE mill (architect_id VARCHAR); CREATE TABLE architect (id VARCHAR, name VARCHAR, gender VARCHAR); CREATE TABLE bridge (architect_id VARCHAR)
What are the ids, names and genders of the architects who built two bridges or one mill?
<s>[INST] Given the following SQL query and context: Query: 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.id, T1.name, T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING C...
SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge'
CREATE TABLE bridge (LOCATION VARCHAR, name VARCHAR)
What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?
<s>[INST] Given the following SQL query and context: Query: SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge' Context: CREATE TABLE bridge (LOCATION VARCHAR, name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the location of the bridge named 'Kolo...
SELECT name FROM mill WHERE name LIKE '%Moulin%'
CREATE TABLE mill (name VARCHAR)
Which of the mill names contains the french word 'Moulin'?
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM mill WHERE name LIKE '%Moulin%' Context: CREATE TABLE mill (name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which of the mill names contains the french word 'Moulin'? The answer to your question is: SELECT ...
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
CREATE TABLE architect (Id VARCHAR); CREATE TABLE mill (name VARCHAR, architect_id VARCHAR); CREATE TABLE bridge (architect_id VARCHAR, length_meters INTEGER)
What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE architect (Id VARCHAR); CREATE TABLE mill (name VARCHAR, architect_id VARCHAR...
SELECT TYPE, COUNT(*) FROM mill GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE mill (TYPE VARCHAR)
What is the most common mill type, and how many are there?
<s>[INST] Given the following SQL query and context: Query: SELECT TYPE, COUNT(*) FROM mill GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE mill (TYPE VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the most common mill type, and how many are there? The answer ...
SELECT COUNT(*) FROM architect WHERE NOT id IN (SELECT architect_id FROM mill WHERE built_year < 1850)
CREATE TABLE mill (id VARCHAR, architect_id VARCHAR, built_year INTEGER); CREATE TABLE architect (id VARCHAR, architect_id VARCHAR, built_year INTEGER)
How many architects haven't built a mill before year 1850?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM architect WHERE NOT id IN (SELECT architect_id FROM mill WHERE built_year < 1850) Context: CREATE TABLE mill (id VARCHAR, architect_id VARCHAR, built_year INTEGER); CREATE TABLE architect (id VARCHAR, architect_id VARCHAR, built_year INTEG...
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
CREATE TABLE bridge (name VARCHAR, architect_id VARCHAR, length_feet VARCHAR); CREATE TABLE architect (id VARCHAR, nationality VARCHAR)
show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE bridge (name VARCHAR, architect_id VARCHAR, length_feet VARCHAR); CREATE TABLE architect (id VARCHA...
SELECT COUNT(*) FROM book_club
CREATE TABLE book_club (Id VARCHAR)
How many book clubs are there?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM book_club Context: CREATE TABLE book_club (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many book clubs are there? The answer to your question is: SELECT COUNT(*) FROM book_club. [/s>
SELECT book_title, author_or_editor FROM book_club WHERE YEAR > 1989
CREATE TABLE book_club (book_title VARCHAR, author_or_editor VARCHAR, YEAR INTEGER)
show the titles, and authors or editors for all books made after the year 1989.
<s>[INST] Given the following SQL query and context: Query: SELECT book_title, author_or_editor FROM book_club WHERE YEAR > 1989 Context: CREATE TABLE book_club (book_title VARCHAR, author_or_editor VARCHAR, YEAR INTEGER) [/INST] Based on the provided SQL query and context, your question is: show the titles, and author...
SELECT DISTINCT publisher FROM book_club
CREATE TABLE book_club (publisher VARCHAR)
Show all distinct publishers for books.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT publisher FROM book_club Context: CREATE TABLE book_club (publisher VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all distinct publishers for books. The answer to your question is: SELECT DISTINCT publishe...
SELECT YEAR, book_title, publisher FROM book_club ORDER BY YEAR DESC
CREATE TABLE book_club (YEAR VARCHAR, book_title VARCHAR, publisher VARCHAR)
Show the years, book titles, and publishers for all books, in descending order by year.
<s>[INST] Given the following SQL query and context: Query: SELECT YEAR, book_title, publisher FROM book_club ORDER BY YEAR DESC Context: CREATE TABLE book_club (YEAR VARCHAR, book_title VARCHAR, publisher VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the years, book titles, and p...
SELECT publisher, COUNT(*) FROM book_club GROUP BY publisher
CREATE TABLE book_club (publisher VARCHAR)
Show all publishers and the number of books for each publisher.
<s>[INST] Given the following SQL query and context: Query: SELECT publisher, COUNT(*) FROM book_club GROUP BY publisher Context: CREATE TABLE book_club (publisher VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all publishers and the number of books for each publisher. The answer t...
SELECT publisher FROM book_club GROUP BY publisher ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE book_club (publisher VARCHAR)
What is the publisher with most number of books?
<s>[INST] Given the following SQL query and context: Query: SELECT publisher FROM book_club GROUP BY publisher ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE book_club (publisher VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the publisher with most number of books? The an...
SELECT category, COUNT(*) FROM book_club GROUP BY category
CREATE TABLE book_club (category VARCHAR)
Show all book categories and the number of books in each category.
<s>[INST] Given the following SQL query and context: Query: SELECT category, COUNT(*) FROM book_club GROUP BY category Context: CREATE TABLE book_club (category VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all book categories and the number of books in each category. The answer t...
SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING COUNT(*) >= 2
CREATE TABLE book_club (category VARCHAR, YEAR INTEGER)
List categories that have at least two books after year 1989.
<s>[INST] Given the following SQL query and context: Query: SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING COUNT(*) >= 2 Context: CREATE TABLE book_club (category VARCHAR, YEAR INTEGER) [/INST] Based on the provided SQL query and context, your question is: List categories that have at least t...
SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990
CREATE TABLE book_club (publisher VARCHAR, YEAR VARCHAR)
Show publishers with a book published in 1989 and a book in 1990.
<s>[INST] Given the following SQL query and context: Query: SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990 Context: CREATE TABLE book_club (publisher VARCHAR, YEAR VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show publishe...
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989
CREATE TABLE book_club (publisher VARCHAR, YEAR VARCHAR)
Show all publishers which do not have a book in 1989.
<s>[INST] Given the following SQL query and context: Query: SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989 Context: CREATE TABLE book_club (publisher VARCHAR, YEAR VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all publishers which do not h...
SELECT title, YEAR, director FROM movie ORDER BY budget_million
CREATE TABLE movie (title VARCHAR, YEAR VARCHAR, director VARCHAR, budget_million VARCHAR)
Show all movie titles, years, and directors, ordered by budget.
<s>[INST] Given the following SQL query and context: Query: SELECT title, YEAR, director FROM movie ORDER BY budget_million Context: CREATE TABLE movie (title VARCHAR, YEAR VARCHAR, director VARCHAR, budget_million VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all movie titles, ye...
SELECT COUNT(DISTINCT director) FROM movie
CREATE TABLE movie (director VARCHAR)
How many movie directors are there?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT director) FROM movie Context: CREATE TABLE movie (director VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many movie directors are there? The answer to your question is: SELECT COUNT(DISTINCT director)...
SELECT title, director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1
CREATE TABLE movie (title VARCHAR, director VARCHAR, YEAR VARCHAR, gross_worldwide VARCHAR)
What is the title and director for the movie with highest worldwide gross in the year 2000 or before?
<s>[INST] Given the following SQL query and context: Query: SELECT title, director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1 Context: CREATE TABLE movie (title VARCHAR, director VARCHAR, YEAR VARCHAR, gross_worldwide VARCHAR) [/INST] Based on the provided SQL query and context, your question i...
SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999
CREATE TABLE movie (director VARCHAR, YEAR VARCHAR)
Show all director names who have a movie in both year 1999 and 2000.
<s>[INST] Given the following SQL query and context: Query: SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999 Context: CREATE TABLE movie (director VARCHAR, YEAR VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all director names who ...
SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000
CREATE TABLE movie (director VARCHAR, YEAR VARCHAR)
Show all director names who have a movie in the year 1999 or 2000.
<s>[INST] Given the following SQL query and context: Query: SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000 Context: CREATE TABLE movie (director VARCHAR, YEAR VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all director names who have a movie in the year 1999 or 2000. T...
SELECT AVG(budget_million), MAX(budget_million), MIN(budget_million) FROM movie WHERE YEAR < 2000
CREATE TABLE movie (budget_million INTEGER, YEAR INTEGER)
What is the average, maximum, and minimum budget for all movies before 2000.
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(budget_million), MAX(budget_million), MIN(budget_million) FROM movie WHERE YEAR < 2000 Context: CREATE TABLE movie (budget_million INTEGER, YEAR INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the average, max...
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'
CREATE TABLE culture_company (company_name VARCHAR, book_club_id VARCHAR); CREATE TABLE book_club (book_club_id VARCHAR, publisher VARCHAR)
List all company names with a book published by Alyson.
<s>[INST] Given the following SQL query and context: Query: 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' Context: CREATE TABLE culture_company (company_name VARCHAR, book_club_id VARCHAR); CREATE TABLE book_club (book_club_id V...
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'
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 VARCHAR, book_club_id VARCHAR)
Show the movie titles and book titles for all companies in China.
<s>[INST] Given the following SQL query and context: Query: 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' Context: CREATE TABLE movie (title VARCHAR, movie_id VARCHAR); ...
SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999
CREATE TABLE movie (movie_id VARCHAR, year VARCHAR); CREATE TABLE culture_company (company_name VARCHAR, movie_id VARCHAR)
Show all company names with a movie directed in year 1999.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999 Context: CREATE TABLE movie (movie_id VARCHAR, year VARCHAR); CREATE TABLE culture_company (company_name VARCHAR, movie_id VARCHAR) [/INST] Bas...
SELECT COUNT(*) FROM singer
CREATE TABLE singer (Id VARCHAR)
How many singers do we have?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM singer Context: CREATE TABLE singer (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many singers do we have? The answer to your question is: SELECT COUNT(*) FROM singer. [/s>
SELECT name, country, age FROM singer ORDER BY age DESC
CREATE TABLE singer (name VARCHAR, country VARCHAR, age VARCHAR)
Show name, country, age for all singers ordered by age from the oldest to the youngest.
<s>[INST] Given the following SQL query and context: Query: SELECT name, country, age FROM singer ORDER BY age DESC Context: CREATE TABLE singer (name VARCHAR, country VARCHAR, age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show name, country, age for all singers ordered by age from...
SELECT AVG(age), MIN(age), MAX(age) FROM singer WHERE country = 'France'
CREATE TABLE singer (age INTEGER, country VARCHAR)
What is the average, minimum, and maximum age of all singers from France?
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(age), MIN(age), MAX(age) FROM singer WHERE country = 'France' Context: CREATE TABLE singer (age INTEGER, country VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the average, minimum, and maximum age of all sin...
SELECT song_name, song_release_year FROM singer ORDER BY age LIMIT 1
CREATE TABLE singer (song_name VARCHAR, song_release_year VARCHAR, age VARCHAR)
Show the name and the release year of the song by the youngest singer.
<s>[INST] Given the following SQL query and context: Query: SELECT song_name, song_release_year FROM singer ORDER BY age LIMIT 1 Context: CREATE TABLE singer (song_name VARCHAR, song_release_year VARCHAR, age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the name and the release y...
SELECT DISTINCT country FROM singer WHERE age > 20
CREATE TABLE singer (country VARCHAR, age INTEGER)
What are all distinct countries where singers above age 20 are from?
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT country FROM singer WHERE age > 20 Context: CREATE TABLE singer (country VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: What are all distinct countries where singers above age 20 are from? The answe...
SELECT country, COUNT(*) FROM singer GROUP BY country
CREATE TABLE singer (country VARCHAR)
Show all countries and the number of singers in each country.
<s>[INST] Given the following SQL query and context: Query: SELECT country, COUNT(*) FROM singer GROUP BY country Context: CREATE TABLE singer (country VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all countries and the number of singers in each country. The answer to your questio...
SELECT song_name FROM singer WHERE age > (SELECT AVG(age) FROM singer)
CREATE TABLE singer (song_name VARCHAR, age INTEGER)
List all song names by singers above the average age.
<s>[INST] Given the following SQL query and context: Query: SELECT song_name FROM singer WHERE age > (SELECT AVG(age) FROM singer) Context: CREATE TABLE singer (song_name VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: List all song names by singers above the average age. Th...
SELECT LOCATION, name FROM stadium WHERE capacity BETWEEN 5000 AND 10000
CREATE TABLE stadium (LOCATION VARCHAR, name VARCHAR, capacity INTEGER)
Show location and name for all stadiums with a capacity between 5000 and 10000.
<s>[INST] Given the following SQL query and context: Query: SELECT LOCATION, name FROM stadium WHERE capacity BETWEEN 5000 AND 10000 Context: CREATE TABLE stadium (LOCATION VARCHAR, name VARCHAR, capacity INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show location and name for all stad...
SELECT MAX(capacity), average FROM stadium
CREATE TABLE stadium (average VARCHAR, capacity INTEGER)
What is the maximum capacity and the average of all stadiums ?
<s>[INST] Given the following SQL query and context: Query: SELECT MAX(capacity), average FROM stadium Context: CREATE TABLE stadium (average VARCHAR, capacity INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the maximum capacity and the average of all stadiums ? The answer to you...
SELECT AVG(capacity), MAX(capacity) FROM stadium
CREATE TABLE stadium (capacity INTEGER)
What is the average and maximum capacities for all stadiums ?
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(capacity), MAX(capacity) FROM stadium Context: CREATE TABLE stadium (capacity INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the average and maximum capacities for all stadiums ? The answer to your question i...
SELECT name, capacity FROM stadium ORDER BY average DESC LIMIT 1
CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, average VARCHAR)
What is the name and capacity for the stadium with highest average attendance?
<s>[INST] Given the following SQL query and context: Query: SELECT name, capacity FROM stadium ORDER BY average DESC LIMIT 1 Context: CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, average VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the name and capacity for the stadiu...
SELECT COUNT(*) FROM concert WHERE YEAR = 2014 OR YEAR = 2015
CREATE TABLE concert (YEAR VARCHAR)
How many concerts are there in year 2014 or 2015?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM concert WHERE YEAR = 2014 OR YEAR = 2015 Context: CREATE TABLE concert (YEAR VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many concerts are there in year 2014 or 2015? The answer to your question is: ...
SELECT T2.name, COUNT(*) FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id GROUP BY T1.stadium_id
CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR)
Show the stadium name and the number of concerts in each stadium.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.name, COUNT(*) FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id GROUP BY T1.stadium_id Context: CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR) [/INST] Based on the provided 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
CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, year VARCHAR)
Show the stadium name and capacity with most number of concerts in year 2014 or after.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, stadium_id VARCHAR); C...
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 LIMIT 1
CREATE TABLE concert (stadium_id VARCHAR, year INTEGER); CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, stadium_id VARCHAR)
What is the name and capacity of the stadium with the most concerts after 2013 ?
<s>[INST] Given the following SQL query and context: Query: 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 LIMIT 1 Context: CREATE TABLE concert (stadium_id VARCHAR, year INTEGER); CREATE TABLE stadium...
SELECT YEAR FROM concert GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE concert (YEAR VARCHAR)
Which year has most number of concerts?
<s>[INST] Given the following SQL query and context: Query: SELECT YEAR FROM concert GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE concert (YEAR VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which year has most number of concerts? The answer to your question is: SE...
SELECT name FROM stadium WHERE NOT stadium_id IN (SELECT stadium_id FROM concert)
CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (name VARCHAR, stadium_id VARCHAR)
Show the stadium names without any concert.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM stadium WHERE NOT stadium_id IN (SELECT stadium_id FROM concert) Context: CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (name VARCHAR, stadium_id VARCHAR) [/INST] Based on the provided SQL query and context, you...
SELECT country FROM singer WHERE age > 40 INTERSECT SELECT country FROM singer WHERE age < 30
CREATE TABLE singer (country VARCHAR, age INTEGER)
Show countries where a singer above age 40 and a singer below 30 are from.
<s>[INST] Given the following SQL query and context: Query: SELECT country FROM singer WHERE age > 40 INTERSECT SELECT country FROM singer WHERE age < 30 Context: CREATE TABLE singer (country VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show countries where a singer above...
SELECT name FROM stadium EXCEPT SELECT T2.name FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.year = 2014
CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, year VARCHAR); CREATE TABLE stadium (name VARCHAR)
Show names for all stadiums except for stadiums having a concert in year 2014.
<s>[INST] Given the following SQL query and context: Query: SELECT name FROM stadium EXCEPT SELECT T2.name FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.year = 2014 Context: CREATE TABLE stadium (name VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, year VARCHAR)...
SELECT T2.concert_name, T2.theme, COUNT(*) FROM singer_in_concert AS T1 JOIN concert AS T2 ON T1.concert_id = T2.concert_id GROUP BY T2.concert_id
CREATE TABLE singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme VARCHAR, concert_id VARCHAR)
Show the name and theme for all concerts and the number of singers in each concert.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.concert_name, T2.theme, COUNT(*) FROM singer_in_concert AS T1 JOIN concert AS T2 ON T1.concert_id = T2.concert_id GROUP BY T2.concert_id Context: CREATE TABLE singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme V...
SELECT t2.concert_name, t2.theme, COUNT(*) FROM singer_in_concert AS t1 JOIN concert AS t2 ON t1.concert_id = t2.concert_id GROUP BY t2.concert_id
CREATE TABLE singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme VARCHAR, concert_id VARCHAR)
What are the names , themes , and number of singers for every concert ?
<s>[INST] Given the following SQL query and context: Query: SELECT t2.concert_name, t2.theme, COUNT(*) FROM singer_in_concert AS t1 JOIN concert AS t2 ON t1.concert_id = t2.concert_id GROUP BY t2.concert_id Context: CREATE TABLE singer_in_concert (concert_id VARCHAR); CREATE TABLE concert (concert_name VARCHAR, theme V...
SELECT T2.name, COUNT(*) FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.singer_id = T2.singer_id GROUP BY T2.singer_id
CREATE TABLE singer_in_concert (singer_id VARCHAR); CREATE TABLE singer (name VARCHAR, singer_id VARCHAR)
List singer names and number of concerts for each singer.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.name, COUNT(*) FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.singer_id = T2.singer_id GROUP BY T2.singer_id Context: CREATE TABLE singer_in_concert (singer_id VARCHAR); CREATE TABLE singer (name VARCHAR, singer_id VARCHAR) [/INST] Based on the...
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
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)
List all singer names in concerts in year 2014.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE singer_in_concert (singer_id VARCHAR, concert_id VARCHAR); CREATE TABLE ...
SELECT name, country FROM singer WHERE song_name LIKE '%Hey%'
CREATE TABLE singer (name VARCHAR, country VARCHAR, song_name VARCHAR)
what is the name and nation of the singer who have a song having 'Hey' in its name?
<s>[INST] Given the following SQL query and context: Query: SELECT name, country FROM singer WHERE song_name LIKE '%Hey%' Context: CREATE TABLE singer (name VARCHAR, country VARCHAR, song_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: what is the name and nation of the singer who h...
SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015
CREATE TABLE stadium (name VARCHAR, location VARCHAR, stadium_id VARCHAR); CREATE TABLE concert (stadium_id VARCHAR, Year VARCHAR)
Find the name and location of the stadiums which some concerts happened in the years of both 2014 and 2015.
<s>[INST] Given the following SQL query and context: Query: SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015 Context: C...
SELECT COUNT(*) FROM concert WHERE stadium_id = (SELECT stadium_id FROM stadium ORDER BY capacity DESC LIMIT 1)
CREATE TABLE concert (stadium_id VARCHAR, capacity VARCHAR); CREATE TABLE stadium (stadium_id VARCHAR, capacity VARCHAR)
Find the number of concerts happened in the stadium with the highest capacity .
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM concert WHERE stadium_id = (SELECT stadium_id FROM stadium ORDER BY capacity DESC LIMIT 1) Context: CREATE TABLE concert (stadium_id VARCHAR, capacity VARCHAR); CREATE TABLE stadium (stadium_id VARCHAR, capacity VARCHAR) [/INST] Based on t...
SELECT COUNT(*) FROM pets WHERE weight > 10
CREATE TABLE pets (weight INTEGER)
Find the number of pets whose weight is heavier than 10.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM pets WHERE weight > 10 Context: CREATE TABLE pets (weight INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the number of pets whose weight is heavier than 10. The answer to your question is: SELECT COUNT...
SELECT weight FROM pets ORDER BY pet_age LIMIT 1
CREATE TABLE pets (weight VARCHAR, pet_age VARCHAR)
Find the weight of the youngest dog.
<s>[INST] Given the following SQL query and context: Query: SELECT weight FROM pets ORDER BY pet_age LIMIT 1 Context: CREATE TABLE pets (weight VARCHAR, pet_age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the weight of the youngest dog. The answer to your question is: SELECT wei...
SELECT MAX(weight), petType FROM pets GROUP BY petType
CREATE TABLE pets (petType VARCHAR, weight INTEGER)
Find the maximum weight for each type of pet. List the maximum weight and pet type.
<s>[INST] Given the following SQL query and context: Query: SELECT MAX(weight), petType FROM pets GROUP BY petType Context: CREATE TABLE pets (petType VARCHAR, weight INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the maximum weight for each type of pet. List the maximum weight and...
SELECT COUNT(*) FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid WHERE T1.age > 20
CREATE TABLE student (stuid VARCHAR, age INTEGER); CREATE TABLE has_pet (stuid VARCHAR)
Find number of pets owned by students who are older than 20.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid WHERE T1.age > 20 Context: CREATE TABLE student (stuid VARCHAR, age INTEGER); CREATE TABLE has_pet (stuid VARCHAR) [/INST] Based on the provided SQL query and context, your question i...
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'
CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CREATE TABLE student (stuid VARCHAR, sex VARCHAR)
Find the number of dog pets that are raised by female students (with sex F).
<s>[INST] Given the following SQL query and context: Query: 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' Context: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettyp...
SELECT COUNT(DISTINCT pettype) FROM pets
CREATE TABLE pets (pettype VARCHAR)
Find the number of distinct type of pets.
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT pettype) FROM pets Context: CREATE TABLE pets (pettype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of distinct type of pets. The answer to your question is: SELECT COUNT(DISTINCT pettype...
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 = 'cat' OR T3.pettype = 'dog'
CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (Fname VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
Find the first name of students who have cat or dog pet.
<s>[INST] Given the following SQL query and context: Query: 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 = 'cat' OR T3.pettype = 'dog' Context: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (Fnam...
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.stuid = t2.stuid JOIN pets AS t3 ON t3.petid = t2.petid WHERE t3.pettype = 'dog'
CREATE TABLE student (fname VARCHAR, stuid VARCHAR); CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
Find the first name of students who have both cat and dog pets .
<s>[INST] Given the following SQL query and context: Query: 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.stuid = t2.stuid JOIN pets AS t3 ON t3.petid = t2...
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.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'dog'
CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (Fname VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
What are the students' first names who have both cats and dogs as pets?
<s>[INST] Given the following SQL query and context: Query: 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.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2...
SELECT major, age FROM student WHERE NOT stuid 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')
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 VARCHAR, stuid VARCHAR)
Find the major and age of students who do not have a cat pet.
<s>[INST] Given the following SQL query and context: Query: SELECT major, age FROM student WHERE NOT stuid 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') Context: CREATE TABLE student (stuid VARCHAR); CREATE TABLE has_pet...
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'
CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR); CREATE TABLE student (stuid VARCHAR)
Find the id of students who do not have a cat pet.
<s>[INST] Given the following SQL query and context: Query: 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' Context: CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE pets (petid...
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 NOT T1.stuid 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')
CREATE TABLE has_pet (stuid VARCHAR, petid VARCHAR); CREATE TABLE student (fname VARCHAR, age VARCHAR, stuid VARCHAR); CREATE TABLE pets (petid VARCHAR, pettype VARCHAR)
Find the first name and age of students who have a dog but do not have a cat as a pet.
<s>[INST] Given the following SQL query and context: Query: 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 NOT T1.stuid IN (SELECT T1.stuid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS ...
SELECT pettype, weight FROM pets ORDER BY pet_age LIMIT 1
CREATE TABLE pets (pettype VARCHAR, weight VARCHAR, pet_age VARCHAR)
Find the type and weight of the youngest pet.
<s>[INST] Given the following SQL query and context: Query: SELECT pettype, weight FROM pets ORDER BY pet_age LIMIT 1 Context: CREATE TABLE pets (pettype VARCHAR, weight VARCHAR, pet_age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the type and weight of the youngest pet. The ans...
SELECT petid, weight FROM pets WHERE pet_age > 1
CREATE TABLE pets (petid VARCHAR, weight VARCHAR, pet_age INTEGER)
Find the id and weight of all pets whose age is older than 1.
<s>[INST] Given the following SQL query and context: Query: SELECT petid, weight FROM pets WHERE pet_age > 1 Context: CREATE TABLE pets (petid VARCHAR, weight VARCHAR, pet_age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the id and weight of all pets whose age is older than 1. Th...
SELECT AVG(pet_age), MAX(pet_age), pettype FROM pets GROUP BY pettype
CREATE TABLE pets (pettype VARCHAR, pet_age INTEGER)
Find the average and maximum age for each type of pet.
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(pet_age), MAX(pet_age), pettype FROM pets GROUP BY pettype Context: CREATE TABLE pets (pettype VARCHAR, pet_age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the average and maximum age for each type of pet. Th...