context
stringlengths 0
489
| instruction
stringlengths 16
244
| response
stringlengths 38
557
|
---|---|---|
CREATE TABLE TRANSACTIONS (investor_id VARCHAR); CREATE TABLE INVESTORS (Investor_details VARCHAR, investor_id VARCHAR) | Show the id and details of the investor that has the largest number of transactions. | SELECT T2.investor_id, T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE TRANSACTIONS (investor_id VARCHAR); CREATE TABLE INVESTORS (Investor_details VARCHAR, investor_id VARCHAR) | Show the id and details for the investors who have the top 3 number of transactions. | SELECT T2.investor_id, T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3 |
CREATE TABLE table_name_7 (position VARCHAR, fa_cup_apps VARCHAR, name VARCHAR) | Gary Barnett who has been in 0 FA Cups plays what position? | SELECT position FROM table_name_7 WHERE fa_cup_apps = "0" AND name = "gary barnett" |
CREATE TABLE TRANSACTIONS (investor_id VARCHAR, transaction_type_code VARCHAR); CREATE TABLE INVESTORS (Investor_details VARCHAR, investor_id VARCHAR) | Show the ids and details of the investors who have at least two transactions with type code "SALE". | SELECT T2.investor_id, T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.transaction_type_code = "SALE" GROUP BY T2.investor_id HAVING COUNT(*) >= 2 |
CREATE TABLE Lots (lot_details VARCHAR, lot_id VARCHAR); CREATE TABLE Lots (lot_details VARCHAR); CREATE TABLE transactions_lots (lot_id VARCHAR) | What are the details of the lots which are not used in any transactions? | SELECT lot_details FROM Lots EXCEPT SELECT T1.lot_details FROM Lots AS T1 JOIN transactions_lots AS T2 ON T1.lot_id = T2.lot_id |
CREATE TABLE table_name_47 (portfolio_attachment VARCHAR, age_at_appointment VARCHAR, chinese_name VARCHAR) | What is the portfolio attachment of the Undersecretary appointed at age 48 with a Chinese name of ζ’ι³³ε? | SELECT portfolio_attachment FROM table_name_47 WHERE age_at_appointment = 48 AND chinese_name = "ζ’ι³³ε" |
CREATE TABLE table_name_70 (transfer_fee VARCHAR, transfer_window VARCHAR, name VARCHAR) | What is the transfer fee of assoumani, who has a summer transfer window? | SELECT transfer_fee FROM table_name_70 WHERE transfer_window = "summer" AND name = "assoumani" |
CREATE TABLE table_23286722_1 (series__number INTEGER, written_by VARCHAR) | Name least series number for writers david e. kelley & jill goldsmith | SELECT MIN(series__number) FROM table_23286722_1 WHERE written_by = "David E. Kelley & Jill Goldsmith" |
CREATE TABLE table_name_5 (ends VARCHAR, transfer_fee VARCHAR, moving_from VARCHAR) | What is the ends with a free transfer fee and was moved from middlesbrough? | SELECT ends FROM table_name_5 WHERE transfer_fee = "free" AND moving_from = "middlesbrough" |
CREATE TABLE table_name_97 (location VARCHAR, method VARCHAR, opponent VARCHAR) | Which location has a method of decision and Nikos Tsoukalas for an opponent? | SELECT location FROM table_name_97 WHERE method = "decision" AND opponent = "nikos tsoukalas" |
CREATE TABLE table_23292220_3 (first_broadcast VARCHAR, daves_team VARCHAR) | What is the first broadcast date of the episode in which Dave's team is made up of Dave Johns and Sally Lindsay? | SELECT first_broadcast FROM table_23292220_3 WHERE daves_team = "Dave Johns and Sally Lindsay" |
CREATE TABLE TOURIST_ATTRACTIONS (Opening_Hours VARCHAR, Tourist_Attraction_ID VARCHAR); CREATE TABLE MUSEUMS (Museum_Details VARCHAR, Museum_ID VARCHAR) | What are the details and opening hours of the museums? | SELECT T1.Museum_Details, T2.Opening_Hours FROM MUSEUMS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Museum_ID = T2.Tourist_Attraction_ID |
CREATE TABLE table_23292220_3 (episode VARCHAR, daves_team VARCHAR) | In how many episodes was Dave's team made up of David Walliams and Louis Walsh? | SELECT COUNT(episode) FROM table_23292220_3 WHERE daves_team = "David Walliams and Louis Walsh" |
CREATE TABLE TOURIST_ATTRACTIONS (Tourist_Attraction_ID VARCHAR, Name VARCHAR); CREATE TABLE PHOTOS (Name VARCHAR, Description VARCHAR, Tourist_Attraction_ID VARCHAR) | What are the names and descriptions of the photos taken at the tourist attraction "film festival"? | SELECT T1.Name, T1.Description FROM PHOTOS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = "film festival" |
CREATE TABLE table_23292220_4 (episode VARCHAR, daves_team VARCHAR) | Which episode has boy george and lee mack on dave's team? | SELECT episode FROM table_23292220_4 WHERE daves_team = "Boy George and Lee Mack" |
CREATE TABLE TOURIST_ATTRACTIONS (How_to_Get_There VARCHAR, Tourist_Attraction_ID VARCHAR); CREATE TABLE ROYAL_FAMILY (Royal_Family_Details VARCHAR, Royal_Family_ID VARCHAR) | What are the details and ways to get to tourist attractions related to royal family? | SELECT T1.Royal_Family_Details, T2.How_to_Get_There FROM ROYAL_FAMILY AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Royal_Family_ID = T2.Tourist_Attraction_ID |
CREATE TABLE TOURIST_ATTRACTIONS (Name VARCHAR, Tourist_Attraction_ID VARCHAR); CREATE TABLE PHOTOS (Tourist_Attraction_ID VARCHAR, Name VARCHAR) | What is the name of the tourist attraction that is associated with the photo "game1"? | SELECT T2.Name FROM PHOTOS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T1.Name = "game1" |
CREATE TABLE Street_Markets (Market_Details VARCHAR, Market_ID VARCHAR); CREATE TABLE TOURIST_ATTRACTIONS (Tourist_Attraction_ID VARCHAR, How_to_Get_There VARCHAR) | What are the details of the markets that can be accessed by walk or bus? | SELECT T1.Market_Details FROM Street_Markets AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Market_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = "walk" OR T2.How_to_Get_There = "bus" |
CREATE TABLE table_23292220_4 (scores VARCHAR, seans_team VARCHAR) | What was the score in the episode with john barrowman and vic reeves on sean's team? | SELECT scores FROM table_23292220_4 WHERE seans_team = "John Barrowman and Vic Reeves" |
CREATE TABLE VISITS (Tourist_Attraction_ID VARCHAR, Tourist_ID VARCHAR); CREATE TABLE VISITORS (Tourist_ID VARCHAR, Tourist_Details VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, Tourist_Attraction_ID VARCHAR) | Which tourist attractions does the visitor with detail 'Vincent' visit? | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN VISITORS AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = "Vincent" |
CREATE TABLE VISITORS (Tourist_ID VARCHAR, Tourist_Details VARCHAR); CREATE TABLE VISITS (Visit_Date VARCHAR, Tourist_Attraction_ID VARCHAR, Tourist_ID VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, Tourist_Attraction_ID VARCHAR) | What are the names of the tourist attractions and the dates when the tourists named Vincent or Vivian visited there? | SELECT T1.Name, T3.Visit_Date 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" OR T2.Tourist_Details = "Vivian" |
CREATE TABLE table_23292220_17 (first_broadcast VARCHAR, seans_team VARCHAR) | Name the first broadcast for tina malone and joe wilkinson | SELECT first_broadcast FROM table_23292220_17 WHERE seans_team = "Tina Malone and Joe Wilkinson" |
CREATE TABLE table_name_26 (fourth_place VARCHAR, runners_up VARCHAR) | What fourth-place has 2 (1999, 2005) as the runner(s)-up? | SELECT fourth_place FROM table_name_26 WHERE runners_up = "2 (1999, 2005)" |
CREATE TABLE HOTELS (other_hotel_details VARCHAR, star_rating_code VARCHAR, price_range VARCHAR) | Show the details and star ratings of the 3 least expensive hotels. | SELECT other_hotel_details, star_rating_code FROM HOTELS ORDER BY price_range LIMIT 3 |
CREATE TABLE table_23292220_6 (episode VARCHAR, seans_team VARCHAR) | In how many episodes were Vanessa Feltz and Lee Mack the team for Sean? | SELECT COUNT(episode) FROM table_23292220_6 WHERE seans_team = "Vanessa Feltz and Lee Mack" |
CREATE TABLE Ref_Attraction_Types (Attraction_Type_Description VARCHAR, Attraction_Type_Code VARCHAR); CREATE TABLE Tourist_Attractions (Attraction_Type_Code VARCHAR) | Show the description and code of the attraction type most tourist attractions belong to. | SELECT T1.Attraction_Type_Description, T2.Attraction_Type_Code FROM Ref_Attraction_Types AS T1 JOIN Tourist_Attractions AS T2 ON T1.Attraction_Type_Code = T2.Attraction_Type_Code GROUP BY T2.Attraction_Type_Code ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE Tourist_Attractions (How_to_Get_There VARCHAR) | Show different ways to get to attractions and the number of attractions that can be accessed in the corresponding way. | SELECT How_to_Get_There, COUNT(*) FROM Tourist_Attractions GROUP BY How_to_Get_There |
CREATE TABLE VISITS (Tourist_Attraction_ID VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, Tourist_Attraction_ID VARCHAR) | Show different tourist attractions' names, ids, and the corresponding number of visits. | SELECT T1.Name, T2.Tourist_Attraction_ID, COUNT(*) FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID |
CREATE TABLE VISITS (Tourist_Attraction_ID VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, Tourist_Attraction_ID VARCHAR) | Show the names and ids of tourist attractions that are visited at least two times. | SELECT T1.Name, T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING COUNT(*) >= 2 |
CREATE TABLE VISITS (Tourist_Attraction_ID VARCHAR); CREATE TABLE Tourist_Attractions (Name VARCHAR, Tourist_Attraction_ID VARCHAR) | Show the names and ids of tourist attractions that are visited at most once. | SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING COUNT(*) <= 1 |
CREATE TABLE Tourist_Attractions (Name VARCHAR, Location_ID VARCHAR, How_to_Get_There VARCHAR); CREATE TABLE Locations (Location_ID VARCHAR, Address VARCHAR) | What are the names of tourist attractions that can be reached by walk or is at address 660 Shea Crescent? | SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "660 Shea Crescent" OR T2.How_to_Get_There = "walk" |
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) | What are the names of the tourist attractions that have parking or shopping as their feature details? | 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' |
CREATE TABLE Tourist_Attractions (Name VARCHAR, Location_ID VARCHAR, How_to_Get_There VARCHAR); CREATE TABLE Locations (Location_ID VARCHAR, Address VARCHAR) | What are the names of tourist attractions that can be reached by bus or is at address 254 Ottilie Junction? | 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" |
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) | What are the names of the tourist attractions Vincent and Marcelle visit? | 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" |
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) | What are the names of tourist attraction that Alison visited but Rosalind did not visit? | 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" |
CREATE TABLE table_name_10 (years VARCHAR, school VARCHAR) | What school year is vaucluse public school? | SELECT years FROM table_name_10 WHERE school = "vaucluse public school" |
CREATE TABLE table_name_75 (surface VARCHAR, score VARCHAR, date VARCHAR, championship VARCHAR) | What was the surface later than 1979, for the Melbourne Indoor, Australia, and the score was 2β6, 6β2, 6β2? | SELECT surface FROM table_name_75 WHERE date > 1979 AND championship = "melbourne indoor, australia" AND score = "2β6, 6β2, 6β2" |
CREATE TABLE table_name_91 (original_title VARCHAR, film_title_used_in_nomination VARCHAR) | What was the original title for the film used in nomination of street days? | SELECT original_title FROM table_name_91 WHERE film_title_used_in_nomination = "street days" |
CREATE TABLE table_name_67 (production VARCHAR, award_ceremony VARCHAR, result VARCHAR, year VARCHAR) | Which Production in 2009 had a Result of Nominated at the Helpmann awards Award Ceremony? | SELECT production FROM table_name_67 WHERE result = "nominated" AND year = 2009 AND award_ceremony = "helpmann awards" |
CREATE TABLE table_name_64 (rider VARCHAR, bike VARCHAR, time VARCHAR, laps VARCHAR, grid VARCHAR) | Who was the rider riding the Kawasaki ZX-6r, that rode less than 22 laps, and the grid was greater than 19, and retirement was the time? | SELECT rider FROM table_name_64 WHERE laps < 22 AND grid > 19 AND time = "retirement" AND bike = "kawasaki zx-6r" |
CREATE TABLE table_23308178_4 (points INTEGER, date VARCHAR) | How many points were there scored on October 27? | SELECT MAX(points) FROM table_23308178_4 WHERE date = "October 27" |
CREATE TABLE table_23308178_5 (score VARCHAR, record VARCHAR) | How many different scores are there for the game with 10-3-4 record? | SELECT COUNT(score) FROM table_23308178_5 WHERE record = "10-3-4" |
CREATE TABLE table_name_21 (exaltation VARCHAR, fall VARCHAR) | Which exaltation has a fall of moon? | SELECT exaltation FROM table_name_21 WHERE fall = "moon" |
CREATE TABLE Student (Lname VARCHAR, StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR, onscholarship VARCHAR) | Show last names for all student who are on scholarship. | SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y' |
CREATE TABLE table_name_30 (nationality VARCHAR, previous_team VARCHAR, years_of_nba_experience_ VARCHAR, a_ VARCHAR) | Which Nationality has a Previous team of new york knicks, and more than 3 Years of NBA experience? | SELECT nationality FROM table_name_30 WHERE previous_team = "new york knicks" AND years_of_nba_experience_[a_] > 3 |
CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, StuID VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR) | What is the first name and last name of the student who have most number of sports? | 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 |
CREATE TABLE Sportsinfo (sportname VARCHAR, onscholarship VARCHAR) | Which sport has most number of students on scholarship? | SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE table_2331549_1 (champion VARCHAR, third_place VARCHAR) | Who were the champions in years where michigan technological university was in third place? | SELECT champion FROM table_2331549_1 WHERE third_place = "Michigan Technological University" |
CREATE TABLE Sportsinfo (StuID VARCHAR, sex VARCHAR, sportname VARCHAR); CREATE TABLE Student (StuID VARCHAR, sex VARCHAR, sportname VARCHAR) | Show all male student ids who don't play football. | SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football" |
CREATE TABLE Student (StuID VARCHAR, Fname VARCHAR, Lname VARCHAR); CREATE TABLE Sportsinfo (StuID VARCHAR) | Show total hours per week and number of games played for student David Shieber. | 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" |
CREATE TABLE table_name_73 (Id VARCHAR) | What is 2011, when 2012 is "1R"? | SELECT 2011 FROM table_name_73 WHERE 2012 = "1r" |
CREATE TABLE Student (Stuid VARCHAR, Lname VARCHAR, Fname VARCHAR); CREATE TABLE Plays_games (gameid VARCHAR, Stuid VARCHAR); CREATE TABLE Video_games (gameid VARCHAR) | Show all game names played by Linda Smith | 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" |
CREATE TABLE SportsInfo (StuID VARCHAR, SportName VARCHAR); CREATE TABLE Student (lname VARCHAR, fname VARCHAR, StuID VARCHAR) | Find the last and first name of students who are playing Football or Lacrosse. | 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" |
CREATE TABLE Student (fname VARCHAR, age VARCHAR, StuID VARCHAR, SportName VARCHAR); CREATE TABLE Sportsinfo (fname VARCHAR, age VARCHAR, StuID VARCHAR, SportName VARCHAR) | Find the first name and age of the students who are playing both Football and Lacrosse. | SELECT fname, age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse") |
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) | Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games. | 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") |
CREATE TABLE table_23338693_1 (season VARCHAR, team VARCHAR) | How many seasons have motopark team? | SELECT COUNT(season) FROM table_23338693_1 WHERE team = "Motopark" |
CREATE TABLE customers (customer_name VARCHAR, payment_method VARCHAR) | What are the names of customers using the most popular payment method? | SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1) |
CREATE TABLE table_name_17 (colors VARCHAR, school VARCHAR) | What Colors has a School of zeigler high school? | SELECT colors FROM table_name_17 WHERE school = "zeigler high school" |
CREATE TABLE table_23346303_4 (games_played INTEGER, player VARCHAR) | How many games did janae stokes play? | SELECT MAX(games_played) FROM table_23346303_4 WHERE player = "Janae Stokes" |
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) | What is the address content of the customer named "Maudie Kertzmann"? | 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" |
CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE addresses (address_id VARCHAR, city VARCHAR); CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR) | How many customers are living in city "Lake Geovannyton"? | 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" |
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) | Find the name of customers who are living in Colorado? | 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" |
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) | Find the list of cities that no customer is living in. | 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) |
CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE customer_addresses (customer_id VARCHAR, address_id VARCHAR) | Which city has the most customers living in? | 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 |
CREATE TABLE table_name_45 (weekly_winner VARCHAR) | What is 18-49, when Weekly Winner is "Youth Counselor Justin Meece"? | SELECT 18 AS _49 FROM table_name_45 WHERE weekly_winner = "youth counselor justin meece" |
CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customer_contact_channels (customer_id VARCHAR) | Which contact channel has been used by the customer with name "Tillman Ernser"? | 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" |
CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR); CREATE TABLE customer_contact_channels (active_to_date INTEGER, customer_id VARCHAR) | What is the "active to date" of the latest contact channel used by "Tillman Ernser"? | 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" |
CREATE TABLE table_23390604_1 (mahmoud_ahmadinejad VARCHAR, mir_hossein_mousavi VARCHAR) | List all the results for mahmoud ahmadinejad when candidate mir-hossein mousavi obtained 218481 votes. | SELECT mahmoud_ahmadinejad FROM table_23390604_1 WHERE mir_hossein_mousavi = 218481 |
CREATE TABLE customer_contact_channels (channel_code VARCHAR, contact_number VARCHAR, active_to_date VARCHAR, active_from_date VARCHAR) | What is the channel code and contact number of the customer contact channel that was active for the longest time? | 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) |
CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_contact_channels (active_from_date VARCHAR, customer_id VARCHAR, channel_code VARCHAR) | Find the name and active date of the customer that use email as the contact channel. | 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' |
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) | What is the name of the customer that made the order with the largest quantity? | 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) |
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) | What is the name of the customer that has purchased the most items? | 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 |
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) | What is the payment method of the customer that has purchased the least quantity of items? | 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 |
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) | How many types of products have Rodrick Heaney bought in total? | 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" |
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) | What is the total quantity of products purchased by "Rodrick Heaney"? | 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" |
CREATE TABLE table_23390604_1 (mir_hossein_mousavi INTEGER, spoiled_ballots VARCHAR) | What was the highest number of votes for mir-hossein mousavi when the number of invalid votes is 5683 | SELECT MAX(mir_hossein_mousavi) FROM table_23390604_1 WHERE spoiled_ballots = 5683 |
CREATE TABLE table_23394920_1 (branding VARCHAR, power_kw VARCHAR, station_type VARCHAR) | When relay is the station type and 5kw is the power kw what is the branding? | SELECT branding FROM table_23394920_1 WHERE power_kw = "5kW" AND station_type = "Relay" |
CREATE TABLE customer_orders (order_date VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR) | Find the customer name and date of the orders that have the status "Delivered". | 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" |
CREATE TABLE customer_orders (order_id VARCHAR, order_status VARCHAR); CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR) | What is the total number of products that are in orders with status "Cancelled"? | 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" |
CREATE TABLE customer_orders (order_id VARCHAR, order_date INTEGER); CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR) | Find the total amount of products ordered before 2018-03-17 07:13:53. | 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" |
CREATE TABLE table_name_91 (score VARCHAR, attendance VARCHAR, away_team VARCHAR) | What is the score when the attendance is less than 83 and Raunds Town is the away team? | SELECT score FROM table_name_91 WHERE attendance < 83 AND away_team = "raunds town" |
CREATE TABLE products (product_details VARCHAR, product_id VARCHAR); CREATE TABLE order_items (product_id VARCHAR) | Which product has been ordered most number of times? | 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 |
CREATE TABLE order_items (product_id VARCHAR, order_quantity INTEGER); CREATE TABLE products (product_details VARCHAR, product_id VARCHAR) | Find the name and ID of the product whose total order quantity is the largest. | 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 |
CREATE TABLE addresses (address_content VARCHAR, city VARCHAR, state_province_county VARCHAR) | Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona. | 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" |
CREATE TABLE table_23392257_4 (original_airdate VARCHAR, _number VARCHAR) | What date did Episode 22 originally air? | SELECT COUNT(original_airdate) FROM table_23392257_4 WHERE _number = 22 |
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) | Find the names of customers who never ordered product Latte. | 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' |
CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR) | Find the names of customers who never placed an order. | 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 |
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) | Find the names of customers who ordered both products Latte and Americano. | 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' |
CREATE TABLE table_name_44 (position VARCHAR, team VARCHAR, player VARCHAR) | WHAT IS THE POSITION WITH BOSTON RED SOX FOR COREY JENKINS? | SELECT position FROM table_name_44 WHERE team = "boston red sox" AND player = "corey jenkins" |
CREATE TABLE table_23394920_1 (station_type VARCHAR, callsign VARCHAR) | When dwhr-tv is the call sign how many station types are there? | SELECT COUNT(station_type) FROM table_23394920_1 WHERE callsign = "DWHR-TV" |
CREATE TABLE music_festival (Date_of_ceremony VARCHAR, Volume VARCHAR); CREATE TABLE volume (Volume_ID VARCHAR, Weeks_on_Top INTEGER) | Please show the date of ceremony of the volumes that last more than 2 weeks on top. | SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T2.Weeks_on_Top > 2 |
CREATE TABLE table_23406517_2 (bearing___degrees VARCHAR) | How many values when the bearing or degrees is 67.6 - 82.5 82.6 - 97.5 97.6 - 112.5? | SELECT COUNT(*) FROM table_23406517_2 WHERE bearing___degrees = "67.6 - 82.5 82.6 - 97.5 97.6 - 112.5" |
CREATE TABLE table_23406517_2 (trigram VARCHAR, direction VARCHAR) | What is every trigram when direction is Northwest? | SELECT trigram FROM table_23406517_2 WHERE direction = "Northwest" |
CREATE TABLE volume (Song VARCHAR, Artist_ID VARCHAR); CREATE TABLE artist (Artist_ID VARCHAR, age VARCHAR) | What are the songs in volumes associated with the artist aged 32 or older? | SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32 |
CREATE TABLE table_name_15 (year INTEGER, death_toll VARCHAR, cause VARCHAR, colliery VARCHAR) | Count the lowest Year which has gas explosion, Colliery of tylorstown colliery, and a Death toll larger than 57? | SELECT MIN(year) FROM table_name_15 WHERE cause = "gas explosion" AND colliery = "tylorstown colliery" AND death_toll > 57 |
CREATE TABLE artist (Famous_Title VARCHAR, Artist_ID VARCHAR); CREATE TABLE volume (Artist_ID VARCHAR, Weeks_on_Top INTEGER) | What are the famous title of the artists associated with volumes with more than 2 weeks on top? | SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 |
CREATE TABLE table_23408094_14 (total_career_titles VARCHAR, player VARCHAR) | How many career titles does roy emerson have? | SELECT total_career_titles FROM table_23408094_14 WHERE player = "Roy Emerson" |
CREATE TABLE table_name_60 (date VARCHAR, location VARCHAR, cause VARCHAR, death_toll VARCHAR) | When has a cause of gas explosion, a Death toll smaller than 63, and a Location of penygraig? | SELECT date FROM table_name_60 WHERE cause = "gas explosion" AND death_toll < 63 AND location = "penygraig" |
CREATE TABLE table_2342078_2 (episode__number INTEGER, written_by VARCHAR) | What is the highest episode# with the writer Paul West? | SELECT MAX(episode__number) FROM table_2342078_2 WHERE written_by = "Paul West" |
CREATE TABLE artist (Famous_Title VARCHAR, Artist_ID VARCHAR); CREATE TABLE volume (Artist_ID VARCHAR, Weeks_on_Top INTEGER) | Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top. | SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.