context
stringlengths 0
489
| instruction
stringlengths 16
244
| response
stringlengths 38
557
|
---|---|---|
CREATE TABLE ENROLLED_IN (Grade VARCHAR, StuID VARCHAR); CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE GRADECONVERSION (gradepoint INTEGER, lettergrade VARCHAR) | Find the average grade point of student whose last name is Smith. | SELECT AVG(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.LName = "Smith" |
CREATE TABLE ENROLLED_IN (Grade VARCHAR, StuID VARCHAR); CREATE TABLE STUDENT (city_code VARCHAR, StuID VARCHAR); CREATE TABLE GRADECONVERSION (gradepoint INTEGER, lettergrade VARCHAR) | What is the maximum and minimum grade point of students who live in NYC? | SELECT MAX(T2.gradepoint), MIN(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.city_code = "NYC" |
CREATE TABLE table_22654073_7 (high_points VARCHAR, high_rebounds VARCHAR) | Name the high points for mo williams , lebron james , j.j. hickson (6) | SELECT COUNT(high_points) FROM table_22654073_7 WHERE high_rebounds = "Mo Williams , LeBron James , J.J. Hickson (6)" |
CREATE TABLE table_22654073_8 (score VARCHAR, record VARCHAR) | How many scores are associated with a record of 27-9? | SELECT COUNT(score) FROM table_22654073_8 WHERE record = "27-9" |
CREATE TABLE table_name_14 (to_par VARCHAR, country VARCHAR, score VARCHAR) | Which To par has a Country of united states, and a Score of 71-70=141? | SELECT to_par FROM table_name_14 WHERE country = "united states" AND score = 71 - 70 = 141 |
CREATE TABLE staff_department_assignments (staff_id VARCHAR, job_title_code VARCHAR); CREATE TABLE staff (staff_id VARCHAR, staff_gender VARCHAR) | What are the staff ids and genders of all staffs whose job title is Department Manager? | SELECT T1.staff_id, T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Department Manager" |
CREATE TABLE table_name_45 (result VARCHAR, award VARCHAR) | Which Result has an Award of virgin media tv awards? | SELECT result FROM table_name_45 WHERE award = "virgin media tv awards" |
CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, customer_email VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR) | What are the name, phone number and email address of the customer who made the largest number of orders? | SELECT T1.customer_name, T1.customer_phone, T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE department_stores (dept_store_chain_id VARCHAR); CREATE TABLE department_store_chain (dept_store_chain_id VARCHAR, dept_store_chain_name VARCHAR) | How many department stores does the store chain South have? | SELECT COUNT(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = "South" |
CREATE TABLE table_22656187_9 (round VARCHAR, w_l VARCHAR, edition VARCHAR) | Which round has a win-loss result of loss and an edition of 2012 Fed Cup Europe/Africa Group I? | SELECT round FROM table_22656187_9 WHERE w_l = "Loss" AND edition = "2012 Fed Cup Europe/Africa Group I" |
CREATE TABLE products (product_type_code VARCHAR, product_name VARCHAR, product_price VARCHAR, product_id VARCHAR); CREATE TABLE product_suppliers (product_id VARCHAR, supplier_id VARCHAR) | Give me the product type, name and price for all the products supplied by supplier id 3. | SELECT T2.product_type_code, T2.product_name, T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3 |
CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_status_code VARCHAR) | Return the distinct name of customers whose order status is Pending, in the order of customer id. | SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending" ORDER BY T2.customer_id |
CREATE TABLE customers (customer_name VARCHAR, customer_address VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_status_code VARCHAR) | Find the name and address of the customers who have both New and Pending orders. | SELECT T1.customer_name, T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "New" INTERSECT SELECT T1.customer_name, T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending" |
CREATE TABLE products (product_id VARCHAR, product_price INTEGER); CREATE TABLE product_suppliers (product_id VARCHAR, supplier_id VARCHAR); CREATE TABLE products (product_price INTEGER) | Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products. | SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT AVG(product_price) FROM products) |
CREATE TABLE department_stores (dept_store_id VARCHAR, store_name VARCHAR); CREATE TABLE departments (dept_store_id VARCHAR, department_name VARCHAR) | What is the id and name of the department store that has both marketing and managing department? | SELECT T2.dept_store_id, T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "marketing" INTERSECT SELECT T2.dept_store_id, T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "managing" |
CREATE TABLE staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE staff_department_assignments (job_title_code VARCHAR, staff_id VARCHAR, date_assigned_to VARCHAR) | What is the name and job title of the staff who was assigned the latest? | SELECT T1.staff_name, T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1 |
CREATE TABLE Staff_Department_Assignments (staff_id VARCHAR); CREATE TABLE staff (staff_id VARCHAR, staff_name VARCHAR) | Find the id and name of the staff who has been assigned for the shortest period. | SELECT T1.staff_id, T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1 |
CREATE TABLE products (product_name VARCHAR, product_id VARCHAR, product_price INTEGER) | Return the names and ids of all products whose price is between 600 and 700. | SELECT product_name, product_id FROM products WHERE product_price BETWEEN 600 AND 700 |
CREATE TABLE Staff_Department_Assignments (staff_id VARCHAR, date_assigned_to INTEGER, job_title_code VARCHAR) | What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff? | SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT MAX(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff') |
CREATE TABLE table_name_2 (mutated_from VARCHAR, habit VARCHAR, pattern VARCHAR) | Who's the inventor when it was mutated from Redsport Type 2, has a stripe pattern and a spur habit? | SELECT "inventor" FROM table_name_2 WHERE habit = "spur" AND pattern = "stripe" AND mutated_from = "redsport type 2" |
CREATE TABLE staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE staff_department_assignments (staff_id VARCHAR) | List the name of staff who has been assigned multiple jobs. | SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id HAVING COUNT(*) > 1 |
CREATE TABLE addresses (address_id VARCHAR, address_details VARCHAR); CREATE TABLE supplier_addresses (supplier_id VARCHAR, address_id VARCHAR); CREATE TABLE Suppliers (supplier_name VARCHAR, supplier_phone VARCHAR, supplier_id VARCHAR) | List the name and phone number of all suppliers in the alphabetical order of their addresses. | SELECT T1.supplier_name, T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details |
CREATE TABLE staff (staff_name VARCHAR, staff_gender VARCHAR, staff_id VARCHAR); CREATE TABLE staff_department_assignments (staff_id VARCHAR, date_assigned_from VARCHAR) | Return the name and gender of the staff who was assigned in 2016. | SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE "2016%" |
CREATE TABLE Order_Items (product_id VARCHAR, total_amount_purchased INTEGER); CREATE TABLE Product_Suppliers (product_id VARCHAR, total_amount_purchased INTEGER) | Return the ids of all products that were ordered more than three times or supplied more than 80000. | SELECT product_id FROM Order_Items GROUP BY product_id HAVING COUNT(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING SUM(total_amount_purchased) > 80000 |
CREATE TABLE table_name_68 (top_speed VARCHAR) | What is the 0–100km/h (62mph) acceleration of the model with a top speed of 208km/h (129mph)? | SELECT 0 AS _100km_h__62mph_ FROM table_name_68 WHERE top_speed = "208km/h (129mph)" |
CREATE TABLE Product_Suppliers (supplier_id VARCHAR, total_amount_purchased INTEGER) | Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000. | SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING AVG(total_amount_purchased) > 50000 OR AVG(total_amount_purchased) < 30000 |
CREATE TABLE Product_Suppliers (total_amount_purchased INTEGER, total_value_purchased INTEGER, supplier_id VARCHAR) | What are the average amount purchased and value purchased for the supplier who supplies the most products. | SELECT AVG(total_amount_purchased), AVG(total_value_purchased) FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY COUNT(*) DESC LIMIT 1) |
CREATE TABLE table_2267345_2 (team_classification VARCHAR, young_rider_classification VARCHAR, combativity_award VARCHAR) | What is the total number of team classifications when the young rider classification leader was Salvatore Commesso and the combativity award winner was Jacky Durand? | SELECT COUNT(team_classification) FROM table_2267345_2 WHERE young_rider_classification = "Salvatore Commesso" AND combativity_award = "Jacky Durand" |
CREATE TABLE table_2267345_2 (general_classification VARCHAR, young_rider_classification VARCHAR, winner VARCHAR) | Who was the general classification leader when the young rider classification leader was Salvatore Commesso and the winner was Erik Dekker? | SELECT general_classification FROM table_2267345_2 WHERE young_rider_classification = "Salvatore Commesso" AND winner = "Erik Dekker" |
CREATE TABLE table_22673872_1 (rnd INTEGER, winning_driver VARCHAR, track VARCHAR) | In what round did Al Unser win at Wisconsin State Fair Park Speedway? | SELECT MIN(rnd) FROM table_22673872_1 WHERE winning_driver = "Al Unser" AND track = "Wisconsin State Fair Park Speedway" |
CREATE TABLE product_suppliers (supplier_id VARCHAR, product_id VARCHAR); CREATE TABLE suppliers (supplier_name VARCHAR, supplier_phone VARCHAR, supplier_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR) | List the names and phone numbers of all the distinct suppliers who supply red jeans. | SELECT DISTINCT T1.supplier_name, T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = "red jeans" |
CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR) | List the names of all the distinct customers who bought a keyboard. | SELECT DISTINCT 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_name = "keyboard" |
CREATE TABLE customer_orders (order_id VARCHAR, customer_id VARCHAR, order_status_code VARCHAR, order_date VARCHAR) | List the order id, customer id for orders in Cancelled status, ordered by their order dates. | SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = "Cancelled" ORDER BY order_date |
CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE customer_orders (order_id VARCHAR, customer_id VARCHAR); CREATE TABLE order_items (order_id VARCHAR, product_id VARCHAR) | Find the names of products that were bought by at least two distinct customers. | SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT(DISTINCT T1.customer_id) >= 2 |
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 have bought by at least three distinct products. | SELECT DISTINCT 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_id HAVING COUNT(DISTINCT T3.product_id) >= 3 |
CREATE TABLE staff (staff_name VARCHAR, staff_gender VARCHAR, staff_id VARCHAR); CREATE TABLE Staff_Department_Assignments (staff_id VARCHAR, job_title_code VARCHAR) | Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff. | SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Sales Person" EXCEPT SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Clerical Staff" |
CREATE TABLE table_name_90 (burglary INTEGER, forcible_rape VARCHAR, motor_vehicle_theft VARCHAR) | What is the smallest rate of burglary when forcible rape is 39.1 and motor vehicle theft is less than 568.8? | SELECT MIN(burglary) FROM table_name_90 WHERE forcible_rape = "39.1" AND motor_vehicle_theft < 568.8 |
CREATE TABLE table_name_78 (international INTEGER, domestic VARCHAR, year VARCHAR) | What is the number for the international with 669 domestic earlier than 2005? | SELECT AVG(international) FROM table_name_78 WHERE domestic = 669 AND year < 2005 |
CREATE TABLE table_name_6 (issue_date INTEGER, highest_position VARCHAR) | What is the largest issue date for an album that reached position of 3? | SELECT MAX(issue_date) FROM table_name_6 WHERE highest_position = 3 |
CREATE TABLE airport (Domestic_Passengers INTEGER, Airport_Name VARCHAR) | What are the total number of Domestic Passengers of airports that contain the word "London". | SELECT SUM(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%" |
CREATE TABLE airport (Airport_ID VARCHAR, Airport_Name VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR); CREATE TABLE airport_aircraft (Aircraft_ID VARCHAR, Airport_ID VARCHAR) | Please show the names of aircrafts associated with airport with name "London Gatwick". | SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" |
CREATE TABLE airport (Airport_ID VARCHAR, Total_Passengers INTEGER); CREATE TABLE aircraft (Aircraft VARCHAR, Description VARCHAR, Aircraft_ID VARCHAR); CREATE TABLE airport_aircraft (Aircraft_ID VARCHAR, Airport_ID VARCHAR) | Please show the names and descriptions of aircrafts associated with airports that have a total number of passengers bigger than 10000000. | SELECT T1.Aircraft, T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Total_Passengers > 10000000 |
CREATE TABLE airport (Total_Passengers INTEGER, Airport_ID VARCHAR); CREATE TABLE aircraft (Aircraft_ID VARCHAR, Aircraft VARCHAR); CREATE TABLE airport_aircraft (Aircraft_ID VARCHAR, Airport_ID VARCHAR) | What is the average total number of passengers of airports that are associated with aircraft "Robinson R-22"? | SELECT AVG(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T1.Aircraft = "Robinson R-22" |
CREATE TABLE table_22713796_14 (sprint_classification VARCHAR, winner VARCHAR) | Name the sprint classification being alejandro valverde | SELECT sprint_classification FROM table_22713796_14 WHERE winner = "Alejandro Valverde" |
CREATE TABLE table_22713796_14 (stage INTEGER, winner VARCHAR, general_classification VARCHAR, team_classification VARCHAR) | Name the most stage for alejandro valverde and astana greg henderson | SELECT MAX(stage) FROM table_22713796_14 WHERE general_classification = "Alejandro Valverde" AND team_classification = "Astana" AND winner = "Greg Henderson" |
CREATE TABLE MATCH (Location VARCHAR, Winning_Aircraft VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR) | Please list the location and the winning aircraft name. | SELECT T2.Location, T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft |
CREATE TABLE table_22719663_3 (experience VARCHAR, name VARCHAR) | How long has Mel Daniels been playing? | SELECT experience FROM table_22719663_3 WHERE name = "Mel Daniels" |
CREATE TABLE MATCH (Winning_Aircraft VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR) | List the names of aircrafts and that won matches at least twice. | SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2 |
CREATE TABLE airport (Airport_ID VARCHAR, Airport_Name VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR); CREATE TABLE airport_aircraft (Aircraft_ID VARCHAR, Airport_ID VARCHAR) | Show the names of aircrafts that are associated with both an airport named "London Heathrow" and an airport named "London Gatwick" | SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" |
CREATE TABLE MATCH (winning_pilot VARCHAR); CREATE TABLE pilot (name VARCHAR, age INTEGER, pilot_id VARCHAR) | find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30. | SELECT t1.name, t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE services (service_type_code VARCHAR, organization_id VARCHAR); CREATE TABLE organizations (organization_id VARCHAR, organization_details VARCHAR) | What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'? | SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id = T2.organization_id WHERE T2.organization_details = 'Denesik and Sons Party' |
CREATE TABLE Residents_Services (resident_id VARCHAR); CREATE TABLE Residents (resident_id VARCHAR, other_details VARCHAR) | How many services has each resident requested? List the resident id, details, and the count in descending order of the count. | SELECT T1.resident_id, T1.other_details, COUNT(*) FROM Residents AS T1 JOIN Residents_Services AS T2 ON T1.resident_id = T2.resident_id GROUP BY T1.resident_id ORDER BY COUNT(*) DESC |
CREATE TABLE Services (service_id VARCHAR, service_details VARCHAR); CREATE TABLE Residents_Services (service_id VARCHAR) | What is the maximum number that a certain service is provided? List the service id, details and number. | SELECT T1.service_id, T1.service_details, COUNT(*) FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id = T2.service_id GROUP BY T1.service_id ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE Organizations (organization_details VARCHAR, organization_id VARCHAR); CREATE TABLE Things (thing_id VARCHAR, type_of_Thing_Code VARCHAR, organization_id VARCHAR) | List the id and type of each thing, and the details of the organization that owns it. | SELECT T1.thing_id, T1.type_of_Thing_Code, T2.organization_details FROM Things AS T1 JOIN Organizations AS T2 ON T1.organization_id = T2.organization_id |
CREATE TABLE table_name_98 (injured VARCHAR, date VARCHAR) | What is Injured, when Date is "09.15 Sep. 15"? | SELECT injured FROM table_name_98 WHERE date = "09.15 sep. 15" |
CREATE TABLE Customer_Events (date_moved_in VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_details VARCHAR) | What is each customer's move in date, and the corresponding customer id and details? | SELECT T2.date_moved_in, T1.customer_id, T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id |
CREATE TABLE Customer_Events (Customer_Event_ID VARCHAR, property_id VARCHAR, customer_event_id VARCHAR); CREATE TABLE Customer_Event_Notes (Customer_Event_ID VARCHAR) | Which events have the number of notes between one and three? List the event id and the property id. | SELECT T1.Customer_Event_ID, T1.property_id FROM Customer_Events AS T1 JOIN Customer_Event_Notes AS T2 ON T1.Customer_Event_ID = T2.Customer_Event_ID GROUP BY T1.customer_event_id HAVING COUNT(*) BETWEEN 1 AND 3 |
CREATE TABLE Timed_Status_of_Things (thing_id VARCHAR, Status_of_Thing_Code VARCHAR, Date_and_Date VARCHAR); CREATE TABLE Things (thing_id VARCHAR, Type_of_Thing_Code VARCHAR) | What are the distinct id and type of the thing that has the status 'Close' or has a status record before the date '2017-06-19 02:59:21' | SELECT DISTINCT T2.thing_id, T2.Type_of_Thing_Code FROM Timed_Status_of_Things AS T1 JOIN Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.Status_of_Thing_Code = 'Close' OR T1.Date_and_Date < '2017-06-19 02:59:21' |
CREATE TABLE Timed_Locations_of_Things (Location_Code VARCHAR, thing_id VARCHAR); CREATE TABLE Things (thing_id VARCHAR, service_details VARCHAR) | How many distinct locations have the things with service detail 'Unsatisfied' been located in? | SELECT COUNT(DISTINCT T2.Location_Code) FROM Things AS T1 JOIN Timed_Locations_of_Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.service_details = 'Unsatisfied' |
CREATE TABLE table_name_90 (year INTEGER, award VARCHAR, nominated_work VARCHAR) | What is the earliest year with a Drama Desk award when the Mineola Twins was a nominated work? | SELECT MIN(year) FROM table_name_90 WHERE award = "drama desk award" AND nominated_work = "the mineola twins" |
CREATE TABLE table_name_54 (year INTEGER, award VARCHAR, nominated_work VARCHAR, category VARCHAR) | What is the most recent year that the Mineola Twins was nominated for outstanding actress in a play and a Drama Desk award? | SELECT MAX(year) FROM table_name_54 WHERE nominated_work = "the mineola twins" AND category = "outstanding actress in a play" AND award = "drama desk award" |
CREATE TABLE table_name_62 (year INTEGER, nominated_work VARCHAR, category VARCHAR) | In what year was The House of Blue Leaves nominated for outstanding actress in a play? | SELECT SUM(year) FROM table_name_62 WHERE nominated_work = "the house of blue leaves" AND category = "outstanding actress in a play" |
CREATE TABLE table_22753439_1 (winner VARCHAR, runner_up_a VARCHAR) | How many winners have a runner-up of A. Karthikeyan? | SELECT COUNT(winner) FROM table_22753439_1 WHERE runner_up_a = "A. Karthikeyan" |
CREATE TABLE table_name_15 (to_par VARCHAR, year_s__won VARCHAR) | Which To par has a Year(s) won of 1983? | SELECT to_par FROM table_name_15 WHERE year_s__won = "1983" |
CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE customer_events (customer_id VARCHAR) | How many customers did not have any event? | SELECT COUNT(*) FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_events) |
CREATE TABLE table_22753245_1 (margin VARCHAR, party VARCHAR, winner VARCHAR) | How many margin results are listed in the election that was won by L. Adaikalaraj C and the party was the Indian national congress? | SELECT COUNT(margin) FROM table_22753245_1 WHERE party = "Indian National Congress" AND winner = "L. Adaikalaraj c" |
CREATE TABLE table_22765887_1 (pole_position VARCHAR, date VARCHAR) | Who had the pole position in the August 15, 1981 race? | SELECT pole_position FROM table_22765887_1 WHERE date = "August 15, 1981" |
CREATE TABLE player (School_ID VARCHAR); CREATE TABLE school (Location VARCHAR, School_ID VARCHAR) | Show the locations of schools that have more than 1 player. | SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1 |
CREATE TABLE table_22771048_3 (extension VARCHAR, city_neighborhood VARCHAR) | Name the extension for university of washington | SELECT extension FROM table_22771048_3 WHERE city_neighborhood = "University of Washington" |
CREATE TABLE school (LOCATION VARCHAR, School_ID VARCHAR); CREATE TABLE Player (LOCATION VARCHAR, School_ID VARCHAR) | List the locations of schools that do not have any player. | SELECT LOCATION FROM school WHERE NOT School_ID IN (SELECT School_ID FROM Player) |
CREATE TABLE school (Denomination VARCHAR, Founded INTEGER) | Show the denomination shared by schools founded before 1890 and schools founded after 1900 | SELECT Denomination FROM school WHERE Founded < 1890 INTERSECT SELECT Denomination FROM school WHERE Founded > 1900 |
CREATE TABLE table_name_71 (week INTEGER, game_site VARCHAR, attendance VARCHAR) | Which Week has a Game site of oakland-alameda county coliseum, and an Attendance larger than 52,169? | SELECT MIN(week) FROM table_name_71 WHERE game_site = "oakland-alameda county coliseum" AND attendance > 52 OFFSET 169 |
CREATE TABLE table_2279413_1 (conversion_from_patent_application VARCHAR, maximum_term VARCHAR, pct_route_available VARCHAR) | When the PCT route available is yes and the maximum term is 10 years, what are the available conversions from patent applications? | SELECT conversion_from_patent_application FROM table_2279413_1 WHERE maximum_term = "10 years" AND pct_route_available = "Yes" |
CREATE TABLE table_22810095_8 (COUnT VARCHAR, country VARCHAR) | How many names have a country of civ? | SELECT COUnT AS name FROM table_22810095_8 WHERE country = "CIV" |
CREATE TABLE district (district_id VARCHAR, district_name VARCHAR); CREATE TABLE store_district (store_id VARCHAR, district_id VARCHAR); CREATE TABLE store (store_name VARCHAR, store_id VARCHAR) | Find the names of all stores in Khanewal District. | SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t3.district_name = "Khanewal District" |
CREATE TABLE store_district (store_id VARCHAR); CREATE TABLE district (district_id VARCHAR, city_population VARCHAR); CREATE TABLE store (store_name VARCHAR, store_id VARCHAR) | Find all the stores in the district with the most population. | SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id WHERE district_id = (SELECT district_id FROM district ORDER BY city_population DESC LIMIT 1) |
CREATE TABLE store (store_id VARCHAR, store_name VARCHAR); CREATE TABLE district (headquartered_city VARCHAR, district_id VARCHAR); CREATE TABLE store_district (store_id VARCHAR, district_id VARCHAR) | Which city is the headquarter of the store named "Blackville" in? | SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.store_name = "Blackville" |
CREATE TABLE district (headquartered_city VARCHAR, district_id VARCHAR); CREATE TABLE store_district (store_id VARCHAR, district_id VARCHAR); CREATE TABLE store (store_id VARCHAR) | Find the number of stores in each city. | SELECT t3.headquartered_city, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city |
CREATE TABLE district (headquartered_city VARCHAR, district_id VARCHAR); CREATE TABLE store_district (store_id VARCHAR, district_id VARCHAR); CREATE TABLE store (store_id VARCHAR) | Find the city with the most number of stores. | SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE store_product (product_id VARCHAR, store_id VARCHAR); CREATE TABLE store (store_id VARCHAR, store_name VARCHAR); CREATE TABLE product (product VARCHAR, product_id VARCHAR) | What products are available at store named "Miramichi"? | SELECT t1.product FROM product AS t1 JOIN store_product AS t2 ON t1.product_id = t2.product_id JOIN store AS t3 ON t2.store_id = t3.store_id WHERE t3.store_name = "Miramichi" |
CREATE TABLE product (product VARCHAR, max_page_size VARCHAR, pages_per_minute_color VARCHAR) | Find products with max page size as "A4" and pages per minute color smaller than 5. | SELECT product FROM product WHERE max_page_size = "A4" AND pages_per_minute_color < 5 |
CREATE TABLE table_name_75 (year INTEGER, winner VARCHAR) | In what year did Morgan Brian win? | SELECT AVG(year) FROM table_name_75 WHERE winner = "morgan brian" |
CREATE TABLE table_name_63 (winner VARCHAR, college VARCHAR, hometown VARCHAR) | Who is the winner who attended college at Connecticut and is from North Syracuse, NY? | SELECT winner FROM table_name_63 WHERE college = "connecticut" AND hometown = "north syracuse, ny" |
CREATE TABLE district (District_name VARCHAR, district_id VARCHAR); CREATE TABLE store (store_id VARCHAR, Type VARCHAR); CREATE TABLE store_district (store_id VARCHAR, district_id VARCHAR) | Find the names of districts where have both city mall and village store type stores. | SELECT t3.District_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.Type = "City Mall" INTERSECT SELECT t3.District_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.Type = "Village Store" |
CREATE TABLE table_name_85 (wins INTEGER, byes VARCHAR, against VARCHAR, golden_rivers VARCHAR) | What is the sum of Wins, when Against is less than 1033, when Golden Rivers is "Nullawil", and when Byes is less than 2? | SELECT SUM(wins) FROM table_name_85 WHERE against < 1033 AND golden_rivers = "nullawil" AND byes < 2 |
CREATE TABLE table_22815259_1 (record VARCHAR, opponent VARCHAR) | Name the record for arizona | SELECT record FROM table_22815259_1 WHERE opponent = "Arizona" |
CREATE TABLE table_name_26 (year INTEGER, competition VARCHAR, notes VARCHAR) | Which Year has a Competition of european championships, and Notes of 66.81 m? | SELECT SUM(year) FROM table_name_26 WHERE competition = "european championships" AND notes = "66.81 m" |
CREATE TABLE table_name_43 (season INTEGER, households_viewers__in_millions_ VARCHAR, viewer_rank___number_ VARCHAR) | Which season had less than 25.4 viewers and had a viewer rank of #6? | SELECT MIN(season) FROM table_name_43 WHERE households_viewers__in_millions_ < 25.4 AND viewer_rank___number_ = "#6" |
CREATE TABLE table_name_3 (bronze INTEGER, silver VARCHAR, total VARCHAR, gold VARCHAR) | What is the lowest number of bronze of the nation with more than 13 total medals, more than 10 gold medals, and less than 22 silvers? | SELECT MIN(bronze) FROM table_name_3 WHERE total > 13 AND gold > 10 AND silver < 22 |
CREATE TABLE table_22815568_6 (county VARCHAR, poverty_rate VARCHAR) | If the poverty rate is 12.9%, what is the county? | SELECT county FROM table_22815568_6 WHERE poverty_rate = "12.9%" |
CREATE TABLE table_name_81 (main_date VARCHAR, number_of_fixtures VARCHAR) | What was the main date of the round with 20 fixtures? | SELECT main_date FROM table_name_81 WHERE number_of_fixtures = 20 |
CREATE TABLE table_22815568_6 (market_income_per_capita VARCHAR, poverty_rate VARCHAR) | If the poverty rate is 12.9%, what is the market income per capita? | SELECT market_income_per_capita FROM table_22815568_6 WHERE poverty_rate = "12.9%" |
CREATE TABLE table_22822468_2 (rating VARCHAR, viewers__millions_ VARCHAR) | Name the rating for 3.79 viewers | SELECT rating FROM table_22822468_2 WHERE viewers__millions_ = "3.79" |
CREATE TABLE tryout (cName VARCHAR, pID VARCHAR, decision VARCHAR); CREATE TABLE player (pName VARCHAR, pID VARCHAR) | Find the name and college of students whose decisions are yes in the tryout. | SELECT T1.pName, T2.cName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes' |
CREATE TABLE table_name_97 (score_in_final VARCHAR, tournament VARCHAR) | What is the score of the final in $10,000 – tarakan , indonesia f2? | SELECT score_in_final FROM table_name_97 WHERE tournament = "$10,000 – tarakan , indonesia f2" |
CREATE TABLE tryout (pID VARCHAR, decision VARCHAR, pPos VARCHAR); CREATE TABLE player (pName VARCHAR, pID VARCHAR) | Find the names of the students who are in the position of striker and got a yes tryout decision. | SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes' AND T2.pPos = 'striker' |
CREATE TABLE table_name_97 (player VARCHAR, place VARCHAR, score VARCHAR) | What was the player for t9 and a score of 73-69-74=216? | SELECT player FROM table_name_97 WHERE place = "t9" AND score = 73 - 69 - 74 = 216 |
CREATE TABLE tryout (cName VARCHAR, pID VARCHAR); CREATE TABLE player (pID VARCHAR, pName VARCHAR); CREATE TABLE college (state VARCHAR, cName VARCHAR) | Find the state of the college which player Charles is attending. | SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName JOIN player AS T3 ON T2.pID = T3.pID WHERE T3.pName = 'Charles' |
CREATE TABLE tryout (cName VARCHAR, pPos VARCHAR); CREATE TABLE college (state VARCHAR, cName VARCHAR) | Find the states of the colleges that have students in the tryout who played in striker position. | SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'striker' |
CREATE TABLE player (HS INTEGER, pID VARCHAR); CREATE TABLE tryout (pPos VARCHAR, pID VARCHAR) | What is the maximum training hours for the students whose training hours is greater than 1000 in different positions? | SELECT MAX(T1.HS), pPos FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T1.HS > 1000 GROUP BY T2.pPos |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.