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
|
|---|---|---|---|---|---|---|
401
|
sales
|
bird
|
Give the product's name brought by Aaron Alexander.
|
train
|
hard
|
SELECT DISTINCT t1.name FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid INNER JOIN customers AS t3 ON t2.customerid = t3.customerid WHERE t3.firstname = 'aaron' AND t3.lastname = 'alexander'
|
402
|
sales
|
bird
|
Give the product ID and name of the product with the highest prices among the quantity ranges from 400 to 500.
|
train
|
hard
|
SELECT t1.productid, t1.name FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid WHERE t2.quantity BETWEEN 400 AND 500 ORDER BY t1.price DESC LIMIT 1
|
403
|
sales
|
bird
|
Among customers named Kate, who has the highest quantity?
|
train
|
hard
|
SELECT t2.firstname, t2.lastname FROM sales AS t1 INNER JOIN customers AS t2 ON t1.customerid = t2.customerid WHERE t2.firstname = 'kate' ORDER BY t1.quantity DESC LIMIT 1
|
404
|
sales
|
bird
|
Among the products that have price ranges from 100 to 150, what is the customer ID and sales ID of the product with a quantity lower than 25?
|
train
|
hard
|
SELECT t2.customerid, t2.salesid FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid WHERE t1.price BETWEEN 100 AND 150 AND t2.quantity < 25
|
405
|
sales
|
bird
|
List the quantity and price of the product bought by Abigail Henderson.
|
train
|
hard
|
SELECT t2.quantity, t1.price FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid INNER JOIN customers AS t3 ON t2.customerid = t3.customerid WHERE t3.firstname = 'abigail' AND t3.lastname = 'henderson'
|
406
|
sales
|
bird
|
In sales with a quantity of 60, how many of them have a price not greater than 500?
|
train
|
hard
|
SELECT COUNT(t1.productid) FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid WHERE t2.quantity = 60 AND t1.price <= 500
|
407
|
sales
|
bird
|
In customers with the first name of Erica, how many of them bought a quantity below 200?
|
train
|
hard
|
SELECT COUNT(t1.productid) FROM sales AS t1 INNER JOIN customers AS t2 ON t1.customerid = t2.customerid WHERE t2.firstname = 'erica' AND t1.quantity < 200
|
408
|
sales
|
bird
|
Among products bought by Kathryn Ashe, what is the name of the product with the highest quantity?
|
train
|
hard
|
SELECT t1.name FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid INNER JOIN customers AS t3 ON t2.customerid = t3.customerid WHERE t3.firstname = 'kathryn' AND t3.lastname = 'ashe' ORDER BY t2.quantity DESC LIMIT 1
|
409
|
sales
|
bird
|
What is the price and quantity of the product named Seat Tube?
|
train
|
hard
|
SELECT DISTINCT t2.price, t1.quantity FROM sales AS t1 INNER JOIN products AS t2 ON t1.productid = t2.productid WHERE t2.name = 'seat tube'
|
410
|
sales
|
bird
|
What is the price and name of the product bought by Erica Xu?
|
train
|
hard
|
SELECT t3.price, t3.name FROM sales AS t1 INNER JOIN customers AS t2 ON t1.customerid = t2.customerid INNER JOIN products AS t3 ON t1.productid = t3.productid WHERE t2.firstname = 'erica' AND t2.lastname = 'xu'
|
411
|
sales
|
bird
|
List the sales ID of the product with a quantity of 590 and named "External Lock Washer 7".
|
train
|
hard
|
SELECT t1.salesid FROM sales AS t1 INNER JOIN products AS t2 ON t1.productid = t2.productid WHERE t2.name = 'external lock washer 7' AND t1.quantity = 590
|
412
|
sales
|
bird
|
In sales ID between 30 and 40, who is the customer that bought a total quantity of 403?
|
train
|
hard
|
SELECT t2.firstname, t2.lastname FROM sales AS t1 INNER JOIN customers AS t2 ON t1.customerid = t2.customerid WHERE t1.quantity = 403 AND t1.salesid BETWEEN 30 AND 40
|
413
|
sales
|
bird
|
List the customer's ID and last name of the customer that purchased a product with a quantity greater than 90% of the average quantity of all listed products.
|
train
|
hard
|
SELECT t2.customerid, t2.lastname FROM sales AS t1 INNER JOIN customers AS t2 ON t1.customerid = t2.customerid WHERE t1.quantity > (SELECT AVG(quantity) FROM sales) * 0.9
|
414
|
sales
|
bird
|
Among the sales ID ranges from 1 to 200, what is the percentage of the products with a price ranging from 200 to 300?
|
train
|
hard
|
SELECT CAST(CAST(SUM(IIF(t2.price BETWEEN 200 AND 300, 1, 0)) AS REAL) * 100 AS REAL) / COUNT(t2.price) FROM sales AS t1 INNER JOIN products AS t2 ON t1.productid = t2.productid WHERE t1.salesid BETWEEN 1 AND 200
|
415
|
sales
|
bird
|
What is the name of the most expensive product?
|
train
|
easy
|
SELECT name FROM products WHERE price = (SELECT MAX(price) FROM products)
|
416
|
sales
|
bird
|
How many customers are named Madison?
|
train
|
easy
|
SELECT COUNT(customerid) FROM customers WHERE firstname = 'madison'
|
417
|
sales
|
bird
|
How many types of "HL Touring Frames" are there?
|
train
|
easy
|
SELECT COUNT(productid) FROM products WHERE name LIKE '%hl touring frame%'
|
418
|
sales
|
bird
|
How many customers share the most common last name?
|
train
|
hard
|
SELECT COUNT(customerid) FROM customers GROUP BY lastname ORDER BY COUNT(lastname) DESC LIMIT 1
|
419
|
sales
|
bird
|
How many free or gift products are there?
|
train
|
easy
|
SELECT COUNT(productid) FROM products WHERE price = 0
|
420
|
sales
|
bird
|
What is the name of the sales person who handled the highest number of sales?
|
train
|
hard
|
SELECT t1.firstname, t1.middleinitial, t1.lastname FROM employees AS t1 INNER JOIN sales AS t2 ON t2.salespersonid = t1.employeeid GROUP BY t2.salespersonid, t1.firstname, t1.middleinitial, t1.lastname ORDER BY COUNT(t2.salesid) DESC LIMIT 1
|
421
|
sales
|
bird
|
What is the full name of the customer who purchased the highest amount of total price in a single purchase?
|
train
|
hard
|
SELECT t2.firstname, t2.middleinitial, t2.lastname FROM sales AS t1 INNER JOIN customers AS t2 ON t1.customerid = t2.customerid INNER JOIN products AS t3 ON t1.productid = t3.productid GROUP BY t1.salesid, t1.quantity, t3.price, firstname, middleinitial, lastname ORDER BY t1.quantity * t3.price DESC LIMIT 1
|
422
|
sales
|
bird
|
How many "Mountain-500 Black 42" were sold in total?
|
train
|
hard
|
SELECT SUM(t2.quantity) FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid WHERE t1.name = 'mountain-500 black, 42'
|
423
|
sales
|
bird
|
How much is the total amount of sales handled by Heather McBadden?
|
train
|
hard
|
SELECT SUM(t2.quantity * t3.price) FROM employees AS t1 INNER JOIN sales AS t2 ON t1.employeeid = t2.salespersonid INNER JOIN products AS t3 ON t2.productid = t3.productid WHERE t1.firstname = 'heather' AND t1.lastname = 'mcbadden'
|
424
|
sales
|
bird
|
How many "Mountain-100 Silver, 38" were sold by Stearns MacFeather?
|
train
|
hard
|
SELECT SUM(t2.quantity) FROM employees AS t1 INNER JOIN sales AS t2 ON t1.employeeid = t2.salespersonid INNER JOIN products AS t3 ON t2.productid = t3.productid WHERE t1.firstname = 'stearns' AND t1.lastname = 'macfeather' AND t3.name = 'mountain-100 silver, 38'
|
425
|
sales
|
bird
|
How many type of products did Dalton M. Coleman purchase?
|
train
|
hard
|
SELECT COUNT(t2.productid) FROM customers AS t1 INNER JOIN sales AS t2 ON t1.customerid = t2.customerid WHERE t1.firstname = 'dalton' AND t1.middleinitial = 'm' AND t1.lastname = 'coleman'
|
426
|
sales
|
bird
|
What are the full names of the top 3 employees who handled the highest number of sales?
|
train
|
hard
|
SELECT t1.firstname, t1.middleinitial, t1.lastname FROM employees AS t1 INNER JOIN sales AS t2 ON t1.employeeid = t2.salespersonid GROUP BY t2.salespersonid, t1.firstname, t1.middleinitial, t1.lastname ORDER BY COUNT(t2.salesid) DESC LIMIT 3
|
427
|
sales
|
bird
|
Among the "Mountain-500 Black" product types, which type was purchased the most?
|
train
|
hard
|
SELECT t1.name FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid WHERE t1.name LIKE 'mountain-500 black%' GROUP BY t2.quantity, t1.name ORDER BY SUM(t2.quantity) DESC LIMIT 1
|
428
|
sales
|
bird
|
How many employees sold "ML Road Frame-W - Yellow, 40"?
|
train
|
hard
|
SELECT COUNT(t2.salespersonid) FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid WHERE t1.name = 'ml road frame-w - yellow, 40'
|
429
|
sales
|
bird
|
How many chainring bolts were sold under sales ID 551971?
|
train
|
hard
|
SELECT t1.quantity FROM sales AS t1 INNER JOIN products AS t2 ON t1.productid = t2.productid WHERE t2.name = 'chainring bolts' AND t1.salesid = 551971
|
430
|
sales
|
bird
|
How many employees sold over 20,000 quantities of "Touring-2000 Blue, 50"?
|
train
|
easy
|
SELECT COUNT(*) FROM (SELECT SUM(quantity) FROM sales WHERE productid IN (SELECT productid FROM products WHERE name = 'touring-2000 blue, 50') GROUP BY quantity, salespersonid HAVING SUM(quantity) > 20000)
|
431
|
sales
|
bird
|
What is the total cost of all the "Road-650, Red, 60" products that Abraham E. Bennet sold?
|
train
|
hard
|
SELECT SUM(t2.quantity * t3.price) FROM employees AS t1 INNER JOIN sales AS t2 ON t1.employeeid = t2.salespersonid INNER JOIN products AS t3 ON t2.productid = t3.productid WHERE t1.firstname = 'abraham' AND t1.middleinitial = 'e' AND t1.lastname = 'bennet' AND t3.name = 'road-650 red, 60'
|
432
|
sales
|
bird
|
Which product has the highest total amount of quantity sold? Calculate its overall total price.
|
train
|
hard
|
SELECT t1.name, SUM(t2.quantity * t1.price) FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid GROUP BY t1.productid, t1.name ORDER BY SUM(t2.quantity) DESC LIMIT 1
|
433
|
sales
|
bird
|
List the first name of all the customers whose last name is Chen.
|
train
|
easy
|
SELECT firstname, lastname FROM customers WHERE lastname = 'chen'
|
434
|
sales
|
bird
|
Among the employee names, what is the most common middle initial?
|
train
|
hard
|
SELECT middleinitial FROM employees GROUP BY middleinitial ORDER BY COUNT(middleinitial) DESC LIMIT 1
|
435
|
sales
|
bird
|
What is the average price of products that cost between 100 and 200?
|
train
|
medium
|
SELECT AVG(price) FROM products WHERE price BETWEEN 100 AND 200
|
436
|
sales
|
bird
|
Find and list the full name of customers who bought products above-average quantity.
|
train
|
hard
|
SELECT t2.firstname, t2.middleinitial, t2.lastname FROM sales AS t1 INNER JOIN customers AS t2 ON t1.customerid = t2.customerid GROUP BY t1.quantity HAVING t1.quantity > (SELECT AVG(quantity) FROM sales)
|
437
|
sales
|
bird
|
Give the full name of the customer who bought the most amount of products.
|
train
|
hard
|
SELECT t3.firstname, t3.middleinitial, t3.lastname FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid INNER JOIN customers AS t3 ON t2.customerid = t3.customerid ORDER BY t2.quantity * t1.price DESC LIMIT 1
|
438
|
sales
|
bird
|
Of the employees who sold Blade, who has the most amount of sales?
|
train
|
hard
|
SELECT t1.firstname, t1.middleinitial, t1.lastname FROM employees AS t1 INNER JOIN sales AS t2 ON t1.employeeid = t2.salespersonid INNER JOIN products AS t3 ON t2.productid = t3.productid ORDER BY t2.quantity * t3.price DESC LIMIT 1
|
439
|
sales
|
bird
|
List the full name of customers who spend more than 50,000 in descending order the amount spend.
|
train
|
hard
|
SELECT DISTINCT t3.firstname, t3.middleinitial, t3.lastname FROM products AS t1 INNER JOIN sales AS t2 ON t1.productid = t2.productid INNER JOIN customers AS t3 ON t2.customerid = t3.customerid WHERE t2.quantity * t1.price > 50000
|
440
|
sales
|
bird
|
Name the product that sold the most quantity.
|
train
|
hard
|
SELECT t2.name FROM sales AS t1 INNER JOIN products AS t2 ON t1.productid = t2.productid ORDER BY t1.quantity DESC LIMIT 1
|
441
|
sales
|
bird
|
Find and list the products that sold below the average quantity.
|
train
|
hard
|
SELECT DISTINCT t2.name FROM sales AS t1 INNER JOIN products AS t2 ON t1.productid = t2.productid WHERE t1.quantity < (SELECT AVG(quantity) FROM sales)
|
442
|
retail_world
|
bird
|
Please list the names of all the products whose supplier is in Japan.
|
train
|
hard
|
SELECT t1.productname FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t2.country = 'japan'
|
443
|
retail_world
|
bird
|
Give the full name of the youngest employee.
|
train
|
easy
|
SELECT firstname, lastname FROM employees WHERE birthdate = (SELECT MAX(birthdate) FROM employees)
|
444
|
retail_world
|
bird
|
Who is the newest hired employee? Give the full name.
|
train
|
easy
|
SELECT firstname, lastname FROM employees WHERE hiredate = (SELECT MAX(hiredate) FROM employees)
|
445
|
retail_world
|
bird
|
Provide the number of orders that were handled by Michael Suyama.
|
train
|
hard
|
SELECT COUNT(t2.orderid) FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t1.firstname = 'michael' AND t1.lastname = 'suyama'
|
446
|
retail_world
|
bird
|
How many kinds of products are there in the the category of "dairy products"?
|
train
|
hard
|
SELECT COUNT(t1.productid) FROM products AS t1 INNER JOIN categories AS t2 ON t1.categoryid = t2.categoryid WHERE t2.categoryname = 'dairy products'
|
447
|
retail_world
|
bird
|
Which category does "tofu" belong to?
|
train
|
hard
|
SELECT t2.categoryname FROM products AS t1 INNER JOIN categories AS t2 ON t1.categoryid = t2.categoryid WHERE t1.productname = 'tofu'
|
448
|
retail_world
|
bird
|
Give the contact name of the supplier for the product "Gudbrandsdalsost".
|
train
|
hard
|
SELECT t2.contactname FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t1.productname = 'gudbrandsdalsost'
|
449
|
retail_world
|
bird
|
Tell the country name of the supplier for "Scottish Longbreads".
|
train
|
hard
|
SELECT t2.country FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t1.productname = 'scottish longbreads'
|
450
|
retail_world
|
bird
|
How many customers are there in the country with the highest number of customers?
|
train
|
hard
|
SELECT COUNT(customerid) FROM customers GROUP BY country ORDER BY COUNT(customerid) DESC LIMIT 1
|
451
|
retail_world
|
bird
|
How many suppliers are there in the United States of America?
|
train
|
easy
|
SELECT COUNT(supplierid) FROM suppliers WHERE country = 'usa'
|
452
|
retail_world
|
bird
|
What is the name of the supplier that supplies the most products to the company?
|
train
|
hard
|
SELECT t1.supplierid FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid GROUP BY t1.supplierid ORDER BY COUNT(*) DESC LIMIT 1
|
453
|
retail_world
|
bird
|
What is the full name of the employee who handled the highest amount of orders?
|
train
|
hard
|
SELECT t1.firstname, t1.lastname FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid GROUP BY t1.firstname, t1.lastname ORDER BY COUNT(*) DESC LIMIT 1
|
454
|
retail_world
|
bird
|
What is the name of the contact person of the Pavlova supplier company?
|
train
|
hard
|
SELECT t2.contactname FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t1.productname = 'pavlova'
|
455
|
retail_world
|
bird
|
What is the family name of the employee who shipped the order 10521 to CACTU?
|
train
|
hard
|
SELECT t1.lastname FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t2.orderid = 10521 AND t2.customerid = 'cactu'
|
456
|
retail_world
|
bird
|
What are the products that belong to the beverage category?
|
train
|
hard
|
SELECT t2.productname FROM categories AS t1 INNER JOIN products AS t2 ON t1.categoryid = t2.categoryid WHERE t1.categoryname = 'beverages'
|
457
|
retail_world
|
bird
|
What is the description of the category that tofu belongs to?
|
train
|
hard
|
SELECT t1.description FROM categories AS t1 INNER JOIN products AS t2 ON t1.categoryid = t2.categoryid WHERE t2.productname = 'tofu'
|
458
|
retail_world
|
bird
|
Who is the person to contact to get Camembert Pierrot?
|
train
|
hard
|
SELECT t2.contactname FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t1.productname = 'camembert pierrot'
|
459
|
retail_world
|
bird
|
How many territories are there?
|
train
|
easy
|
SELECT COUNT(territoryid) FROM territories
|
460
|
retail_world
|
bird
|
List down the customer ids who placed order with Michael Suyama.
|
train
|
hard
|
SELECT t2.customerid FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t1.firstname = 'michael' AND t1.lastname = 'suyama'
|
461
|
retail_world
|
bird
|
How many orders have Margaret Peacock placed?
|
train
|
hard
|
SELECT COUNT(t2.employeeid) FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t1.firstname = 'margaret' AND t1.lastname = 'peacock'
|
462
|
retail_world
|
bird
|
Calculate the total products that are supplied by Japan suppliers.
|
train
|
hard
|
SELECT COUNT(t1.supplierid) FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t2.country = 'japan'
|
463
|
retail_world
|
bird
|
What is the contact name for product Teatime Chocolate Biscuits?
|
train
|
hard
|
SELECT t2.contactname FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t1.productname = 'teatime chocolate biscuits'
|
464
|
retail_world
|
bird
|
How many customers are there in Berlin, Germany?
|
train
|
medium
|
SELECT COUNT(city) FROM customers WHERE country = 'germany' AND city = 'berlin'
|
465
|
retail_world
|
bird
|
What percentage of orders were placed by customers in Madrid city in 1996?
|
train
|
hard
|
SELECT CAST(CAST(COUNT(CASE WHEN t1.city = 'madrid' THEN 1 ELSE NULL END) AS REAL) * 100 AS REAL) / COUNT(t1.city) FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerid = t2.customerid WHERE STRFTIME('%y', t2.orderdate) = 1996
|
466
|
retail_world
|
bird
|
In 1996, how many orders were from customers in the UK?
|
train
|
hard
|
SELECT COUNT(t1.customerid) FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerid = t2.customerid WHERE STRFTIME('%y', t2.orderdate) = '1996' AND t1.country = 'uk'
|
467
|
retail_world
|
bird
|
Please calculate the number of orders from customers by country in 1996.
|
train
|
hard
|
SELECT COUNT(t2.customerid) FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerid = t2.customerid WHERE STRFTIME('%y', t2.orderdate) = '1996' GROUP BY t1.country
|
468
|
retail_world
|
bird
|
Which country are the majority of the suppliers located?
|
train
|
hard
|
SELECT country FROM suppliers GROUP BY country ORDER BY COUNT(supplierid) DESC LIMIT 1
|
469
|
retail_world
|
bird
|
In August of 1996, how many orders were placed by the customer with the highest amount of orders?
|
train
|
medium
|
SELECT COUNT(orderid) FROM orders WHERE orderdate LIKE '1996-08%' GROUP BY customerid ORDER BY COUNT(orderid) DESC LIMIT 1
|
470
|
retail_world
|
bird
|
What are the ID and description of the condiments category?
|
train
|
medium
|
SELECT categoryid, description FROM categories WHERE categoryname = 'condiments'
|
471
|
retail_world
|
bird
|
What were the products supplied by the company in Spain?
|
train
|
hard
|
SELECT t1.productname FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t2.country = 'spain'
|
472
|
retail_world
|
bird
|
How many orders were made by the customers in Ireland.
|
train
|
hard
|
SELECT COUNT(t2.orderid) FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerid = t2.customerid WHERE t1.country = 'ireland'
|
473
|
retail_world
|
bird
|
Provide the full name of the employee who processed the sales order with ID 10274.
|
train
|
hard
|
SELECT t1.firstname, t1.lastname FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t2.orderid = 10274
|
474
|
retail_world
|
bird
|
How many suppliers does Northwind have in USA?
|
train
|
easy
|
SELECT COUNT(supplierid) FROM suppliers WHERE country = 'usa'
|
475
|
retail_world
|
bird
|
How many companies do ship Northwind's orders?
|
train
|
easy
|
SELECT COUNT(shipperid) FROM shippers
|
476
|
retail_world
|
bird
|
Indicate category name of soft drinks, coffees, teas, beers, and ales in description list.
|
train
|
medium
|
SELECT categoryname FROM categories WHERE description = 'soft drinks, coffees, teas, beers, and ales'
|
477
|
retail_world
|
bird
|
List all product names under Confections.
|
train
|
hard
|
SELECT t1.productname FROM products AS t1 INNER JOIN categories AS t2 ON t1.categoryid = t2.categoryid WHERE t2.categoryname = 'confections'
|
478
|
retail_world
|
bird
|
Name the products where the suppliers come from Finland.
|
train
|
hard
|
SELECT t1.productname FROM products AS t1 INNER JOIN suppliers AS t2 ON t1.supplierid = t2.supplierid WHERE t2.country = 'finland'
|
479
|
retail_world
|
bird
|
The product 'Mozzarella di Giovanni' belongs in which category? Include the category's description as well.
|
train
|
hard
|
SELECT t2.categoryname, t2.description FROM products AS t1 INNER JOIN categories AS t2 ON t1.categoryid = t2.categoryid WHERE t1.productname = 'mozzarella di giovanni'
|
480
|
retail_world
|
bird
|
How many suppliers are from UK?
|
train
|
easy
|
SELECT COUNT(supplierid) FROM suppliers WHERE country = 'uk'
|
481
|
retail_world
|
bird
|
What is the name of product with the ID of 77?
|
train
|
easy
|
SELECT productname FROM products WHERE productid = 77
|
482
|
retail_world
|
bird
|
How many orders were handled by Michael Suyama. State the order ID.
|
train
|
hard
|
SELECT COUNT(t2.orderid) FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t1.firstname = 'michael' AND t1.lastname = 'suyama'
|
483
|
retail_world
|
bird
|
How many customers are located in London?
|
train
|
easy
|
SELECT COUNT(customerid) FROM customers WHERE city = 'london'
|
484
|
retail_world
|
bird
|
List out the full name of employee who has birth day on "3/4/1955 12:00:00 AM".
|
train
|
easy
|
SELECT firstname, lastname FROM employees WHERE birthdate = '1955-03-04 00:00:00'
|
485
|
retail_world
|
bird
|
Mention the first name of employee who took care the order id 10250.
|
train
|
hard
|
SELECT t1.firstname, t1.lastname FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t2.orderid = 10250
|
486
|
retail_world
|
bird
|
When was the employee who handled order id 10281 hired?
|
train
|
hard
|
SELECT t1.hiredate FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t2.orderid = 10281
|
487
|
retail_world
|
bird
|
Give the full name of employee who handled the order id 10280.
|
train
|
hard
|
SELECT t1.firstname, t1.lastname FROM employees AS t1 INNER JOIN orders AS t2 ON t1.employeeid = t2.employeeid WHERE t2.orderid = 10280
|
488
|
retails
|
bird
|
How many kinds of items are returned in order no.5?
|
train
|
medium
|
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_orderkey = 5 AND l_returnflag = 'r'
|
489
|
retails
|
bird
|
When was the latest date the items of order no.1 were shipped?
|
train
|
medium
|
SELECT MAX(l_shipdate) FROM lineitem WHERE l_orderkey = 1
|
490
|
retails
|
bird
|
Which order has a higher priority, order no. 4 or order no. 36?
|
train
|
medium
|
SELECT l_orderkey FROM lineitem WHERE l_orderkey IN (4, 36) ORDER BY l_shipdate DESC LIMIT 1
|
491
|
retails
|
bird
|
What is the comment of the order with the highest total price?
|
train
|
medium
|
SELECT o_comment FROM orders WHERE o_totalprice = (SELECT MAX(o_totalprice) FROM orders)
|
492
|
retails
|
bird
|
What is the phone number of Customer#000000001?
|
train
|
easy
|
SELECT c_phone FROM customer WHERE c_name = 'customer#000000001'
|
493
|
retails
|
bird
|
How many orders in total have the customers in the household segment made?
|
train
|
hard
|
SELECT COUNT(t1.o_orderkey) FROM orders AS t1 INNER JOIN customer AS t2 ON t1.o_custkey = t2.c_custkey WHERE t2.c_mktsegment = 'household'
|
494
|
retails
|
bird
|
Among all the orders made by a customer in the household segment, what is the highest total price?
|
train
|
hard
|
SELECT MAX(t1.o_totalprice) FROM orders AS t1 INNER JOIN customer AS t2 ON t1.o_custkey = t2.c_custkey WHERE t2.c_mktsegment = 'household'
|
495
|
retails
|
bird
|
Please list the order comments of all the orders made by customers in the household segment.
|
train
|
hard
|
SELECT t1.o_comment FROM orders AS t1 INNER JOIN customer AS t2 ON t1.o_custkey = t2.c_custkey WHERE t2.c_mktsegment = 'household'
|
496
|
retails
|
bird
|
Please give the name of the customer who has made the single order with the highest total price.
|
train
|
hard
|
SELECT t2.c_name FROM orders AS t1 INNER JOIN customer AS t2 ON t1.o_custkey = t2.c_custkey ORDER BY t1.o_totalprice DESC LIMIT 1
|
497
|
retails
|
bird
|
Please list the order keys of all the orders made by a customer whose account is in debt.
|
train
|
hard
|
SELECT t1.o_orderkey FROM orders AS t1 INNER JOIN customer AS t2 ON t1.o_custkey = t2.c_custkey WHERE t2.c_acctbal < 0
|
498
|
retails
|
bird
|
Among the orders made by customers in the household segment, how many of them are urgent?
|
train
|
hard
|
SELECT COUNT(t1.o_orderpriority) FROM orders AS t1 INNER JOIN customer AS t2 ON t1.o_custkey = t2.c_custkey WHERE t2.c_mktsegment = 'household' AND t1.o_orderpriority = '1-urgent'
|
499
|
retails
|
bird
|
How many customers are in Brazil?
|
train
|
hard
|
SELECT COUNT(t1.c_custkey) FROM customer AS t1 INNER JOIN nation AS t2 ON t1.c_nationkey = t2.n_nationkey WHERE t2.n_name = 'brazil'
|
500
|
retails
|
bird
|
Please list the phone numbers of all the customers in the household segment and are in Brazil.
|
train
|
hard
|
SELECT t1.c_phone FROM customer AS t1 INNER JOIN nation AS t2 ON t1.c_nationkey = t2.n_nationkey WHERE t1.c_mktsegment = 'household' AND t2.n_name = 'brazil'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.