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,601
loan_1
spider
Find the the name of the customers who have a loan with amount more than 3000.
train
hard
SELECT t1.cust_name FROM customer AS t1 JOIN loan AS t2 ON t1.cust_id = t2.cust_id WHERE amount > 3000
1,602
loan_1
spider
What are the names of customers who have a loan of more than 3000 in amount?
train
hard
SELECT t1.cust_name FROM customer AS t1 JOIN loan AS t2 ON t1.cust_id = t2.cust_id WHERE amount > 3000
1,603
loan_1
spider
Find the city and name of bank branches that provide business loans.
train
hard
SELECT t1.bname, t1.city FROM bank AS t1 JOIN loan AS t2 ON t1.branch_id = t2.branch_id WHERE t2.loan_type = 'business'
1,604
loan_1
spider
What are the names and cities of bank branches that offer loans for business?
train
hard
SELECT t1.bname, t1.city FROM bank AS t1 JOIN loan AS t2 ON t1.branch_id = t2.branch_id WHERE t2.loan_type = 'business'
1,605
loan_1
spider
Find the names of bank branches that have provided a loan to any customer whose credit score is below 100.
train
hard
SELECT t2.bname FROM loan AS t1 JOIN bank AS t2 ON t1.branch_id = t2.branch_id JOIN customer AS t3 ON t1.cust_id = t3.cust_id WHERE t3.credit_score < 100
1,606
loan_1
spider
What are the names of banks that have loaned money to customers with credit scores below 100?
train
hard
SELECT t2.bname FROM loan AS t1 JOIN bank AS t2 ON t1.branch_id = t2.branch_id JOIN customer AS t3 ON t1.cust_id = t3.cust_id WHERE t3.credit_score < 100
1,607
loan_1
spider
Find the total amount of loans provided by bank branches in the state of New York.
train
hard
SELECT SUM(t2.amount) FROM bank AS t1 JOIN loan AS t2 ON t1.branch_id = t2.branch_id WHERE t1.state = 'new york'
1,608
loan_1
spider
What is the total amount of money loaned by banks in New York state?
train
hard
SELECT SUM(t2.amount) FROM bank AS t1 JOIN loan AS t2 ON t1.branch_id = t2.branch_id WHERE t1.state = 'new york'
1,609
loan_1
spider
Find the average credit score of the customers who have some loan.
train
easy
SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
1,610
loan_1
spider
What is the average credit score for customers who have taken a loan?
train
easy
SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
1,611
loan_1
spider
Find the average credit score of the customers who do not have any loan.
train
easy
SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)
1,612
loan_1
spider
What is the average credit score for customers who have never taken a loan?
train
easy
SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)
1,613
insurance_policies
spider
Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.
train
hard
SELECT t1.date_claim_made, t1.claim_id FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id HAVING COUNT(*) > 2 UNION SELECT t1.date_claim_made, t1.claim_id FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id WHERE t1.amount_claimed = (SELECT MAX(amount_claimed) F...
1,614
insurance_policies
spider
Find the claims that led to more than two settlements or have the maximum claim value. For each of them, return the date the claim was made and the id of the claim.
train
hard
SELECT t1.date_claim_made, t1.claim_id FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id HAVING COUNT(*) > 2 UNION SELECT t1.date_claim_made, t1.claim_id FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id WHERE t1.amount_claimed = (SELECT MAX(amount_claimed) F...
1,615
insurance_policies
spider
Which customer had at least 2 policies but did not file any claims? List the customer details and id.
train
hard
SELECT t1.customer_details, t1.customer_id FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id HAVING COUNT(*) >= 2 EXCEPT SELECT t1.customer_details, t1.customer_id FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id JOIN claims ...
1,616
insurance_policies
spider
Give me the the customer details and id for the customers who had two or more policies but did not file any claims.
train
hard
SELECT t1.customer_details, t1.customer_id FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id HAVING COUNT(*) >= 2 EXCEPT SELECT t1.customer_details, t1.customer_id FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id JOIN claims ...
1,617
insurance_policies
spider
List the method, date and amount of all the payments, in ascending order of date.
train
hard
SELECT payment_method_code, date_payment_made, amount_payment FROM payments ORDER BY date_payment_made ASC
1,618
insurance_policies
spider
What are the method, date and amount of each payment? Sort the list in ascending order of date.
train
hard
SELECT payment_method_code, date_payment_made, amount_payment FROM payments ORDER BY date_payment_made ASC
1,619
insurance_policies
spider
Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.
train
hard
SELECT amount_settled, amount_claimed FROM claims ORDER BY amount_claimed DESC LIMIT 1
1,620
insurance_policies
spider
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.
train
hard
SELECT amount_settled, amount_claimed FROM claims ORDER BY amount_claimed DESC LIMIT 1
1,621
insurance_policies
spider
Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount.
train
hard
SELECT amount_settled, amount_claimed FROM claims ORDER BY amount_settled ASC LIMIT 1
1,622
insurance_policies
spider
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.
train
hard
SELECT amount_settled, amount_claimed FROM claims ORDER BY amount_settled ASC LIMIT 1
1,623
insurance_policies
spider
Among all the claims, which claims have a claimed amount larger than the average? List the date the claim was made and the date it was settled.
train
easy
SELECT date_claim_made, date_claim_settled FROM claims WHERE amount_claimed > (SELECT AVG(amount_claimed) FROM claims)
1,624
insurance_policies
spider
Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average.
train
easy
SELECT date_claim_made, date_claim_settled FROM claims WHERE amount_claimed > (SELECT AVG(amount_claimed) FROM claims)
1,625
insurance_policies
spider
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.
train
easy
SELECT date_claim_made FROM claims WHERE amount_settled <= (SELECT AVG(amount_settled) FROM claims)
1,626
insurance_policies
spider
Return the claim start date for the claims whose claimed amount is no more than the average
train
easy
SELECT date_claim_made FROM claims WHERE amount_settled <= (SELECT AVG(amount_settled) FROM claims)
1,627
insurance_policies
spider
How many settlements does each claim correspond to? List the claim id and the number of settlements.
train
hard
SELECT t1.claim_id, COUNT(*) FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id
1,628
insurance_policies
spider
Find the number of settlements each claim corresponds to. Show the number together with the claim id.
train
hard
SELECT t1.claim_id, COUNT(*) FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id
1,629
insurance_policies
spider
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
train
hard
SELECT t1.claim_id, t1.date_claim_made, COUNT(*) FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY COUNT(*) DESC LIMIT 1
1,630
insurance_policies
spider
Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.
train
hard
SELECT t1.claim_id, t1.date_claim_made, COUNT(*) FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY COUNT(*) DESC LIMIT 1
1,631
insurance_policies
spider
How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.
train
hard
SELECT COUNT(*), t1.claim_id FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY t1.date_claim_settled DESC LIMIT 1
1,632
insurance_policies
spider
Find the claim id and the number of settlements made for the claim with the most recent settlement date.
train
hard
SELECT COUNT(*), t1.claim_id FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY t1.date_claim_settled DESC LIMIT 1
1,633
insurance_policies
spider
Of all the claims, what was the earliest date when any claim was made?
train
hard
SELECT date_claim_made FROM claims ORDER BY date_claim_made ASC LIMIT 1
1,634
insurance_policies
spider
Tell me the the date when the first claim was made.
train
hard
SELECT date_claim_made FROM claims ORDER BY date_claim_made ASC LIMIT 1
1,635
insurance_policies
spider
What is the total amount of settlement made for all the settlements?
train
easy
SELECT SUM(amount_settled) FROM settlements
1,636
insurance_policies
spider
Compute the total amount of settlement across all the settlements.
train
easy
SELECT SUM(amount_settled) FROM settlements
1,637
insurance_policies
spider
Who are the customers that had more than 1 policy? List the customer details and id.
train
hard
SELECT t1.customer_details, t1.customer_id FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id HAVING COUNT(*) > 1
1,638
insurance_policies
spider
Find the the customer details and id for the customers who had more than one policy.
train
hard
SELECT t1.customer_details, t1.customer_id FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id HAVING COUNT(*) > 1
1,639
insurance_policies
spider
What are the claim dates and settlement dates of all the settlements?
train
easy
SELECT date_claim_made, date_claim_settled FROM settlements
1,640
insurance_policies
spider
Tell me the the claim date and settlement date for each settlement case.
train
easy
SELECT date_claim_made, date_claim_settled FROM settlements
1,641
insurance_policies
spider
What is the most popular payment method?
train
hard
SELECT payment_method_code FROM payments GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1
1,642
insurance_policies
spider
Which payment method is used the most often?
train
hard
SELECT payment_method_code FROM payments GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1
1,643
insurance_policies
spider
With which kind of payment method were the least number of payments processed?
train
hard
SELECT payment_method_code FROM payments GROUP BY payment_method_code ORDER BY COUNT(*) ASC LIMIT 1
1,644
insurance_policies
spider
What is the payment method that were used the least often?
train
hard
SELECT payment_method_code FROM payments GROUP BY payment_method_code ORDER BY COUNT(*) ASC LIMIT 1
1,645
insurance_policies
spider
What is the total amount of payment?
train
easy
SELECT SUM(amount_payment) FROM payments
1,646
insurance_policies
spider
Compute the total amount of payment processed.
train
easy
SELECT SUM(amount_payment) FROM payments
1,647
insurance_policies
spider
What are all the distinct details of the customers?
train
easy
SELECT DISTINCT customer_details FROM customers
1,648
insurance_policies
spider
Return the distinct customer details.
train
easy
SELECT DISTINCT customer_details FROM customers
1,649
insurance_policies
spider
Which kind of policy type was chosen by the most customers?
train
hard
SELECT policy_type_code FROM customer_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
1,650
insurance_policies
spider
Find the policy type the most customers choose.
train
hard
SELECT policy_type_code FROM customer_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
1,651
insurance_policies
spider
How many settlements are there in total?
train
easy
SELECT COUNT(*) FROM settlements
1,652
insurance_policies
spider
Count the total number of settlements made.
train
easy
SELECT COUNT(*) FROM settlements
1,653
insurance_policies
spider
Which Payments were processed with Visa? List the payment Id, the date and the amount.
train
easy
SELECT payment_id, date_payment_made, amount_payment FROM payments WHERE payment_method_code = 'visa'
1,654
insurance_policies
spider
Give me the payment Id, the date and the amount for all the payments processed with Visa.
train
easy
SELECT payment_id, date_payment_made, amount_payment FROM payments WHERE payment_method_code = 'visa'
1,655
insurance_policies
spider
List the details of the customers who do not have any policies.
train
hard
SELECT customer_details FROM customers EXCEPT SELECT t1.customer_details FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id
1,656
insurance_policies
spider
Which customers do not have any policies? Find the details of these customers.
train
hard
SELECT customer_details FROM customers EXCEPT SELECT t1.customer_details FROM customers AS t1 JOIN customer_policies AS t2 ON t1.customer_id = t2.customer_id
1,657
insurance_policies
spider
List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.
train
hard
SELECT t1.claim_id, t1.date_claim_made, t1.date_claim_settled FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id HAVING COUNT(*) = 1
1,658
insurance_policies
spider
Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled.
train
hard
SELECT t1.claim_id, t1.date_claim_made, t1.date_claim_settled FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id HAVING COUNT(*) = 1
1,659
insurance_policies
spider
Find the total claimed amount of all the claims.
train
easy
SELECT SUM(amount_claimed) FROM claims
1,660
insurance_policies
spider
What is total amount claimed summed across all the claims?
train
easy
SELECT SUM(amount_claimed) FROM claims
1,661
customers_campaigns_ecommerce
spider
How many premises are there?
train
easy
SELECT COUNT(*) FROM premises
1,662
customers_campaigns_ecommerce
spider
What are all the distinct premise types?
train
easy
SELECT DISTINCT premises_type FROM premises
1,663
customers_campaigns_ecommerce
spider
Find the types and details for all premises and order by the premise type.
train
hard
SELECT premises_type, premise_details FROM premises ORDER BY premises_type
1,664
customers_campaigns_ecommerce
spider
Show each premise type and the number of premises in that type.
train
hard
SELECT premises_type, COUNT(*) FROM premises GROUP BY premises_type
1,665
customers_campaigns_ecommerce
spider
Show all distinct product categories along with the number of mailshots in each category.
train
hard
SELECT product_category, COUNT(*) FROM mailshot_campaigns GROUP BY product_category
1,666
customers_campaigns_ecommerce
spider
Show the name and phone of the customer without any mailshot.
train
easy
SELECT customer_name, customer_phone FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM mailshot_customers)
1,667
customers_campaigns_ecommerce
spider
Show the name and phone for customers with a mailshot with outcome code 'No Response'.
train
hard
SELECT t1.customer_name, t1.customer_phone FROM customers AS t1 JOIN mailshot_customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.outcome_code = 'no response'
1,668
customers_campaigns_ecommerce
spider
Show the outcome code of mailshots along with the number of mailshots in each outcome code.
train
hard
SELECT outcome_code, COUNT(*) FROM mailshot_customers GROUP BY outcome_code
1,669
customers_campaigns_ecommerce
spider
Show the names of customers who have at least 2 mailshots with outcome code 'Order'.
train
hard
SELECT t2.customer_name FROM mailshot_customers AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE outcome_code = 'order' GROUP BY t1.customer_id HAVING COUNT(*) >= 2
1,670
customers_campaigns_ecommerce
spider
Show the names of customers who have the most mailshots.
train
hard
SELECT t2.customer_name FROM mailshot_customers AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) DESC LIMIT 1
1,671
customers_campaigns_ecommerce
spider
What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome.
train
hard
SELECT t2.customer_name, t2.payment_method FROM mailshot_customers AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.outcome_code = 'order' INTERSECT SELECT t2.customer_name, t2.payment_method FROM mailshot_customers AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.outcome_cod...
1,672
customers_campaigns_ecommerce
spider
Show the premise type and address type code for all customer addresses.
train
hard
SELECT t2.premises_type, t1.address_type_code FROM customer_addresses AS t1 JOIN premises AS t2 ON t1.premise_id = t2.premise_id
1,673
customers_campaigns_ecommerce
spider
What are the distinct address type codes for all customer addresses?
train
easy
SELECT DISTINCT address_type_code FROM customer_addresses
1,674
customers_campaigns_ecommerce
spider
Show the shipping charge and customer id for customer orders with order status Cancelled or Paid.
train
medium
SELECT order_shipping_charges, customer_id FROM customer_orders WHERE order_status_code = 'cancelled' OR order_status_code = 'paid'
1,675
customers_campaigns_ecommerce
spider
Show the names of customers having an order with shipping method FedEx and order status Paid.
train
hard
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE shipping_method_code = 'fedex' AND order_status_code = 'paid'
1,676
department_store
spider
What are the ids of the top three products that were purchased in the largest amount?
train
hard
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
1,677
department_store
spider
Give the ids of the three products purchased in the largest amounts.
train
hard
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
1,678
department_store
spider
What are the product id and product type of the cheapest product?
train
hard
SELECT product_id, product_type_code FROM products ORDER BY product_price LIMIT 1
1,679
department_store
spider
Give the id and product type of the product with the lowest price.
train
hard
SELECT product_id, product_type_code FROM products ORDER BY product_price LIMIT 1
1,680
department_store
spider
Find the number of different product types.
train
easy
SELECT COUNT(DISTINCT product_type_code) FROM products
1,681
department_store
spider
Count the number of distinct product types.
train
easy
SELECT COUNT(DISTINCT product_type_code) FROM products
1,682
department_store
spider
Return the address of customer 10.
train
hard
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
1,683
department_store
spider
What is the address for the customer with id 10?
train
hard
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
1,684
department_store
spider
What are the staff ids and genders of all staffs whose job title is Department Manager?
train
hard
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'
1,685
department_store
spider
Return the staff ids and genders for any staff with the title Department Manager.
train
hard
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'
1,686
department_store
spider
For each payment method, return how many customers use it.
train
hard
SELECT payment_method_code, COUNT(*) FROM customers GROUP BY payment_method_code
1,687
department_store
spider
How many customers use each payment method?
train
hard
SELECT payment_method_code, COUNT(*) FROM customers GROUP BY payment_method_code
1,688
department_store
spider
What is the id of the product that was ordered the most often?
train
hard
SELECT product_id FROM order_items GROUP BY product_id ORDER BY COUNT(*) DESC LIMIT 1
1,689
department_store
spider
Give the product id for the product that was ordered most frequently.
train
hard
SELECT product_id FROM order_items GROUP BY product_id ORDER BY COUNT(*) DESC LIMIT 1
1,690
department_store
spider
What are the name, phone number and email address of the customer who made the largest number of orders?
train
hard
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
1,691
department_store
spider
Return the name, phone number and email address for the customer with the most orders.
train
hard
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
1,692
department_store
spider
What is the average price for each type of product?
train
hard
SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code
1,693
department_store
spider
Return the average price for each product type.
train
hard
SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code
1,694
department_store
spider
How many department stores does the store chain South have?
train
hard
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'
1,695
department_store
spider
Count the number of stores the chain South has.
train
hard
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'
1,696
department_store
spider
What is the name and job title of the staff who was assigned the latest?
train
hard
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
1,697
department_store
spider
Return the name and job title of the staff with the latest date assigned.
train
hard
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
1,698
department_store
spider
Give me the product type, name and price for all the products supplied by supplier id 3.
train
hard
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
1,699
department_store
spider
Return the product type, name, and price for products supplied by supplier 3.
train
hard
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
1,700
department_store
spider
Return the distinct name of customers whose order status is Pending, in the order of 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