Unnamed: 0
int64 0
60k
| text
stringlengths 109
1.06k
|
---|---|
2,700 | <question>: Find the last names of faculties in building Barton in alphabetic order. <context>: CREATE TABLE FACULTY (Lname VARCHAR, Building VARCHAR) <answer>: SELECT Lname FROM FACULTY WHERE Building = "Barton" ORDER BY Lname |
2,701 | <question>: Find the first names of faculties of rank Professor in alphabetic order. <context>: CREATE TABLE FACULTY (Fname VARCHAR, Rank VARCHAR) <answer>: SELECT Fname FROM FACULTY WHERE Rank = "Professor" ORDER BY Fname |
2,702 | <question>: Find the name of the department that has the biggest number of students minored in? <context>: CREATE TABLE DEPARTMENT (DName VARCHAR, DNO VARCHAR); CREATE TABLE MINOR_IN (DNO VARCHAR) <answer>: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) DESC LIMIT 1 |
2,703 | <question>: Find the name of the department that has no students minored in? <context>: CREATE TABLE DEPARTMENT (DName VARCHAR, DNO VARCHAR); CREATE TABLE MINOR_IN (DNO VARCHAR); CREATE TABLE DEPARTMENT (DName VARCHAR) <answer>: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO |
2,704 | <question>: Find the name of the department that has the fewest members. <context>: CREATE TABLE MEMBER_OF (DNO VARCHAR); CREATE TABLE DEPARTMENT (DName VARCHAR, DNO VARCHAR) <answer>: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) LIMIT 1 |
2,705 | <question>: Find the rank of the faculty that the fewest faculties belong to. <context>: CREATE TABLE FACULTY (Rank VARCHAR) <answer>: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY COUNT(*) LIMIT 1 |
2,706 | <question>: What are the first and last names of the instructors who teach the top 3 number of courses? <context>: CREATE TABLE COURSE (Instructor VARCHAR); CREATE TABLE FACULTY (Fname VARCHAR, Lname VARCHAR, FacID VARCHAR) <answer>: SELECT T2.Fname, T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY COUNT(*) DESC LIMIT 3 |
2,707 | <question>: Which building does the instructor who teaches the most number of courses live in? <context>: CREATE TABLE COURSE (Instructor VARCHAR); CREATE TABLE FACULTY (Building VARCHAR, FacID VARCHAR) <answer>: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY COUNT(*) DESC LIMIT 1 |
2,708 | <question>: What are the name of courses that have at least five enrollments? <context>: CREATE TABLE ENROLLED_IN (CID VARCHAR); CREATE TABLE COURSE (CName VARCHAR, CID VARCHAR) <answer>: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5 |
2,709 | <question>: Find the first name and last name of the instructor of course that has course name <context>: CREATE TABLE FACULTY (Fname VARCHAR, Lname VARCHAR, FacID VARCHAR); CREATE TABLE COURSE (Instructor VARCHAR, CName VARCHAR) <answer>: SELECT T2.Fname, T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID WHERE T1.CName = "COMPUTER LITERACY" |
2,710 | <question>: Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE. <context>: CREATE TABLE COURSE (DNO VARCHAR, CName VARCHAR); CREATE TABLE DEPARTMENT (Dname VARCHAR, Room VARCHAR, DNO VARCHAR) <answer>: SELECT T2.Dname, T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = "INTRODUCTION TO COMPUTER SCIENCE" |
2,711 | <question>: Find the student first and last names and grade points of all enrollments. <context>: CREATE TABLE ENROLLED_IN (Grade VARCHAR, StuID VARCHAR); CREATE TABLE STUDENT (Fname VARCHAR, LName VARCHAR, StuID VARCHAR); CREATE TABLE GRADECONVERSION (gradepoint VARCHAR, lettergrade VARCHAR) <answer>: SELECT T3.Fname, T3.LName, 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 |
2,712 | <question>: Find the distinct student first names of all students that have grade point at least 3.8 in one course. <context>: CREATE TABLE ENROLLED_IN (Grade VARCHAR, StuID VARCHAR); CREATE TABLE STUDENT (Fname VARCHAR, StuID VARCHAR); CREATE TABLE GRADECONVERSION (gradepoint VARCHAR, lettergrade VARCHAR) <answer>: SELECT DISTINCT T3.Fname FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T2.gradepoint >= 3.8 |
2,713 | <question>: Find the full names of faculties who are members of department with department number 520. <context>: CREATE TABLE FACULTY (Fname VARCHAR, Lname VARCHAR, FacID VARCHAR); CREATE TABLE MEMBER_OF (FacID VARCHAR, DNO VARCHAR) <answer>: SELECT T1.Fname, T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520 |
2,714 | <question>: What are the first names and last names of the students that minor in the department with DNO 140. <context>: CREATE TABLE STUDENT (Fname VARCHAR, Lname VARCHAR, StuID VARCHAR); CREATE TABLE MINOR_IN (StuID VARCHAR, DNO VARCHAR) <answer>: SELECT T2.Fname, T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140 |
2,715 | <question>: Find the last names of faculties who are members of computer science department. <context>: CREATE TABLE DEPARTMENT (DNO VARCHAR, DName VARCHAR); CREATE TABLE MEMBER_OF (DNO VARCHAR, FacID VARCHAR); CREATE TABLE FACULTY (Lname VARCHAR, FacID VARCHAR) <answer>: SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID = T3.FacID WHERE T1.DName = "Computer Science" |
2,716 | <question>: Find the average grade point of student whose last name is Smith. <context>: CREATE TABLE ENROLLED_IN (Grade VARCHAR, StuID VARCHAR); CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE GRADECONVERSION (gradepoint INTEGER, lettergrade VARCHAR) <answer>: 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" |
2,717 | <question>: What is the maximum and minimum grade point of students who live in NYC? <context>: CREATE TABLE ENROLLED_IN (Grade VARCHAR, StuID VARCHAR); CREATE TABLE STUDENT (city_code VARCHAR, StuID VARCHAR); CREATE TABLE GRADECONVERSION (gradepoint INTEGER, lettergrade VARCHAR) <answer>: 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" |
2,718 | <question>: Find the names of courses that have either 3 credits or 1 credit but 4 hours. <context>: CREATE TABLE COURSE (CName VARCHAR, Credits VARCHAR, Hours VARCHAR) <answer>: SELECT CName FROM COURSE WHERE Credits = 3 UNION SELECT CName FROM COURSE WHERE Credits = 1 AND Hours = 4 |
2,719 | <question>: Find the names of departments that are either in division AS or in division EN and in Building NEB. <context>: CREATE TABLE DEPARTMENT (DName VARCHAR, Division VARCHAR, Building VARCHAR) <answer>: SELECT DName FROM DEPARTMENT WHERE Division = "AS" UNION SELECT DName FROM DEPARTMENT WHERE Division = "EN" AND Building = "NEB" |
2,720 | <question>: Find the first name of students not enrolled in any course. <context>: CREATE TABLE STUDENT (Fname VARCHAR, StuID VARCHAR); CREATE TABLE ENROLLED_IN (Fname VARCHAR, StuID VARCHAR) <answer>: SELECT Fname FROM STUDENT WHERE NOT StuID IN (SELECT StuID FROM ENROLLED_IN) |
2,721 | <question>: What are the ids of the top three products that were purchased in the largest amount? <context>: CREATE TABLE product_suppliers (product_id VARCHAR, total_amount_purchased VARCHAR) <answer>: SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3 |
2,722 | <question>: What are the product id and product type of the cheapest product? <context>: CREATE TABLE products (product_id VARCHAR, product_type_code VARCHAR, product_price VARCHAR) <answer>: SELECT product_id, product_type_code FROM products ORDER BY product_price LIMIT 1 |
2,723 | <question>: Find the number of different product types. <context>: CREATE TABLE products (product_type_code VARCHAR) <answer>: SELECT COUNT(DISTINCT product_type_code) FROM products |
2,724 | <question>: Return the address of customer 10. <context>: CREATE TABLE customer_addresses (address_id VARCHAR, customer_id VARCHAR); CREATE TABLE addresses (address_details VARCHAR, address_id VARCHAR) <answer>: SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id = T2.address_id WHERE T2.customer_id = 10 |
2,725 | <question>: What are the staff ids and genders of all staffs whose job title is Department Manager? <context>: CREATE TABLE staff_department_assignments (staff_id VARCHAR, job_title_code VARCHAR); CREATE TABLE staff (staff_id VARCHAR, staff_gender VARCHAR) <answer>: 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" |
2,726 | <question>: For each payment method, return how many customers use it. <context>: CREATE TABLE customers (payment_method_code VARCHAR) <answer>: SELECT payment_method_code, COUNT(*) FROM customers GROUP BY payment_method_code |
2,727 | <question>: What is the id of the product that was ordered the most often? <context>: CREATE TABLE order_items (product_id VARCHAR) <answer>: SELECT product_id FROM order_items GROUP BY product_id ORDER BY COUNT(*) DESC LIMIT 1 |
2,728 | <question>: What are the name, phone number and email address of the customer who made the largest number of orders? <context>: CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, customer_email VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR) <answer>: 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 |
2,729 | <question>: What is the average price for each type of product? <context>: CREATE TABLE products (product_type_code VARCHAR, product_price INTEGER) <answer>: SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code |
2,730 | <question>: How many department stores does the store chain South have? <context>: CREATE TABLE department_stores (dept_store_chain_id VARCHAR); CREATE TABLE department_store_chain (dept_store_chain_id VARCHAR, dept_store_chain_name VARCHAR) <answer>: 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" |
2,731 | <question>: What is the name and job title of the staff who was assigned the latest? <context>: 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) <answer>: 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 |
2,732 | <question>: Give me the product type, name and price for all the products supplied by supplier id 3. <context>: 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) <answer>: 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 |
2,733 | <question>: Return the distinct name of customers whose order status is Pending, in the order of customer id. <context>: CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_status_code VARCHAR) <answer>: 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 |
2,734 | <question>: Find the name and address of the customers who have both New and Pending orders. <context>: CREATE TABLE customers (customer_name VARCHAR, customer_address VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_status_code VARCHAR) <answer>: 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" |
2,735 | <question>: Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products. <context>: 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) <answer>: 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) |
2,736 | <question>: What is the id and name of the department store that has both marketing and managing department? <context>: CREATE TABLE department_stores (dept_store_id VARCHAR, store_name VARCHAR); CREATE TABLE departments (dept_store_id VARCHAR, department_name VARCHAR) <answer>: 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" |
2,737 | <question>: What are the ids of the two department store chains with the largest number of department stores? <context>: CREATE TABLE department_stores (dept_store_chain_id VARCHAR) <answer>: SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY COUNT(*) DESC LIMIT 2 |
2,738 | <question>: What is the id of the department with the least number of staff? <context>: CREATE TABLE staff_department_assignments (department_id VARCHAR) <answer>: SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY COUNT(*) LIMIT 1 |
2,739 | <question>: For each product type, return the maximum and minimum price. <context>: CREATE TABLE products (product_type_code VARCHAR, product_price INTEGER) <answer>: SELECT product_type_code, MAX(product_price), MIN(product_price) FROM products GROUP BY product_type_code |
2,740 | <question>: Find the product type whose average price is higher than the average price of all products. <context>: CREATE TABLE products (product_type_code VARCHAR, product_price INTEGER) <answer>: SELECT product_type_code FROM products GROUP BY product_type_code HAVING AVG(product_price) > (SELECT AVG(product_price) FROM products) |
2,741 | <question>: Find the id and name of the staff who has been assigned for the shortest period. <context>: CREATE TABLE Staff_Department_Assignments (staff_id VARCHAR); CREATE TABLE staff (staff_id VARCHAR, staff_name VARCHAR) <answer>: 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 |
2,742 | <question>: Return the names and ids of all products whose price is between 600 and 700. <context>: CREATE TABLE products (product_name VARCHAR, product_id VARCHAR, product_price INTEGER) <answer>: SELECT product_name, product_id FROM products WHERE product_price BETWEEN 600 AND 700 |
2,743 | <question>: Find the ids of all distinct customers who made order after some orders that were Cancelled. <context>: CREATE TABLE Customer_Orders (customer_id VARCHAR, order_date INTEGER, order_status_code VARCHAR) <answer>: SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT MIN(order_date) FROM Customer_Orders WHERE order_status_code = "Cancelled") |
2,744 | <question>: What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff? <context>: CREATE TABLE Staff_Department_Assignments (staff_id VARCHAR, date_assigned_to INTEGER, job_title_code VARCHAR) <answer>: 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') |
2,745 | <question>: What are the names and ids of customers whose address contains TN? <context>: CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR, customer_address VARCHAR) <answer>: SELECT customer_name, customer_id FROM customers WHERE customer_address LIKE "%TN%" |
2,746 | <question>: Return the name and gender of the staff who was assigned in 2016. <context>: CREATE TABLE staff (staff_name VARCHAR, staff_gender VARCHAR, staff_id VARCHAR); CREATE TABLE staff_department_assignments (staff_id VARCHAR, date_assigned_from VARCHAR) <answer>: 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%" |
2,747 | <question>: List the name of staff who has been assigned multiple jobs. <context>: CREATE TABLE staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE staff_department_assignments (staff_id VARCHAR) <answer>: 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 |
2,748 | <question>: List the name and phone number of all suppliers in the alphabetical order of their addresses. <context>: 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) <answer>: 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 |
2,749 | <question>: What are the phone numbers of all customers and suppliers. <context>: CREATE TABLE suppliers (customer_phone VARCHAR, supplier_phone VARCHAR); CREATE TABLE customers (customer_phone VARCHAR, supplier_phone VARCHAR) <answer>: SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers |
2,750 | <question>: Return the ids of all products that were ordered more than three times or supplied more than 80000. <context>: CREATE TABLE Order_Items (product_id VARCHAR, total_amount_purchased INTEGER); CREATE TABLE Product_Suppliers (product_id VARCHAR, total_amount_purchased INTEGER) <answer>: 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 |
2,751 | <question>: What are id and name of the products whose price is lower than 600 or higher than 900? <context>: CREATE TABLE products (product_id VARCHAR, product_name VARCHAR, product_price VARCHAR) <answer>: SELECT product_id, product_name FROM products WHERE product_price < 600 OR product_price > 900 |
2,752 | <question>: Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000. <context>: CREATE TABLE Product_Suppliers (supplier_id VARCHAR, total_amount_purchased INTEGER) <answer>: SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING AVG(total_amount_purchased) > 50000 OR AVG(total_amount_purchased) < 30000 |
2,753 | <question>: What are the average amount purchased and value purchased for the supplier who supplies the most products. <context>: CREATE TABLE Product_Suppliers (total_amount_purchased INTEGER, total_value_purchased INTEGER, supplier_id VARCHAR) <answer>: 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) |
2,754 | <question>: What is the largest and smallest customer codes? <context>: CREATE TABLE Customers (customer_code INTEGER) <answer>: SELECT MAX(customer_code), MIN(customer_code) FROM Customers |
2,755 | <question>: List the names of all the distinct customers who bought a keyboard. <context>: 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) <answer>: 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" |
2,756 | <question>: List the names and phone numbers of all the distinct suppliers who supply red jeans. <context>: 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) <answer>: 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" |
2,757 | <question>: What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type? <context>: CREATE TABLE products (product_type_code VARCHAR, product_price INTEGER) <answer>: SELECT MAX(product_price), MIN(product_price), product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code |
2,758 | <question>: List the order id, customer id for orders in Cancelled status, ordered by their order dates. <context>: CREATE TABLE customer_orders (order_id VARCHAR, customer_id VARCHAR, order_status_code VARCHAR, order_date VARCHAR) <answer>: SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = "Cancelled" ORDER BY order_date |
2,759 | <question>: Find the names of products that were bought by at least two distinct customers. <context>: 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) <answer>: 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 |
2,760 | <question>: Find the names of customers who have bought by at least three distinct products. <context>: 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) <answer>: 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 |
2,761 | <question>: Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff. <context>: CREATE TABLE staff (staff_name VARCHAR, staff_gender VARCHAR, staff_id VARCHAR); CREATE TABLE Staff_Department_Assignments (staff_id VARCHAR, job_title_code VARCHAR) <answer>: 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" |
2,762 | <question>: Find the id and name of customers whose address contains WY state and do not use credit card for payment. <context>: CREATE TABLE customers (customer_id VARCHAR, customer_name VARCHAR, customer_address VARCHAR, payment_method_code VARCHAR) <answer>: SELECT customer_id, customer_name FROM customers WHERE customer_address LIKE "%WY%" AND payment_method_code <> "Credit Card" |
2,763 | <question>: Find the average price of all product clothes. <context>: CREATE TABLE products (product_price INTEGER, product_type_code VARCHAR) <answer>: SELECT AVG(product_price) FROM products WHERE product_type_code = 'Clothes' |
2,764 | <question>: Find the name of the most expensive hardware product. <context>: CREATE TABLE products (product_name VARCHAR, product_type_code VARCHAR, product_price VARCHAR) <answer>: SELECT product_name FROM products WHERE product_type_code = 'Hardware' ORDER BY product_price DESC LIMIT 1 |
2,765 | <question>: How many aircrafts are there? <context>: CREATE TABLE aircraft (Id VARCHAR) <answer>: SELECT COUNT(*) FROM aircraft |
2,766 | <question>: List the description of all aircrafts. <context>: CREATE TABLE aircraft (Description VARCHAR) <answer>: SELECT Description FROM aircraft |
2,767 | <question>: What is the average number of international passengers of all airports? <context>: CREATE TABLE airport (International_Passengers INTEGER) <answer>: SELECT AVG(International_Passengers) FROM airport |
2,768 | <question>: What are the number of international and domestic passengers of the airport named London "Heathrow"? <context>: CREATE TABLE airport (International_Passengers VARCHAR, Domestic_Passengers VARCHAR, Airport_Name VARCHAR) <answer>: SELECT International_Passengers, Domestic_Passengers FROM airport WHERE Airport_Name = "London Heathrow" |
2,769 | <question>: What are the total number of Domestic Passengers of airports that contain the word "London". <context>: CREATE TABLE airport (Domestic_Passengers INTEGER, Airport_Name VARCHAR) <answer>: SELECT SUM(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%" |
2,770 | <question>: What are the maximum and minimum number of transit passengers of all aiports. <context>: CREATE TABLE airport (Transit_Passengers INTEGER) <answer>: SELECT MAX(Transit_Passengers), MIN(Transit_Passengers) FROM airport |
2,771 | <question>: What are the name of pilots aged 25 or older? <context>: CREATE TABLE pilot (Name VARCHAR, Age VARCHAR) <answer>: SELECT Name FROM pilot WHERE Age >= 25 |
2,772 | <question>: List all pilot names in ascending alphabetical order. <context>: CREATE TABLE pilot (Name VARCHAR) <answer>: SELECT Name FROM pilot ORDER BY Name |
2,773 | <question>: List names of all pilot aged 30 or younger in descending alphabetical order. <context>: CREATE TABLE pilot (Name VARCHAR, Age VARCHAR) <answer>: SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC |
2,774 | <question>: Please show the names of aircrafts associated with airport with name "London Gatwick". <context>: 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) <answer>: 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" |
2,775 | <question>: Please show the names and descriptions of aircrafts associated with airports that have a total number of passengers bigger than 10000000. <context>: 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) <answer>: 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 |
2,776 | <question>: What is the average total number of passengers of airports that are associated with aircraft "Robinson R-22"? <context>: 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) <answer>: 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" |
2,777 | <question>: Please list the location and the winning aircraft name. <context>: CREATE TABLE MATCH (Location VARCHAR, Winning_Aircraft VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR) <answer>: SELECT T2.Location, T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft |
2,778 | <question>: List the name of the aircraft that has been named winning aircraft the most number of times. <context>: CREATE TABLE MATCH (Winning_Aircraft VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR) <answer>: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1 |
2,779 | <question>: List the names of aircrafts and the number of times it won matches. <context>: CREATE TABLE MATCH (Winning_Aircraft VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR) <answer>: SELECT T1.Aircraft, COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft |
2,780 | <question>: List names of all pilot in descending order of age. <context>: CREATE TABLE pilot (Name VARCHAR, Age VARCHAR) <answer>: SELECT Name FROM pilot ORDER BY Age DESC |
2,781 | <question>: List the names of aircrafts and that won matches at least twice. <context>: CREATE TABLE MATCH (Winning_Aircraft VARCHAR); CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR) <answer>: 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 |
2,782 | <question>: List the names of aircrafts and that did not win any match. <context>: CREATE TABLE aircraft (Aircraft VARCHAR, Aircraft_ID VARCHAR, Winning_Aircraft VARCHAR); CREATE TABLE MATCH (Aircraft VARCHAR, Aircraft_ID VARCHAR, Winning_Aircraft VARCHAR) <answer>: SELECT Aircraft FROM aircraft WHERE NOT Aircraft_ID IN (SELECT Winning_Aircraft FROM MATCH) |
2,783 | <question>: Show the names of aircrafts that are associated with both an airport named "London Heathrow" and an airport named "London Gatwick" <context>: 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) <answer>: 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" |
2,784 | <question>: Show all information on the airport that has the largest number of international passengers. <context>: CREATE TABLE airport (International_Passengers VARCHAR) <answer>: SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1 |
2,785 | <question>: find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30. <context>: CREATE TABLE MATCH (winning_pilot VARCHAR); CREATE TABLE pilot (name VARCHAR, age INTEGER, pilot_id VARCHAR) <answer>: 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 |
2,786 | <question>: what is the name and age of the youngest winning pilot? <context>: CREATE TABLE pilot (name VARCHAR, age VARCHAR, pilot_id VARCHAR); CREATE TABLE MATCH (winning_pilot VARCHAR) <answer>: SELECT t1.name, t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot ORDER BY t1.age LIMIT 1 |
2,787 | <question>: find the name of pilots who did not win the matches held in the country of Australia. <context>: CREATE TABLE MATCH (name VARCHAR, pilot_id VARCHAR, Winning_Pilot VARCHAR, country VARCHAR); CREATE TABLE pilot (name VARCHAR, pilot_id VARCHAR, Winning_Pilot VARCHAR, country VARCHAR) <answer>: SELECT name FROM pilot WHERE NOT pilot_id IN (SELECT Winning_Pilot FROM MATCH WHERE country = 'Australia') |
2,788 | <question>: How many residents does each property have? List property id and resident count. <context>: CREATE TABLE properties (property_id VARCHAR); CREATE TABLE residents (property_id VARCHAR) <answer>: SELECT T1.property_id, COUNT(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id |
2,789 | <question>: What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'? <context>: CREATE TABLE services (service_type_code VARCHAR, organization_id VARCHAR); CREATE TABLE organizations (organization_id VARCHAR, organization_details VARCHAR) <answer>: 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' |
2,790 | <question>: How many services has each resident requested? List the resident id, details, and the count in descending order of the count. <context>: CREATE TABLE Residents_Services (resident_id VARCHAR); CREATE TABLE Residents (resident_id VARCHAR, other_details VARCHAR) <answer>: 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 |
2,791 | <question>: What is the maximum number that a certain service is provided? List the service id, details and number. <context>: CREATE TABLE Services (service_id VARCHAR, service_details VARCHAR); CREATE TABLE Residents_Services (service_id VARCHAR) <answer>: 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 |
2,792 | <question>: List the id and type of each thing, and the details of the organization that owns it. <context>: CREATE TABLE Organizations (organization_details VARCHAR, organization_id VARCHAR); CREATE TABLE Things (thing_id VARCHAR, type_of_Thing_Code VARCHAR, organization_id VARCHAR) <answer>: 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 |
2,793 | <question>: What are the id and details of the customers who have at least 3 events? <context>: CREATE TABLE Customers (customer_id VARCHAR, customer_details VARCHAR); CREATE TABLE Customer_Events (customer_id VARCHAR) <answer>: SELECT T1.customer_id, T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 3 |
2,794 | <question>: What is each customer's move in date, and the corresponding customer id and details? <context>: CREATE TABLE Customer_Events (date_moved_in VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_details VARCHAR) <answer>: 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 |
2,795 | <question>: Which events have the number of notes between one and three? List the event id and the property id. <context>: CREATE TABLE Customer_Events (Customer_Event_ID VARCHAR, property_id VARCHAR, customer_event_id VARCHAR); CREATE TABLE Customer_Event_Notes (Customer_Event_ID VARCHAR) <answer>: 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 |
2,796 | <question>: 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' <context>: 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) <answer>: 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' |
2,797 | <question>: How many distinct locations have the things with service detail 'Unsatisfied' been located in? <context>: CREATE TABLE Timed_Locations_of_Things (Location_Code VARCHAR, thing_id VARCHAR); CREATE TABLE Things (thing_id VARCHAR, service_details VARCHAR) <answer>: 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' |
2,798 | <question>: How many different status codes of things are there? <context>: CREATE TABLE Timed_Status_of_Things (Status_of_Thing_Code VARCHAR) <answer>: SELECT COUNT(DISTINCT Status_of_Thing_Code) FROM Timed_Status_of_Things |
2,799 | <question>: Which organizations are not a parent organization of others? List the organization id. <context>: CREATE TABLE organizations (organization_id VARCHAR, parent_organization_id VARCHAR) <answer>: SELECT organization_id FROM organizations EXCEPT SELECT parent_organization_id FROM organizations |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.