question_id
int64
1
75.7k
db_id
stringclasses
33 values
db_name
stringclasses
4 values
question
stringlengths
19
259
partition
stringclasses
4 values
difficulty
stringclasses
3 values
SQL
stringlengths
25
862
1,701
department_store
spider
What are the distinct names of customers with an order status of Pending, sorted by customer id?
train
hard
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
1,702
department_store
spider
Find the name and address of the customers who have both New and Pending orders.
train
hard
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_stat...
1,703
department_store
spider
What are the names and addressed of customers who have both New and Pending orders?
train
hard
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_stat...
1,704
department_store
spider
Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products.
train
hard
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)
1,705
department_store
spider
What are the ids of products from the supplier with id 2, which are more expensive than the average price across all products?
train
hard
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)
1,706
department_store
spider
What is the id and name of the department store that has both marketing and managing department?
train
hard
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.de...
1,707
department_store
spider
What are the ids and names of department stores with both marketing and managing departments?
train
hard
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.de...
1,708
department_store
spider
What are the ids of the two department store chains with the largest number of department stores?
train
hard
SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY COUNT(*) DESC LIMIT 2
1,709
department_store
spider
Return the ids of the two department store chains with the most department stores.
train
hard
SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY COUNT(*) DESC LIMIT 2
1,710
department_store
spider
What is the id of the department with the least number of staff?
train
hard
SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY COUNT(*) LIMIT 1
1,711
department_store
spider
Return the id of the department with the fewest staff assignments.
train
hard
SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY COUNT(*) LIMIT 1
1,712
department_store
spider
For each product type, return the maximum and minimum price.
train
hard
SELECT product_type_code, MAX(product_price), MIN(product_price) FROM products GROUP BY product_type_code
1,713
department_store
spider
What are the maximum and minimum product prices for each product type?
train
hard
SELECT product_type_code, MAX(product_price), MIN(product_price) FROM products GROUP BY product_type_code
1,714
department_store
spider
Find the product type whose average price is higher than the average price of all products.
train
hard
SELECT product_type_code FROM products GROUP BY product_type_code HAVING AVG(product_price) > (SELECT AVG(product_price) FROM products)
1,715
department_store
spider
What is the code of the product type with an average price higher than the average price of all products?
train
hard
SELECT product_type_code FROM products GROUP BY product_type_code HAVING AVG(product_price) > (SELECT AVG(product_price) FROM products)
1,716
department_store
spider
Find the id and name of the staff who has been assigned for the shortest period.
train
hard
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
1,717
department_store
spider
What is the id and name of the staff who has been assigned for the least amount of time?
train
hard
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
1,718
department_store
spider
Return the names and ids of all products whose price is between 600 and 700.
train
medium
SELECT product_name, product_id FROM products WHERE product_price BETWEEN 600 AND 700
1,719
department_store
spider
What are the names and ids of products costing between 600 and 700?
train
medium
SELECT product_name, product_id FROM products WHERE product_price BETWEEN 600 AND 700
1,720
department_store
spider
Find the ids of all distinct customers who made order after some orders that were Cancelled.
train
medium
SELECT DISTINCT customer_id FROM customer_orders WHERE order_date > (SELECT MIN(order_date) FROM customer_orders WHERE order_status_code = 'cancelled')
1,721
department_store
spider
What are the distinct ids of customers who made an order after any order that was Cancelled?
train
medium
SELECT DISTINCT customer_id FROM customer_orders WHERE order_date > (SELECT MIN(order_date) FROM customer_orders WHERE order_status_code = 'cancelled')
1,722
department_store
spider
What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff?
train
easy
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')
1,723
department_store
spider
Return the id of the staff whose Staff Department Assignment was earlier than that of any Clerical Staff.
train
easy
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')
1,724
department_store
spider
What are the names and ids of customers whose address contains TN?
train
easy
SELECT customer_name, customer_id FROM customers WHERE customer_address LIKE '%tn%'
1,725
department_store
spider
Return the names and ids of customers who have TN in their address.
train
easy
SELECT customer_name, customer_id FROM customers WHERE customer_address LIKE '%tn%'
1,726
department_store
spider
Return the name and gender of the staff who was assigned in 2016.
train
hard
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%'
1,727
department_store
spider
What are the names and genders of staff who were assigned in 2016?
train
hard
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%'
1,728
department_store
spider
List the name of staff who has been assigned multiple jobs.
train
hard
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
1,729
department_store
spider
What are the names of staff who have been assigned multiple jobs?
train
hard
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
1,730
department_store
spider
List the name and phone number of all suppliers in the alphabetical order of their addresses.
train
hard
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
1,731
department_store
spider
What are the names and phone numbers for all suppliers, sorted in alphabetical order of their addressed?
train
hard
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
1,732
department_store
spider
What are the phone numbers of all customers and suppliers.
train
easy
SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
1,733
department_store
spider
Return the phone numbers for all customers and suppliers.
train
easy
SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
1,734
department_store
spider
Return the ids of all products that were ordered more than three times or supplied more than 80000.
train
hard
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
1,735
department_store
spider
What are the ids of all products that were either ordered more than 3 times or have a cumulative amount purchased of above 80000?
train
hard
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
1,736
department_store
spider
What are id and name of the products whose price is lower than 600 or higher than 900?
train
medium
SELECT product_id, product_name FROM products WHERE product_price < 600 OR product_price > 900
1,737
department_store
spider
Give the ids and names of products with price lower than 600 or higher than 900.
train
medium
SELECT product_id, product_name FROM products WHERE product_price < 600 OR product_price > 900
1,738
department_store
spider
Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.
train
hard
SELECT supplier_id FROM product_suppliers GROUP BY supplier_id HAVING AVG(total_amount_purchased) > 50000 OR AVG(total_amount_purchased) < 30000
1,739
department_store
spider
What are the ids of suppliers which have an average amount purchased of above 50000 or below 30000?
train
hard
SELECT supplier_id FROM product_suppliers GROUP BY supplier_id HAVING AVG(total_amount_purchased) > 50000 OR AVG(total_amount_purchased) < 30000
1,740
department_store
spider
What are the average amount purchased and value purchased for the supplier who supplies the most products.
train
easy
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)
1,741
department_store
spider
Return the average total amount purchased and total value purchased for the supplier who supplies the greatest number of products.
train
easy
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)
1,742
department_store
spider
What is the largest and smallest customer codes?
train
easy
SELECT MAX(customer_code), MIN(customer_code) FROM customers
1,743
department_store
spider
Return the maximum and minimum customer codes.
train
easy
SELECT MAX(customer_code), MIN(customer_code) FROM customers
1,744
department_store
spider
List the names of all the distinct customers who bought a keyboard.
train
hard
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'
1,745
department_store
spider
What are the distinct names of customers who have purchased a keyboard?
train
hard
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'
1,746
department_store
spider
List the names and phone numbers of all the distinct suppliers who supply red jeans.
train
hard
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'
1,747
department_store
spider
What are the distinct names and phone numbers for suppliers who have red jeans?
train
hard
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'
1,748
department_store
spider
What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type?
train
hard
SELECT MAX(product_price), MIN(product_price), product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code
1,749
department_store
spider
Give the maximum and minimum product prices for each product type, grouped and ordered by product type.
train
hard
SELECT MAX(product_price), MIN(product_price), product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code
1,750
department_store
spider
List the order id, customer id for orders in Cancelled status, ordered by their order dates.
train
medium
SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = 'cancelled' ORDER BY order_date
1,751
department_store
spider
What are the order ids and customer ids for orders that have been Cancelled, sorted by their order dates?
train
medium
SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = 'cancelled' ORDER BY order_date
1,752
department_store
spider
Find the names of products that were bought by at least two distinct customers.
train
hard
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
1,753
department_store
spider
What are the distinct names of products purchased by at least two different customers?
train
hard
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
1,754
department_store
spider
Find the names of customers who have bought by at least three distinct products.
train
hard
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
1,755
department_store
spider
What are the distinct names of customers who have purchased at least three different products?
train
hard
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
1,756
department_store
spider
Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.
train
hard
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 ...
1,757
department_store
spider
What are the names and genders of staff who have held the title Sales Person, but never Clerical Staff?
train
hard
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 ...
1,758
department_store
spider
Find the id and name of customers whose address contains WY state and do not use credit card for payment.
train
medium
SELECT customer_id, customer_name FROM customers WHERE customer_address LIKE '%wy%' AND payment_method_code <> 'credit card'
1,759
department_store
spider
What are the ids and names of customers with addressed that contain WY and who do not use a credit card for payment?
train
medium
SELECT customer_id, customer_name FROM customers WHERE customer_address LIKE '%wy%' AND payment_method_code <> 'credit card'
1,760
department_store
spider
Find the average price of all product clothes.
train
easy
SELECT AVG(product_price) FROM products WHERE product_type_code = 'clothes'
1,761
department_store
spider
What is the average price of clothes?
train
easy
SELECT AVG(product_price) FROM products WHERE product_type_code = 'clothes'
1,762
department_store
spider
Find the name of the most expensive hardware product.
train
easy
SELECT product_name FROM products WHERE product_type_code = 'hardware' ORDER BY product_price DESC LIMIT 1
1,763
department_store
spider
What is the name of the hardware product with the greatest price?
train
easy
SELECT product_name FROM products WHERE product_type_code = 'hardware' ORDER BY product_price DESC LIMIT 1
1,764
shop_membership
spider
How many branches where have more than average number of memberships are there?
train
easy
SELECT COUNT(*) FROM branch WHERE membership_amount > (SELECT AVG(membership_amount) FROM branch)
1,765
shop_membership
spider
What is the number of branches that have more than the average number of memberships?
train
easy
SELECT COUNT(*) FROM branch WHERE membership_amount > (SELECT AVG(membership_amount) FROM branch)
1,766
shop_membership
spider
Show name, address road, and city for all branches sorted by open year.
train
hard
SELECT name, address_road, city FROM branch ORDER BY open_year
1,767
shop_membership
spider
What are the names, address roads, and cities of the branches ordered by opening year?
train
hard
SELECT name, address_road, city FROM branch ORDER BY open_year
1,768
shop_membership
spider
What are names for top three branches with most number of membership?
train
hard
SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3
1,769
shop_membership
spider
What are the names for the 3 branches that have the most memberships?
train
hard
SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3
1,770
shop_membership
spider
Show all distinct city where branches with at least 100 memberships are located.
train
easy
SELECT DISTINCT city FROM branch WHERE membership_amount >= 100
1,771
shop_membership
spider
What are the different cities that have more than 100 memberships?
train
easy
SELECT DISTINCT city FROM branch WHERE membership_amount >= 100
1,772
shop_membership
spider
List all open years when at least two shops are opened.
train
hard
SELECT open_year FROM branch GROUP BY open_year HAVING COUNT(*) >= 2
1,773
shop_membership
spider
What are the opening years in which at least two shops opened?
train
hard
SELECT open_year FROM branch GROUP BY open_year HAVING COUNT(*) >= 2
1,774
shop_membership
spider
Show minimum and maximum amount of memberships for all branches opened in 2011 or located at city London.
train
medium
SELECT MIN(membership_amount), MAX(membership_amount) FROM branch WHERE open_year = 2011 OR city = 'london'
1,775
shop_membership
spider
What are the minimum and maximum membership amounts for all branches that either opened in 2011 or are located in London?
train
medium
SELECT MIN(membership_amount), MAX(membership_amount) FROM branch WHERE open_year = 2011 OR city = 'london'
1,776
shop_membership
spider
Show the city and the number of branches opened before 2010 for each city.
train
easy
SELECT city, COUNT(*) FROM branch WHERE open_year < 2010 GROUP BY city
1,777
shop_membership
spider
For each city, how many branches opened before 2010?
train
easy
SELECT city, COUNT(*) FROM branch WHERE open_year < 2010 GROUP BY city
1,778
shop_membership
spider
How many different levels do members have?
train
easy
SELECT COUNT(DISTINCT level) FROM member
1,779
shop_membership
spider
What are the different membership levels?
train
easy
SELECT COUNT(DISTINCT level) FROM member
1,780
shop_membership
spider
Show card number, name, and hometown for all members in a descending order of level.
train
hard
SELECT card_number, name, hometown FROM member ORDER BY level DESC
1,781
shop_membership
spider
What are the card numbers, names, and hometowns of every member ordered by descending level?
train
hard
SELECT card_number, name, hometown FROM member ORDER BY level DESC
1,782
shop_membership
spider
Show the membership level with most number of members.
train
hard
SELECT level FROM member GROUP BY level ORDER BY COUNT(*) DESC LIMIT 1
1,783
shop_membership
spider
What is the membership level with the most people?
train
hard
SELECT level FROM member GROUP BY level ORDER BY COUNT(*) DESC LIMIT 1
1,784
shop_membership
spider
Show all member names and registered branch names sorted by register year.
train
hard
SELECT t3.name, t2.name FROM membership_register_branch AS t1 JOIN branch AS t2 ON t1.branch_id = t2.branch_id JOIN member AS t3 ON t1.member_id = t3.member_id ORDER BY t1.register_year
1,785
shop_membership
spider
What are the names of the members and branches at which they are registered sorted by year of registration?
train
hard
SELECT t3.name, t2.name FROM membership_register_branch AS t1 JOIN branch AS t2 ON t1.branch_id = t2.branch_id JOIN member AS t3 ON t1.member_id = t3.member_id ORDER BY t1.register_year
1,786
shop_membership
spider
Show all branch names with the number of members in each branch registered after 2015.
train
hard
SELECT t2.name, COUNT(*) FROM membership_register_branch AS t1 JOIN branch AS t2 ON t1.branch_id = t2.branch_id WHERE t1.register_year > 2015 GROUP BY t2.branch_id
1,787
shop_membership
spider
For each branch id, what are the names of the branches that were registered after 2015?
train
hard
SELECT t2.name, COUNT(*) FROM membership_register_branch AS t1 JOIN branch AS t2 ON t1.branch_id = t2.branch_id WHERE t1.register_year > 2015 GROUP BY t2.branch_id
1,788
shop_membership
spider
Show member names without any registered branch.
train
easy
SELECT name FROM member WHERE NOT member_id IN (SELECT member_id FROM membership_register_branch)
1,789
shop_membership
spider
What are the names of the members that have never registered at any branch?
train
easy
SELECT name FROM member WHERE NOT member_id IN (SELECT member_id FROM membership_register_branch)
1,790
shop_membership
spider
List the branch name and city without any registered members.
train
easy
SELECT name, city FROM branch WHERE NOT branch_id IN (SELECT branch_id FROM membership_register_branch)
1,791
shop_membership
spider
What are the names and cities of the branches that do not have any registered members?
train
easy
SELECT name, city FROM branch WHERE NOT branch_id IN (SELECT branch_id FROM membership_register_branch)
1,792
shop_membership
spider
What is the name and open year for the branch with most number of memberships registered in 2016?
train
hard
SELECT t2.name, t2.open_year FROM membership_register_branch AS t1 JOIN branch AS t2 ON t1.branch_id = t2.branch_id WHERE t1.register_year = 2016 GROUP BY t2.branch_id ORDER BY COUNT(*) DESC LIMIT 1
1,793
shop_membership
spider
What is the name and opening year for the branch that registered the most members in 2016?
train
hard
SELECT t2.name, t2.open_year FROM membership_register_branch AS t1 JOIN branch AS t2 ON t1.branch_id = t2.branch_id WHERE t1.register_year = 2016 GROUP BY t2.branch_id ORDER BY COUNT(*) DESC LIMIT 1
1,794
shop_membership
spider
Show the member name and hometown who registered a branch in 2016.
train
hard
SELECT t2.name, t2.hometown FROM membership_register_branch AS t1 JOIN member AS t2 ON t1.member_id = t2.member_id WHERE t1.register_year = 2016
1,795
shop_membership
spider
What are the member names and hometowns of those who registered at a branch in 2016?
train
hard
SELECT t2.name, t2.hometown FROM membership_register_branch AS t1 JOIN member AS t2 ON t1.member_id = t2.member_id WHERE t1.register_year = 2016
1,796
shop_membership
spider
Show all city with a branch opened in 2001 and a branch with more than 100 membership.
train
medium
SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100
1,797
shop_membership
spider
What are the cities that have a branch that opened in 2001 and a branch with more than 100 members?
train
medium
SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100
1,798
shop_membership
spider
Show all cities without a branch having more than 100 memberships.
train
easy
SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100
1,799
shop_membership
spider
What are the cities that do not have any branches with more than 100 members?
train
easy
SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100
1,800
shop_membership
spider
What is the sum of total pounds of purchase in year 2018 for all branches in London?
train
hard
SELECT SUM(total_pounds) FROM purchase AS t1 JOIN branch AS t2 ON t1.branch_id = t2.branch_id WHERE t2.city = 'london' AND t1.year = 2018