Unnamed: 0
int64
0
60k
input
stringlengths
76
562
answer
stringlengths
18
557
3,400
<question>: What are the names of the tourist attractions that have parking or shopping as their feature details? <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)
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'
3,401
<question>: What are the names of tourist attractions that can be reached by bus or is at address 254 Ottilie Junction? <context>: CREATE TABLE Tourist_Attractions (Name VARCHAR, Location_ID VARCHAR, How_to_Get_There VARCHAR); CREATE TABLE Locations (Location_ID VARCHAR, Address VARCHAR)
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"
3,402
<question>: What are the names of the tourist attractions Vincent and Marcelle visit? <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)
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"
3,403
<question>: What are the names of tourist attraction that Alison visited but Rosalind did not visit? <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)
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"
3,404
<question>: How many tourists did not make any visit? <context>: CREATE TABLE Visitors (Tourist_ID VARCHAR); CREATE TABLE Visits (Tourist_ID VARCHAR)
SELECT COUNT(*) FROM Visitors WHERE NOT Tourist_ID IN (SELECT Tourist_ID FROM Visits)
3,405
<question>: How many video games exist? <context>: CREATE TABLE Video_games (Id VARCHAR)
SELECT COUNT(*) FROM Video_games
3,406
<question>: How many video game types exist? <context>: CREATE TABLE Video_games (gtype VARCHAR)
SELECT COUNT(DISTINCT gtype) FROM Video_games
3,407
<question>: Show all video game types. <context>: CREATE TABLE Video_games (gtype VARCHAR)
SELECT DISTINCT gtype FROM Video_games
3,408
<question>: Show all video games and their types in the order of their names. <context>: CREATE TABLE Video_games (gname VARCHAR, gtype VARCHAR)
SELECT gname, gtype FROM Video_games ORDER BY gname
3,409
<question>: Show all video games with type Collectible card game. <context>: CREATE TABLE Video_games (gname VARCHAR, gtype VARCHAR)
SELECT gname FROM Video_games WHERE gtype = "Collectible card game"
3,410
<question>: What is the type of video game Call of Destiny. <context>: CREATE TABLE Video_games (gtype VARCHAR, gname VARCHAR)
SELECT gtype FROM Video_games WHERE gname = "Call of Destiny"
3,411
<question>: How many video games have type Massively multiplayer online game? <context>: CREATE TABLE Video_games (gtype VARCHAR)
SELECT COUNT(*) FROM Video_games WHERE gtype = "Massively multiplayer online game"
3,412
<question>: Show all video game types and the number of video games in each type. <context>: CREATE TABLE Video_games (gtype VARCHAR)
SELECT gtype, COUNT(*) FROM Video_games GROUP BY gtype
3,413
<question>: Which game type has most number of games? <context>: CREATE TABLE Video_games (gtype VARCHAR)
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY COUNT(*) DESC LIMIT 1
3,414
<question>: Which game type has least number of games? <context>: CREATE TABLE Video_games (gtype VARCHAR)
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY COUNT(*) LIMIT 1
3,415
<question>: Show ids for all students who live in CHI. <context>: CREATE TABLE Student (StuID VARCHAR, city_code VARCHAR)
SELECT StuID FROM Student WHERE city_code = "CHI"
3,416
<question>: Show ids for all students who have advisor 1121. <context>: CREATE TABLE Student (StuID VARCHAR, Advisor VARCHAR)
SELECT StuID FROM Student WHERE Advisor = 1121
3,417
<question>: Show first name for all students with major 600. <context>: CREATE TABLE Student (Fname VARCHAR, Major VARCHAR)
SELECT Fname FROM Student WHERE Major = 600
3,418
<question>: Show the average, minimum, and maximum age for different majors. <context>: CREATE TABLE Student (major VARCHAR, age INTEGER)
SELECT major, AVG(age), MIN(age), MAX(age) FROM Student GROUP BY major
3,419
<question>: Show all advisors who have at least two students. <context>: CREATE TABLE Student (advisor VARCHAR)
SELECT advisor FROM Student GROUP BY advisor HAVING COUNT(*) >= 2
3,420
<question>: How many sports do we have? <context>: CREATE TABLE Sportsinfo (sportname VARCHAR)
SELECT COUNT(DISTINCT sportname) FROM Sportsinfo
3,421
<question>: How many students play sports? <context>: CREATE TABLE Sportsinfo (StuID VARCHAR)
SELECT COUNT(DISTINCT StuID) FROM Sportsinfo
3,422
<question>: List ids for all student who are on scholarship. <context>: CREATE TABLE Sportsinfo (StuID VARCHAR, onscholarship VARCHAR)
SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
3,423
<question>: Show last names for all student who are on scholarship. <context>: CREATE TABLE Student (Lname VARCHAR, StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR, onscholarship VARCHAR)
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
3,424
<question>: How many games are played for all students? <context>: CREATE TABLE Sportsinfo (gamesplayed INTEGER)
SELECT SUM(gamesplayed) FROM Sportsinfo
3,425
<question>: How many games are played for all football games by students on scholarship? <context>: CREATE TABLE Sportsinfo (gamesplayed INTEGER, sportname VARCHAR, onscholarship VARCHAR)
SELECT SUM(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
3,426
<question>: Show all sport name and the number of students. <context>: CREATE TABLE Sportsinfo (sportname VARCHAR)
SELECT sportname, COUNT(*) FROM Sportsinfo GROUP BY sportname
3,427
<question>: Show all student IDs with the number of sports and total number of games played <context>: CREATE TABLE Sportsinfo (StuID VARCHAR, gamesplayed INTEGER)
SELECT StuID, COUNT(*), SUM(gamesplayed) FROM Sportsinfo GROUP BY StuID
3,428
<question>: Show all student IDs with more than total 10 hours per week on all sports played. <context>: CREATE TABLE Sportsinfo (StuID VARCHAR, hoursperweek INTEGER)
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING SUM(hoursperweek) > 10
3,429
<question>: What is the first name and last name of the student who have most number of sports? <context>: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR)
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
3,430
<question>: Which sport has most number of students on scholarship? <context>: CREATE TABLE Sportsinfo (sportname VARCHAR, onscholarship VARCHAR)
SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY COUNT(*) DESC LIMIT 1
3,431
<question>: Show student ids who don't have any sports. <context>: CREATE TABLE Sportsinfo (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR)
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
3,432
<question>: Show student ids who are on scholarship and have major 600. <context>: CREATE TABLE Sportsinfo (StuID VARCHAR, major VARCHAR, onscholarship VARCHAR); CREATE TABLE Student (StuID VARCHAR, major VARCHAR, onscholarship VARCHAR)
SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
3,433
<question>: Show student ids who are female and play football. <context>: CREATE TABLE Sportsinfo (StuID VARCHAR, sex VARCHAR, sportname VARCHAR); CREATE TABLE Student (StuID VARCHAR, sex VARCHAR, sportname VARCHAR)
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
3,434
<question>: Show all male student ids who don't play football. <context>: CREATE TABLE Sportsinfo (StuID VARCHAR, sex VARCHAR, sportname VARCHAR); CREATE TABLE Student (StuID VARCHAR, sex VARCHAR, sportname VARCHAR)
SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
3,435
<question>: Show total hours per week and number of games played for student David Shieber. <context>: CREATE TABLE Student (StuID VARCHAR, Fname VARCHAR, Lname VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR)
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"
3,436
<question>: Show total hours per week and number of games played for students under 20. <context>: CREATE TABLE Student (StuID VARCHAR, age INTEGER); CREATE TABLE Sportsinfo (StuID VARCHAR)
SELECT SUM(hoursperweek), SUM(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20
3,437
<question>: How many students play video games? <context>: CREATE TABLE Plays_games (StuID VARCHAR)
SELECT COUNT(DISTINCT StuID) FROM Plays_games
3,438
<question>: Show ids of students who don't play video game. <context>: CREATE TABLE Plays_games (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR)
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
3,439
<question>: Show ids of students who play video game and play sports. <context>: CREATE TABLE Plays_games (StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR)
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
3,440
<question>: Show all game ids and the number of hours played. <context>: CREATE TABLE Plays_games (gameid VARCHAR, hours_played INTEGER)
SELECT gameid, SUM(hours_played) FROM Plays_games GROUP BY gameid
3,441
<question>: Show all student ids and the number of hours played. <context>: CREATE TABLE Plays_games (Stuid VARCHAR, hours_played INTEGER)
SELECT Stuid, SUM(hours_played) FROM Plays_games GROUP BY Stuid
3,442
<question>: Show the game name that has most number of hours played. <context>: CREATE TABLE Plays_games (gameid VARCHAR); CREATE TABLE Video_games (gameid VARCHAR)
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
3,443
<question>: Show all game names played by at least 1000 hours. <context>: CREATE TABLE Plays_games (gameid VARCHAR); CREATE TABLE Video_games (gameid VARCHAR)
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
3,444
<question>: Show all game names played by Linda Smith <context>: CREATE TABLE Student (Stuid VARCHAR, Lname VARCHAR, Fname VARCHAR); CREATE TABLE Plays_games (gameid VARCHAR, Stuid VARCHAR); CREATE TABLE Video_games (gameid VARCHAR)
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"
3,445
<question>: Find the last and first name of students who are playing Football or Lacrosse. <context>: CREATE TABLE SportsInfo (StuID VARCHAR, SportName VARCHAR); CREATE TABLE Student (lname VARCHAR, fname VARCHAR, StuID VARCHAR)
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"
3,446
<question>: Find the first name and age of the students who are playing both Football and Lacrosse. <context>: CREATE TABLE Student (fname VARCHAR, age VARCHAR, StuID VARCHAR, SportName VARCHAR); CREATE TABLE Sportsinfo (fname VARCHAR, age VARCHAR, StuID VARCHAR, SportName VARCHAR)
SELECT fname, age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse")
3,447
<question>: Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games. <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)
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")
3,448
<question>: Find the name of all customers. <context>: CREATE TABLE customers (customer_name VARCHAR)
SELECT customer_name FROM customers
3,449
<question>: What is the average amount of items ordered in each order? <context>: CREATE TABLE order_items (order_quantity INTEGER)
SELECT AVG(order_quantity) FROM order_items
3,450
<question>: What are the names of customers who use payment method "Cash"? <context>: CREATE TABLE customers (customer_name VARCHAR, payment_method VARCHAR)
SELECT customer_name FROM customers WHERE payment_method = "Cash"
3,451
<question>: Find the "date became customers" of the customers whose ID is between 10 and 20. <context>: CREATE TABLE customers (date_became_customer VARCHAR, customer_id INTEGER)
SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20
3,452
<question>: Which payment method is used by most customers? <context>: CREATE TABLE customers (payment_method VARCHAR)
SELECT payment_method FROM customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1
3,453
<question>: What are the names of customers using the most popular payment method? <context>: CREATE TABLE customers (customer_name VARCHAR, payment_method VARCHAR)
SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1)
3,454
<question>: What are all the payment methods? <context>: CREATE TABLE customers (payment_method VARCHAR)
SELECT DISTINCT payment_method FROM customers
3,455
<question>: What are the details of all products? <context>: CREATE TABLE products (product_details VARCHAR)
SELECT DISTINCT product_details FROM products
3,456
<question>: Find the name of all customers whose name contains "Alex". <context>: CREATE TABLE customers (customer_name VARCHAR)
SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%"
3,457
<question>: Find the detail of products whose detail contains the word "Latte" or the word "Americano" <context>: CREATE TABLE products (product_details VARCHAR)
SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"
3,458
<question>: What is the address content of the customer named "Maudie Kertzmann"? <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)
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"
3,459
<question>: How many customers are living in city "Lake Geovannyton"? <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)
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"
3,460
<question>: Find the name of customers who are living in Colorado? <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)
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"
3,461
<question>: Find the list of cities that no customer is living in. <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)
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)
3,462
<question>: Which city has the most customers living in? <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)
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
3,463
<question>: Find the city with post code 255. <context>: CREATE TABLE addresses (city VARCHAR, zip_postcode VARCHAR)
SELECT city FROM addresses WHERE zip_postcode = 255
3,464
<question>: Find the state and country of all cities with post code starting with 4. <context>: CREATE TABLE addresses (state_province_county VARCHAR, country VARCHAR, zip_postcode VARCHAR)
SELECT state_province_county, country FROM addresses WHERE zip_postcode LIKE "4%"
3,465
<question>: List the countries having more than 4 addresses listed. <context>: CREATE TABLE addresses (country VARCHAR, address_id VARCHAR)
SELECT country FROM addresses GROUP BY country HAVING COUNT(address_id) > 4
3,466
<question>: List all the contact channel codes that were used less than 5 times. <context>: CREATE TABLE customer_contact_channels (channel_code VARCHAR, customer_id VARCHAR)
SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING COUNT(customer_id) < 5
3,467
<question>: Which contact channel has been used by the customer with name "Tillman Ernser"? <context>: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customer_contact_channels (customer_id VARCHAR)
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"
3,468
<question>: What is the "active to date" of the latest contact channel used by "Tillman Ernser"? <context>: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customer_contact_channels (active_to_date INTEGER, customer_id VARCHAR)
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"
3,469
<question>: What is the average time span of contact channels in the database? <context>: CREATE TABLE customer_contact_channels (active_to_date VARCHAR, active_from_date VARCHAR)
SELECT AVG(active_to_date - active_from_date) FROM customer_contact_channels
3,470
<question>: What is the channel code and contact number of the customer contact channel that was active for the longest time? <context>: CREATE TABLE customer_contact_channels (channel_code VARCHAR, contact_number VARCHAR, active_to_date VARCHAR, active_from_date VARCHAR)
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)
3,471
<question>: Find the name and active date of the customer that use email as the contact channel. <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)
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'
3,472
<question>: What is the name of the customer that made the order with the largest quantity? <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)
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)
3,473
<question>: What is the name of the customer that has purchased the most 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)
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
3,474
<question>: What is the payment method of the customer that has purchased the least quantity of items? <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)
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
3,475
<question>: How many types of products have Rodrick Heaney bought in total? <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)
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"
3,476
<question>: What is the total quantity of products purchased by "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)
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"
3,477
<question>: How many customers have at least one order with status "Cancelled"? <context>: CREATE TABLE customer_orders (customer_id VARCHAR, order_status VARCHAR)
SELECT COUNT(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled"
3,478
<question>: How many orders have detail "Second time"? <context>: CREATE TABLE customer_orders (order_details VARCHAR)
SELECT COUNT(*) FROM customer_orders WHERE order_details = "Second time"
3,479
<question>: Find the customer name and date of the orders that have the status "Delivered". <context>: CREATE TABLE customer_orders (order_date VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
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"
3,480
<question>: What is the total number of products that are in orders with status "Cancelled"? <context>: CREATE TABLE customer_orders (order_id VARCHAR, order_status VARCHAR); CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR)
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"
3,481
<question>: Find the total amount of products ordered before 2018-03-17 07:13:53. <context>: CREATE TABLE customer_orders (order_id VARCHAR, order_date INTEGER); CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR)
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"
3,482
<question>: Who made the latest order? <context>: CREATE TABLE customer_orders (customer_id VARCHAR, order_date VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR)
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
3,483
<question>: Which product has been ordered most number of times? <context>: CREATE TABLE products (product_details VARCHAR, product_id VARCHAR); CREATE TABLE order_items (product_id VARCHAR)
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
3,484
<question>: Find the name and ID of the product whose total order quantity is the largest. <context>: CREATE TABLE order_items (product_id VARCHAR, order_quantity INTEGER); CREATE TABLE products (product_details VARCHAR, product_id VARCHAR)
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
3,485
<question>: Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona. <context>: CREATE TABLE addresses (address_content VARCHAR, city VARCHAR, state_province_county VARCHAR)
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"
3,486
<question>: Find the name of customers who did not pay with Cash. <context>: CREATE TABLE customers (customer_name VARCHAR, payment_method VARCHAR)
SELECT customer_name FROM customers WHERE payment_method <> 'Cash'
3,487
<question>: Find the names of customers who never ordered product Latte. <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)
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'
3,488
<question>: Find the names of customers who never placed an order. <context>: CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR)
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
3,489
<question>: Find the names of customers who ordered both products Latte and Americano. <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)
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'
3,490
<question>: List the age of all music artists. <context>: CREATE TABLE artist (Age VARCHAR)
SELECT Age FROM artist
3,491
<question>: What is the average age of all artists? <context>: CREATE TABLE artist (Age INTEGER)
SELECT AVG(Age) FROM artist
3,492
<question>: What are the famous titles of the artist "Triumfall"? <context>: CREATE TABLE artist (Famous_Title VARCHAR, Artist VARCHAR)
SELECT Famous_Title FROM artist WHERE Artist = "Triumfall"
3,493
<question>: What are the distinct Famous release dates? <context>: CREATE TABLE artist (Famous_Release_date VARCHAR)
SELECT DISTINCT (Famous_Release_date) FROM artist
3,494
<question>: Return the dates of ceremony and the results of all music festivals <context>: CREATE TABLE music_festival (Date_of_ceremony VARCHAR, RESULT VARCHAR)
SELECT Date_of_ceremony, RESULT FROM music_festival
3,495
<question>: What are the category of music festivals with result "Awarded"? <context>: CREATE TABLE music_festival (Category VARCHAR, RESULT VARCHAR)
SELECT Category FROM music_festival WHERE RESULT = "Awarded"
3,496
<question>: What are the maximum and minimum week on top of all volumes? <context>: CREATE TABLE volume (Weeks_on_Top INTEGER)
SELECT MAX(Weeks_on_Top), MIN(Weeks_on_Top) FROM volume
3,497
<question>: What are the songs in volumes with more than 1 week on top? <context>: CREATE TABLE volume (Song VARCHAR, Weeks_on_Top INTEGER)
SELECT Song FROM volume WHERE Weeks_on_Top > 1
3,498
<question>: Please list all songs in volumes in ascending alphabetical order. <context>: CREATE TABLE volume (Song VARCHAR)
SELECT Song FROM volume ORDER BY Song
3,499
<question>: How many distinct artists do the volumes associate to? <context>: CREATE TABLE volume (Artist_ID VARCHAR)
SELECT COUNT(DISTINCT Artist_ID) FROM volume