training_input
stringlengths 118
1.06k
|
---|
###context:CREATE TABLE Tourist_Attraction_Features (tourist_attraction_id VARCHAR, Feature_ID VARCHAR); CREATE TABLE Features (Feature_ID VARCHAR, feature_Details VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, tourist_attraction_id VARCHAR)
###human: What are the names of the tourist attractions that have parking or shopping as their feature details?
###assistant: SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'park' UNION SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'shopping' |
###context:CREATE TABLE Tourist_Attractions (Name VARCHAR, Location_ID VARCHAR, How_to_Get_There VARCHAR); CREATE TABLE Locations (Location_ID VARCHAR, Address VARCHAR)
###human: What are the names of tourist attractions that can be reached by bus or is at address 254 Ottilie Junction?
###assistant: SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "254 Ottilie Junction" OR T2.How_to_Get_There = "bus" |
###context:CREATE TABLE VISITS (Tourist_Attraction_ID VARCHAR, Tourist_ID VARCHAR); CREATE TABLE VISITORS (Tourist_Details VARCHAR, Tourist_ID VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, Tourist_Attraction_ID VARCHAR)
###human: What are the names of the tourist attractions Vincent and Marcelle visit?
###assistant: SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Vincent" INTERSECT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Marcelle" |
###context:CREATE TABLE VISITS (Tourist_Attraction_ID VARCHAR, Tourist_ID VARCHAR); CREATE TABLE VISITORS (Tourist_Details VARCHAR, Tourist_ID VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, Tourist_Attraction_ID VARCHAR)
###human: What are the names of tourist attraction that Alison visited but Rosalind did not visit?
###assistant: SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Alison" EXCEPT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Rosalind" |
###context:CREATE TABLE Visitors (Tourist_ID VARCHAR); CREATE TABLE Visits (Tourist_ID VARCHAR)
###human: How many tourists did not make any visit?
###assistant: SELECT COUNT(*) FROM Visitors WHERE NOT Tourist_ID IN (SELECT Tourist_ID FROM Visits) |
###context:CREATE TABLE Video_games (Id VARCHAR)
###human: How many video games exist?
###assistant: SELECT COUNT(*) FROM Video_games |
###context:CREATE TABLE Video_games (gtype VARCHAR)
###human: How many video game types exist?
###assistant: SELECT COUNT(DISTINCT gtype) FROM Video_games |
###context:CREATE TABLE Video_games (gtype VARCHAR)
###human: Show all video game types.
###assistant: SELECT DISTINCT gtype FROM Video_games |
###context:CREATE TABLE Video_games (gname VARCHAR, gtype VARCHAR)
###human: Show all video games and their types in the order of their names.
###assistant: SELECT gname, gtype FROM Video_games ORDER BY gname |
###context:CREATE TABLE Video_games (gname VARCHAR, gtype VARCHAR)
###human: Show all video games with type Collectible card game.
###assistant: SELECT gname FROM Video_games WHERE gtype = "Collectible card game" |
###context:CREATE TABLE Video_games (gtype VARCHAR, gname VARCHAR)
###human: What is the type of video game Call of Destiny.
###assistant: SELECT gtype FROM Video_games WHERE gname = "Call of Destiny" |
###context:CREATE TABLE Video_games (gtype VARCHAR)
###human: How many video games have type Massively multiplayer online game?
###assistant: SELECT COUNT(*) FROM Video_games WHERE gtype = "Massively multiplayer online game" |
###context:CREATE TABLE Video_games (gtype VARCHAR)
###human: Show all video game types and the number of video games in each type.
###assistant: SELECT gtype, COUNT(*) FROM Video_games GROUP BY gtype |
###context:CREATE TABLE Video_games (gtype VARCHAR)
###human: Which game type has most number of games?
###assistant: SELECT gtype FROM Video_games GROUP BY gtype ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE Video_games (gtype VARCHAR)
###human: Which game type has least number of games?
###assistant: SELECT gtype FROM Video_games GROUP BY gtype ORDER BY COUNT(*) LIMIT 1 |
###context:CREATE TABLE Student (StuID VARCHAR, city_code VARCHAR)
###human: Show ids for all students who live in CHI.
###assistant: SELECT StuID FROM Student WHERE city_code = "CHI" |
###context:CREATE TABLE Student (StuID VARCHAR, Advisor VARCHAR)
###human: Show ids for all students who have advisor 1121.
###assistant: SELECT StuID FROM Student WHERE Advisor = 1121 |
###context:CREATE TABLE Student (Fname VARCHAR, Major VARCHAR)
###human: Show first name for all students with major 600.
###assistant: SELECT Fname FROM Student WHERE Major = 600 |
###context:CREATE TABLE Student (major VARCHAR, age INTEGER)
###human: Show the average, minimum, and maximum age for different majors.
###assistant: SELECT major, AVG(age), MIN(age), MAX(age) FROM Student GROUP BY major |
###context:CREATE TABLE Student (advisor VARCHAR)
###human: Show all advisors who have at least two students.
###assistant: SELECT advisor FROM Student GROUP BY advisor HAVING COUNT(*) >= 2 |
###context:CREATE TABLE Sportsinfo (sportname VARCHAR)
###human: How many sports do we have?
###assistant: SELECT COUNT(DISTINCT sportname) FROM Sportsinfo |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR)
###human: How many students play sports?
###assistant: SELECT COUNT(DISTINCT StuID) FROM Sportsinfo |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR, onscholarship VARCHAR)
###human: List ids for all student who are on scholarship.
###assistant: SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y' |
###context:CREATE TABLE Student (Lname VARCHAR, StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR, onscholarship VARCHAR)
###human: Show last names for all student who are on scholarship.
###assistant: SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y' |
###context:CREATE TABLE Sportsinfo (gamesplayed INTEGER)
###human: How many games are played for all students?
###assistant: SELECT SUM(gamesplayed) FROM Sportsinfo |
###context:CREATE TABLE Sportsinfo (gamesplayed INTEGER, sportname VARCHAR, onscholarship VARCHAR)
###human: How many games are played for all football games by students on scholarship?
###assistant: SELECT SUM(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y' |
###context:CREATE TABLE Sportsinfo (sportname VARCHAR)
###human: Show all sport name and the number of students.
###assistant: SELECT sportname, COUNT(*) FROM Sportsinfo GROUP BY sportname |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR, gamesplayed INTEGER)
###human: Show all student IDs with the number of sports and total number of games played
###assistant: SELECT StuID, COUNT(*), SUM(gamesplayed) FROM Sportsinfo GROUP BY StuID |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR, hoursperweek INTEGER)
###human: Show all student IDs with more than total 10 hours per week on all sports played.
###assistant: SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING SUM(hoursperweek) > 10 |
###context:CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR)
###human: What is the first name and last name of the student who have most number of sports?
###assistant: SELECT T2.Fname, T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE Sportsinfo (sportname VARCHAR, onscholarship VARCHAR)
###human: Which sport has most number of students on scholarship?
###assistant: SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR)
###human: Show student ids who don't have any sports.
###assistant: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR, major VARCHAR, onscholarship VARCHAR); CREATE TABLE Student (StuID VARCHAR, major VARCHAR, onscholarship VARCHAR)
###human: Show student ids who are on scholarship and have major 600.
###assistant: SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y' |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR, sex VARCHAR, sportname VARCHAR); CREATE TABLE Student (StuID VARCHAR, sex VARCHAR, sportname VARCHAR)
###human: Show student ids who are female and play football.
###assistant: SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football" |
###context:CREATE TABLE Sportsinfo (StuID VARCHAR, sex VARCHAR, sportname VARCHAR); CREATE TABLE Student (StuID VARCHAR, sex VARCHAR, sportname VARCHAR)
###human: Show all male student ids who don't play football.
###assistant: SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football" |
###context:CREATE TABLE Student (StuID VARCHAR, Fname VARCHAR, Lname VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR)
###human: Show total hours per week and number of games played for student David Shieber.
###assistant: SELECT SUM(hoursperweek), SUM(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber" |
###context:CREATE TABLE Student (StuID VARCHAR, age INTEGER); CREATE TABLE Sportsinfo (StuID VARCHAR)
###human: Show total hours per week and number of games played for students under 20.
###assistant: SELECT SUM(hoursperweek), SUM(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20 |
###context:CREATE TABLE Plays_games (StuID VARCHAR)
###human: How many students play video games?
###assistant: SELECT COUNT(DISTINCT StuID) FROM Plays_games |
###context:CREATE TABLE Plays_games (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR)
###human: Show ids of students who don't play video game.
###assistant: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games |
###context:CREATE TABLE Plays_games (StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR)
###human: Show ids of students who play video game and play sports.
###assistant: SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games |
###context:CREATE TABLE Plays_games (gameid VARCHAR, hours_played INTEGER)
###human: Show all game ids and the number of hours played.
###assistant: SELECT gameid, SUM(hours_played) FROM Plays_games GROUP BY gameid |
###context:CREATE TABLE Plays_games (Stuid VARCHAR, hours_played INTEGER)
###human: Show all student ids and the number of hours played.
###assistant: SELECT Stuid, SUM(hours_played) FROM Plays_games GROUP BY Stuid |
###context:CREATE TABLE Plays_games (gameid VARCHAR); CREATE TABLE Video_games (gameid VARCHAR)
###human: Show the game name that has most number of hours played.
###assistant: SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY SUM(hours_played) DESC LIMIT 1 |
###context:CREATE TABLE Plays_games (gameid VARCHAR); CREATE TABLE Video_games (gameid VARCHAR)
###human: Show all game names played by at least 1000 hours.
###assistant: SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING SUM(hours_played) >= 1000 |
###context:CREATE TABLE Student (Stuid VARCHAR, Lname VARCHAR, Fname VARCHAR); CREATE TABLE Plays_games (gameid VARCHAR, Stuid VARCHAR); CREATE TABLE Video_games (gameid VARCHAR)
###human: Show all game names played by Linda Smith
###assistant: SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = "Smith" AND T3.Fname = "Linda" |
###context:CREATE TABLE SportsInfo (StuID VARCHAR, SportName VARCHAR); CREATE TABLE Student (lname VARCHAR, fname VARCHAR, StuID VARCHAR)
###human: Find the last and first name of students who are playing Football or Lacrosse.
###assistant: SELECT T2.lname, T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = "Football" OR T1.SportName = "Lacrosse" |
###context:CREATE TABLE Student (fname VARCHAR, age VARCHAR, StuID VARCHAR, SportName VARCHAR); CREATE TABLE Sportsinfo (fname VARCHAR, age VARCHAR, StuID VARCHAR, SportName VARCHAR)
###human: Find the first name and age of the students who are playing both Football and Lacrosse.
###assistant: SELECT fname, age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse") |
###context:CREATE TABLE Plays_games (StuID VARCHAR, GameID VARCHAR); CREATE TABLE Student (lname VARCHAR, sex VARCHAR, StuID VARCHAR); CREATE TABLE Video_games (GameID VARCHAR, Gname VARCHAR)
###human: Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games.
###assistant: SELECT lname, sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Call of Destiny" INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Works of Widenius") |
###context:CREATE TABLE customers (customer_name VARCHAR)
###human: Find the name of all customers.
###assistant: SELECT customer_name FROM customers |
###context:CREATE TABLE order_items (order_quantity INTEGER)
###human: What is the average amount of items ordered in each order?
###assistant: SELECT AVG(order_quantity) FROM order_items |
###context:CREATE TABLE customers (customer_name VARCHAR, payment_method VARCHAR)
###human: What are the names of customers who use payment method "Cash"?
###assistant: SELECT customer_name FROM customers WHERE payment_method = "Cash" |
###context:CREATE TABLE customers (date_became_customer VARCHAR, customer_id INTEGER)
###human: Find the "date became customers" of the customers whose ID is between 10 and 20.
###assistant: SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20 |
###context:CREATE TABLE customers (payment_method VARCHAR)
###human: Which payment method is used by most customers?
###assistant: SELECT payment_method FROM customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE customers (customer_name VARCHAR, payment_method VARCHAR)
###human: What are the names of customers using the most popular payment method?
###assistant: SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1) |
###context:CREATE TABLE customers (payment_method VARCHAR)
###human: What are all the payment methods?
###assistant: SELECT DISTINCT payment_method FROM customers |
###context:CREATE TABLE products (product_details VARCHAR)
###human: What are the details of all products?
###assistant: SELECT DISTINCT product_details FROM products |
###context:CREATE TABLE customers (customer_name VARCHAR)
###human: Find the name of all customers whose name contains "Alex".
###assistant: SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%" |
###context:CREATE TABLE products (product_details VARCHAR)
###human: Find the detail of products whose detail contains the word "Latte" or the word "Americano"
###assistant: SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%" |
###context:CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR); CREATE TABLE addresses (address_content VARCHAR, address_id VARCHAR)
###human: What is the address content of the customer named "Maudie Kertzmann"?
###assistant: SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann" |
###context:CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE addresses (address_id VARCHAR, city VARCHAR); CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR)
###human: How many customers are living in city "Lake Geovannyton"?
###assistant: SELECT COUNT(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton" |
###context:CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE addresses (address_id VARCHAR, state_province_county VARCHAR)
###human: Find the name of customers who are living in Colorado?
###assistant: SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado" |
###context:CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR); CREATE TABLE addresses (city VARCHAR)
###human: Find the list of cities that no customer is living in.
###assistant: SELECT city FROM addresses WHERE NOT city IN (SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id) |
###context:CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR)
###human: Which city has the most customers living in?
###assistant: SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE addresses (city VARCHAR, zip_postcode VARCHAR)
###human: Find the city with post code 255.
###assistant: SELECT city FROM addresses WHERE zip_postcode = 255 |
###context:CREATE TABLE addresses (state_province_county VARCHAR, country VARCHAR, zip_postcode VARCHAR)
###human: Find the state and country of all cities with post code starting with 4.
###assistant: SELECT state_province_county, country FROM addresses WHERE zip_postcode LIKE "4%" |
###context:CREATE TABLE addresses (country VARCHAR, address_id VARCHAR)
###human: List the countries having more than 4 addresses listed.
###assistant: SELECT country FROM addresses GROUP BY country HAVING COUNT(address_id) > 4 |
###context:CREATE TABLE customer_contact_channels (channel_code VARCHAR, customer_id VARCHAR)
###human: List all the contact channel codes that were used less than 5 times.
###assistant: SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING COUNT(customer_id) < 5 |
###context:CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customer_contact_channels (customer_id VARCHAR)
###human: Which contact channel has been used by the customer with name "Tillman Ernser"?
###assistant: SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" |
###context:CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customer_contact_channels (active_to_date INTEGER, customer_id VARCHAR)
###human: What is the "active to date" of the latest contact channel used by "Tillman Ernser"?
###assistant: SELECT MAX(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" |
###context:CREATE TABLE customer_contact_channels (active_to_date VARCHAR, active_from_date VARCHAR)
###human: What is the average time span of contact channels in the database?
###assistant: SELECT AVG(active_to_date - active_from_date) FROM customer_contact_channels |
###context:CREATE TABLE customer_contact_channels (channel_code VARCHAR, contact_number VARCHAR, active_to_date VARCHAR, active_from_date VARCHAR)
###human: What is the channel code and contact number of the customer contact channel that was active for the longest time?
###assistant: SELECT channel_code, contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1) |
###context:CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_contact_channels (active_from_date VARCHAR, customer_id VARCHAR, channel_code VARCHAR)
###human: Find the name and active date of the customer that use email as the contact channel.
###assistant: SELECT t1.customer_name, t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' |
###context:CREATE TABLE order_items (order_id VARCHAR, order_quantity INTEGER); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE order_items (order_quantity INTEGER); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR)
###human: What is the name of the customer that made the order with the largest quantity?
###assistant: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = (SELECT MAX(order_quantity) FROM order_items) |
###context:CREATE TABLE order_items (order_id VARCHAR, order_quantity INTEGER); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR)
###human: What is the name of the customer that has purchased the most items?
###assistant: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY SUM(t3.order_quantity) DESC LIMIT 1 |
###context:CREATE TABLE order_items (order_id VARCHAR, order_quantity INTEGER); CREATE TABLE customers (payment_method VARCHAR, customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR)
###human: What is the payment method of the customer that has purchased the least quantity of items?
###assistant: SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY SUM(t3.order_quantity) LIMIT 1 |
###context:CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE order_items (product_id VARCHAR, order_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR)
###human: How many types of products have Rodrick Heaney bought in total?
###assistant: SELECT COUNT(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney" |
###context:CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR)
###human: What is the total quantity of products purchased by "Rodrick Heaney"?
###assistant: SELECT SUM(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney" |
###context:CREATE TABLE customer_orders (customer_id VARCHAR, order_status VARCHAR)
###human: How many customers have at least one order with status "Cancelled"?
###assistant: SELECT COUNT(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled" |
###context:CREATE TABLE customer_orders (order_details VARCHAR)
###human: How many orders have detail "Second time"?
###assistant: SELECT COUNT(*) FROM customer_orders WHERE order_details = "Second time" |
###context:CREATE TABLE customer_orders (order_date VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
###human: Find the customer name and date of the orders that have the status "Delivered".
###assistant: SELECT t1.customer_name, t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered" |
###context:CREATE TABLE customer_orders (order_id VARCHAR, order_status VARCHAR); CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR)
###human: What is the total number of products that are in orders with status "Cancelled"?
###assistant: SELECT SUM(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = "Cancelled" |
###context:CREATE TABLE customer_orders (order_id VARCHAR, order_date INTEGER); CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR)
###human: Find the total amount of products ordered before 2018-03-17 07:13:53.
###assistant: SELECT SUM(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < "2018-03-17 07:13:53" |
###context:CREATE TABLE customer_orders (customer_id VARCHAR, order_date VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
###human: Who made the latest order?
###assistant: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1 |
###context:CREATE TABLE products (product_details VARCHAR, product_id VARCHAR); CREATE TABLE order_items (product_id VARCHAR)
###human: Which product has been ordered most number of times?
###assistant: SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY COUNT(*) DESC LIMIT 1 |
###context:CREATE TABLE order_items (product_id VARCHAR, order_quantity INTEGER); CREATE TABLE products (product_details VARCHAR, product_id VARCHAR)
###human: Find the name and ID of the product whose total order quantity is the largest.
###assistant: SELECT t2.product_details, t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY SUM(t1.order_quantity) LIMIT 1 |
###context:CREATE TABLE addresses (address_content VARCHAR, city VARCHAR, state_province_county VARCHAR)
###human: Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
###assistant: SELECT address_content FROM addresses WHERE city = "East Julianaside" AND state_province_county = "Texas" UNION SELECT address_content FROM addresses WHERE city = "Gleasonmouth" AND state_province_county = "Arizona" |
###context:CREATE TABLE customers (customer_name VARCHAR, payment_method VARCHAR)
###human: Find the name of customers who did not pay with Cash.
###assistant: SELECT customer_name FROM customers WHERE payment_method <> 'Cash' |
###context:CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_details VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
###human: Find the names of customers who never ordered product Latte.
###assistant: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_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.product_id WHERE t4.product_details = 'Latte' |
###context:CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR)
###human: Find the names of customers who never placed an order.
###assistant: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id |
###context:CREATE TABLE products (product_id VARCHAR, product_details VARCHAR); CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR)
###human: Find the names of customers who ordered both products Latte and Americano.
###assistant: SELECT t1.customer_name FROM customers AS t1 JOIN customer_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.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_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.product_id WHERE t4.product_details = 'Americano' |
###context:CREATE TABLE artist (Age VARCHAR)
###human: List the age of all music artists.
###assistant: SELECT Age FROM artist |
###context:CREATE TABLE artist (Age INTEGER)
###human: What is the average age of all artists?
###assistant: SELECT AVG(Age) FROM artist |
###context:CREATE TABLE artist (Famous_Title VARCHAR, Artist VARCHAR)
###human: What are the famous titles of the artist "Triumfall"?
###assistant: SELECT Famous_Title FROM artist WHERE Artist = "Triumfall" |
###context:CREATE TABLE artist (Famous_Release_date VARCHAR)
###human: What are the distinct Famous release dates?
###assistant: SELECT DISTINCT (Famous_Release_date) FROM artist |
###context:CREATE TABLE music_festival (Date_of_ceremony VARCHAR, RESULT VARCHAR)
###human: Return the dates of ceremony and the results of all music festivals
###assistant: SELECT Date_of_ceremony, RESULT FROM music_festival |
###context:CREATE TABLE music_festival (Category VARCHAR, RESULT VARCHAR)
###human: What are the category of music festivals with result "Awarded"?
###assistant: SELECT Category FROM music_festival WHERE RESULT = "Awarded" |
###context:CREATE TABLE volume (Weeks_on_Top INTEGER)
###human: What are the maximum and minimum week on top of all volumes?
###assistant: SELECT MAX(Weeks_on_Top), MIN(Weeks_on_Top) FROM volume |
###context:CREATE TABLE volume (Song VARCHAR, Weeks_on_Top INTEGER)
###human: What are the songs in volumes with more than 1 week on top?
###assistant: SELECT Song FROM volume WHERE Weeks_on_Top > 1 |
###context:CREATE TABLE volume (Song VARCHAR)
###human: Please list all songs in volumes in ascending alphabetical order.
###assistant: SELECT Song FROM volume ORDER BY Song |
###context:CREATE TABLE volume (Artist_ID VARCHAR)
###human: How many distinct artists do the volumes associate to?
###assistant: SELECT COUNT(DISTINCT Artist_ID) FROM volume |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.