query_id
int64
0
2.15k
database_id
stringclasses
40 values
table_id
sequencelengths
1
4
query
stringlengths
22
185
answer
stringlengths
22
608
difficulty
stringclasses
4 values
300
customers_and_orders
[ "Customer_orders" ]
Give the order status code that is most frequent across customer orders.
SELECT order_status_code FROM Customer_orders GROUP BY order_status_code ORDER BY count(*) DESC LIMIT 1
hard
301
customers_and_orders
[ "Customer_orders", "Customers" ]
How many customers do not have an order?
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_orders)
extra
302
customers_and_orders
[ "Customer_orders", "Customers" ]
Count the number of customers who have not made an order.
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_orders)
extra
303
customers_and_orders
[ "Order_items", "Products" ]
Show all product names without an order.
SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS t1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id
hard
304
customers_and_orders
[ "Order_items", "Products" ]
What are the names of products that have not been ordered?
SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS t1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id
hard
305
customers_and_orders
[ "Order_items", "Products" ]
How many products named Monitor have been ordered?
SELECT sum(order_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id WHERE T2.product_name = "Monitor"
medium
306
customers_and_orders
[ "Order_items", "Products" ]
What is the total number of Monitor products that have been ordered?
SELECT sum(order_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id WHERE T2.product_name = "Monitor"
medium
307
customers_and_orders
[ "Order_items", "Customer_orders", "Products" ]
How many customers have ordered the product named Monitor?
SELECT count(DISTINCT T3.customer_id) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Customer_orders AS T3 ON T3.order_id = T1.order_id WHERE T2.product_name = "Monitor"
hard
308
customers_and_orders
[ "Order_items", "Customer_orders", "Products" ]
Count the number of different customers who have bought a Monitor Product.
SELECT count(DISTINCT T3.customer_id) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Customer_orders AS T3 ON T3.order_id = T1.order_id WHERE T2.product_name = "Monitor"
hard
309
customers_and_orders
[ "Customer_orders" ]
How many customers have an order?
SELECT count(DISTINCT customer_id) FROM Customer_orders
easy
310
customers_and_orders
[ "Customer_orders" ]
Count the number of differnt customers who have made an order.
SELECT count(DISTINCT customer_id) FROM Customer_orders
easy
311
customers_and_orders
[ "Customer_orders", "Customers" ]
Show all customer ids without an order.
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Customer_orders
hard
312
customers_and_orders
[ "Customer_orders", "Customers" ]
What are the ids of customers who have not made an order?
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Customer_orders
hard
313
customers_and_orders
[ "Order_items", "Customer_Orders" ]
Show all the order dates and ids of the orders with quantity of any product larger than 6 or with more than 3 products.
SELECT T1.order_date , T1.order_id FROM Customer_Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id WHERE T2.order_quantity > 6 UNION SELECT T1.order_date , T1.order_id FROM Customer_Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id HAVING count(*) > 3;
extra
314
customers_and_orders
[ "Order_items", "Customer_Orders" ]
What are the order ids and corresponding order dates for orders with a quantity greater than 6 or consisting of more than 3 products?
SELECT T1.order_date , T1.order_id FROM Customer_Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id WHERE T2.order_quantity > 6 UNION SELECT T1.order_date , T1.order_id FROM Customer_Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id HAVING count(*) > 3;
extra
315
region_building
[ "building" ]
How many buildings are there?
SELECT count(*) FROM building
easy
316
region_building
[ "building" ]
Count the number of buildings.
SELECT count(*) FROM building
easy
317
region_building
[ "building" ]
List the names of buildings in ascending order of number of stories.
SELECT Name FROM building ORDER BY Number_of_Stories ASC
easy
318
region_building
[ "building" ]
What is the list of building names, sorted by the number of stories of each building in ascending order?
SELECT Name FROM building ORDER BY Number_of_Stories ASC
easy
319
region_building
[ "building" ]
List the addresses of buildings in descending order of building completion year.
SELECT Address FROM building ORDER BY Completed_Year DESC
easy
320
region_building
[ "building" ]
Sort the buildings in descending order of building completion year, and return the building addresses.
SELECT Address FROM building ORDER BY Completed_Year DESC
easy
321
region_building
[ "building" ]
What is the maximum number of stories of buildings not completed in 1980?
SELECT max(Number_of_Stories) FROM building WHERE Completed_Year != "1980"
easy
322
region_building
[ "building" ]
Among the buildings not completed in 1980, what is the maximum number of stories?
SELECT max(Number_of_Stories) FROM building WHERE Completed_Year != "1980"
easy
323
region_building
[ "region" ]
What is the average population for all regions?
SELECT avg(Population) FROM region
easy
324
region_building
[ "region" ]
Compute the average population of a region.
SELECT avg(Population) FROM region
easy
325
region_building
[ "region" ]
What are the names of regions in ascending alphabetical order?
SELECT Name FROM region ORDER BY Name ASC
easy
326
region_building
[ "region" ]
List the names of regions in alphabetical order.
SELECT Name FROM region ORDER BY Name ASC
easy
327
region_building
[ "region" ]
What are the capitals of the regions with area bigger than 10000?
SELECT Capital FROM region WHERE Area > 10000
easy
328
region_building
[ "region" ]
Give me the capitals of the regions whose area is larger than 10000.
SELECT Capital FROM region WHERE Area > 10000
easy
329
region_building
[ "region" ]
List the capital of the region with the largest population.
SELECT Capital FROM region ORDER BY Population DESC LIMIT 1
medium
330
region_building
[ "region" ]
Which region has the largest population? Give me the capital of the region.
SELECT Capital FROM region ORDER BY Population DESC LIMIT 1
medium
331
region_building
[ "region" ]
List the names of the regions with the top 5 largest areas.
SELECT Name FROM region ORDER BY Area DESC LIMIT 5
medium
332
region_building
[ "region" ]
What are the names of the 5 largest regions in terms of area?
SELECT Name FROM region ORDER BY Area DESC LIMIT 5
medium
333
region_building
[ "region", "building" ]
Show the names of buildings and the names of regions they are in.
SELECT T1.Name , T2.Name FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID
medium
334
region_building
[ "region", "building" ]
For each building, return the name of the building and the name of the region it belongs to.
SELECT T1.Name , T2.Name FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID
medium
335
region_building
[ "region", "building" ]
Show the names of regions that have more than one building.
SELECT T2.Name FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID GROUP BY T1.Region_ID HAVING COUNT(*) > 1
medium
336
region_building
[ "region", "building" ]
Which regions have more than one building? Give me the names of the regions.
SELECT T2.Name FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID GROUP BY T1.Region_ID HAVING COUNT(*) > 1
medium
337
region_building
[ "region", "building" ]
Show the capital of the region that has the most buildings.
SELECT T2.capital FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID GROUP BY T1.Region_ID ORDER BY COUNT(*) DESC LIMIT 1
extra
338
region_building
[ "region", "building" ]
Which region has the largest number of buildings? Show me the capital of the region.
SELECT T2.capital FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID GROUP BY T1.Region_ID ORDER BY COUNT(*) DESC LIMIT 1
extra
339
region_building
[ "region", "building" ]
Show addresses of buildings and the capitals of regions they are in.
SELECT T1.Address , T2.Capital FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID
medium
340
region_building
[ "region", "building" ]
For each building, return the address of the building and the name of the region it belongs to.
SELECT T1.Address , T2.Capital FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID
medium
341
region_building
[ "region", "building" ]
Show the number of stories of buildings in the region with name "Abruzzo".
SELECT T1.Number_of_Stories FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID WHERE T2.Name = "Abruzzo"
medium
342
region_building
[ "region", "building" ]
Return the number of stories for each building in the region named "Abruzzo".
SELECT T1.Number_of_Stories FROM building AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID WHERE T2.Name = "Abruzzo"
medium
343
region_building
[ "building" ]
Please show each completion year and the number of buildings completed in that year.
SELECT Completed_Year , COUNT(*) FROM building GROUP BY Completed_Year
medium
344
region_building
[ "building" ]
For completion year, return the year and the number of buildings completed.
SELECT Completed_Year , COUNT(*) FROM building GROUP BY Completed_Year
medium
345
region_building
[ "building" ]
List the year in which the most buildings are completed.
SELECT Completed_Year FROM building GROUP BY Completed_Year ORDER BY COUNT(*) DESC LIMIT 1
hard
346
region_building
[ "building" ]
In which year did the most building constructions complete?
SELECT Completed_Year FROM building GROUP BY Completed_Year ORDER BY COUNT(*) DESC LIMIT 1
hard
347
region_building
[ "region", "building" ]
List the names of regions that do not have any buildings.
SELECT Name FROM region WHERE Region_ID NOT IN (SELECT Region_ID FROM building)
hard
348
region_building
[ "region", "building" ]
What are the names of regions in which there are no buildings?
SELECT Name FROM region WHERE Region_ID NOT IN (SELECT Region_ID FROM building)
hard
349
region_building
[ "building" ]
Show the completed years shared by buildings with more than 20 stories and buildings with less than 15 stories.
SELECT Completed_Year FROM building WHERE Number_of_Stories > 20 INTERSECT SELECT Completed_Year FROM building WHERE Number_of_Stories < 15
hard
350
region_building
[ "building" ]
In which years did both buildings with more than 20 stories and buildings with less than 15 stories were completed?
SELECT Completed_Year FROM building WHERE Number_of_Stories > 20 INTERSECT SELECT Completed_Year FROM building WHERE Number_of_Stories < 15
hard
351
region_building
[ "building" ]
Show the distinct addresses of buildings.
SELECT DISTINCT Address FROM building
easy
352
region_building
[ "building" ]
Give me a list of distinct building addresses.
SELECT DISTINCT Address FROM building
easy
353
region_building
[ "building" ]
Show the completed years of buildings in descending order of the number of stories.
SELECT Completed_Year FROM building ORDER BY Number_of_Stories DESC
easy
354
region_building
[ "building" ]
Sort buildings in descending order of the number of stories, and return their completion years.
SELECT Completed_Year FROM building ORDER BY Number_of_Stories DESC
easy
355
government_shift
[ "channels" ]
List details of all the channel in alphabetical order .
select channel_details from channels order by channel_details
easy
356
government_shift
[ "channels" ]
What is the list of channel details ordered alphabetically ?
select channel_details from channels order by channel_details
easy
357
government_shift
[ "services" ]
How many services are there?
SELECT count(*) FROM services
easy
358
government_shift
[ "services" ]
Count the number of services.
SELECT count(*) FROM services
easy
359
government_shift
[ "analytical_layer" ]
What is the most common analytical layer type code?
SELECT analytical_layer_type_code FROM analytical_layer GROUP BY analytical_layer_type_code ORDER BY count(*) DESC LIMIT 1
hard
360
government_shift
[ "analytical_layer" ]
Find the analytical layer type code that appears most often.
SELECT analytical_layer_type_code FROM analytical_layer GROUP BY analytical_layer_type_code ORDER BY count(*) DESC LIMIT 1
hard
361
government_shift
[ "services", "customers", "customers_and_services" ]
Find all the services that has been used by the customer with details "Hardy Kutch".
SELECT t3.service_details FROM customers AS t1 JOIN customers_and_services AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t1.customer_details = "Hardy Kutch"
hard
362
government_shift
[ "services", "customers", "customers_and_services" ]
Which services were used by the customer with details "Hardy Kutch"? Give me the service details.
SELECT t3.service_details FROM customers AS t1 JOIN customers_and_services AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t1.customer_details = "Hardy Kutch"
hard
363
government_shift
[ "services", "customers_and_services" ]
Find the details of the services that have been used by more than 3 times .
select t1.service_details from services as t1 join customers_and_services as t2 on t1.service_id = t2.service_id group by t1.service_details having count(*) > 3
medium
364
government_shift
[ "services", "customers_and_services" ]
Which services were used by customers by more than 3 times? Give me the service details.
SELECT t1.service_details FROM services AS t1 JOIN customers_and_services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_details HAVING count(*) > 3
medium
365
government_shift
[ "customers", "customers_and_services" ]
Find the details of the customer who has used services the most times.
SELECT t1.customer_details FROM customers AS t1 JOIN customers_and_services AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_details ORDER BY count(*) DESC LIMIT 1
extra
366
government_shift
[ "customers", "customers_and_services" ]
return the details of the customer with largest count of used services.
select t1.customer_details from customers as t1 join customers_and_services as t2 on t1.customer_id = t2.customer_id group by t1.customer_details order by count(*) desc limit 1
extra
367
government_shift
[ "customers", "customers_and_services" ]
Find the name of the customer who has used the most types of services .
select t1.customer_details from customers as t1 join customers_and_services as t2 on t1.customer_id = t2.customer_id group by t1.customer_details order by count(*) desc limit 1
extra
368
government_shift
[ "customers", "customers_and_services" ]
Which customer has used the most types of services ? Give me the customer details .
select t1.customer_details from customers as t1 join customers_and_services as t2 on t1.customer_id = t2.customer_id group by t1.customer_details order by count(*) desc limit 1
extra
369
government_shift
[ "customers", "customers_and_services" ]
Find the details of the customer who has never used any services .
select customer_details from customers where customer_id not in (select customer_id from customers_and_services)
hard
370
government_shift
[ "customers", "customers_and_services" ]
Which customers never used any services ? Give me the customer details .
select customer_details from customers where customer_id not in (select customer_id from customers_and_services)
hard
371
government_shift
[ "customers", "services", "customers_and_services" ]
Find the details of the customers who have used the least-used service .
select distinct t1.customer_details from customers as t1 join customers_and_services as t2 on t1.customer_id = t2.customer_id where t2.service_id = (select service_id from services group by service_id order by count(*) asc limit 1)
extra
372
government_shift
[ "customers", "services", "customers_and_services" ]
Which customers used the least commonly-used service ? Give me the distinct customer details .
select distinct t1.customer_details from customers as t1 join customers_and_services as t2 on t1.customer_id = t2.customer_id where t2.service_id = (select service_id from services group by service_id order by count(*) asc limit 1)
extra
373
government_shift
[ "customers_and_services" ]
How many distinct customer and services details are there?
SELECT count(DISTINCT customers_and_services_details) FROM customers_and_services
easy
374
government_shift
[ "customers_and_services" ]
Count the total number of available customers and services details.
SELECT count(DISTINCT customers_and_services_details) FROM customers_and_services
easy
375
government_shift
[ "customers" ]
Find all the customers whose name contains "Kutch".
SELECT customer_details FROM customers WHERE customer_details LIKE "%Kutch%"
medium
376
government_shift
[ "customers" ]
What are the details of the customers who have "Kutch" in part of their details?
SELECT customer_details FROM customers WHERE customer_details LIKE "%Kutch%"
medium
377
government_shift
[ "services", "customer_interactions", "customers", "customers_and_services" ]
Find the name of all the services which either have been used by customer "Hardy Kutch" or have been rated as "good" in one of the customer interactions.
SELECT DISTINCT t3.service_details FROM customers AS t1 JOIN customers_and_services AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id JOIN customer_interactions AS t4 ON t3.service_id = t4.service_id WHERE t1.customer_details = "Hardy Kutch" OR t4.services_and_channels_details = "good"
extra
378
government_shift
[ "services", "customer_interactions", "customers", "customers_and_services" ]
Which services are used by the customer "Hardy Kutch" or are rated as "good" in a customer interaction? Give me the service details.
SELECT DISTINCT t3.service_details FROM customers AS t1 JOIN customers_and_services AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id JOIN customer_interactions AS t4 ON t3.service_id = t4.service_id WHERE t1.customer_details = "Hardy Kutch" OR t4.services_and_channels_details = "good"
extra
379
government_shift
[ "services", "customer_interactions", "customers", "customers_and_services" ]
Find the names of all the services which both have been used by customer "Hardy Kutch" and have been rated "bad" in one of the customer interactions.
SELECT DISTINCT t3.service_details FROM customers AS t1 JOIN customers_and_services AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id JOIN customer_interactions AS t4 ON t3.service_id = t4.service_id WHERE t1.customer_details = "Hardy Kutch" AND t4.services_and_channels_details = "bad"
extra
380
government_shift
[ "services", "customer_interactions", "customers", "customers_and_services" ]
Which services are both used by the customer "Hardy Kutch" and are rated as "bad" in a customer interaction? Give me the service details.
SELECT DISTINCT t3.service_details FROM customers AS t1 JOIN customers_and_services AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id JOIN customer_interactions AS t4 ON t3.service_id = t4.service_id WHERE t1.customer_details = "Hardy Kutch" AND t4.services_and_channels_details = "bad"
extra
381
government_shift
[ "customer_interactions", "channels", "services" ]
Find details of all the services that have interacted with `` 15 ij '' for the the channel details.
select distinct t1.service_details from services as t1 join customer_interactions as t2 on t1.service_id = t2.service_id join channels as t3 on t2.channel_id = t3.channel_id where t3.channel_details = "15 ij"
hard
382
government_shift
[ "customer_interactions", "channels", "services" ]
Give me the details of all the services that have interacted with the channel with detail "15 ij".
SELECT DISTINCT t1.service_details FROM services AS t1 JOIN customer_interactions AS t2 ON t1.service_id = t2.service_id JOIN channels AS t3 ON t2.channel_id = t3.channel_id WHERE t3.channel_details = "15 ij"
hard
383
government_shift
[ "customer_interactions", "customers" ]
Find all the details of the customers who have been involved in an interaction with status `` Stuck '' and service and channel detail `` bad '' .
select t1.customer_details from customers as t1 join customer_interactions as t2 on t1.customer_id = t2.customer_id where t2.status_code = "stuck" and services_and_channels_details = "bad"
medium
384
government_shift
[ "customer_interactions", "customers" ]
Which customers have experienced status "Stuck" and service and channel detail "bad" in an interaction? Give me the customer details.
SELECT t1.customer_details FROM customers AS t1 JOIN customer_interactions AS t2 ON t1.customer_id = t2.customer_id WHERE t2.status_code = "Stuck" AND services_and_channels_details = "bad"
medium
385
government_shift
[ "integration_platform" ]
How many integration platforms are successful?
SELECT count(*) FROM integration_platform WHERE integration_platform_details = "Success"
easy
386
government_shift
[ "integration_platform" ]
Count the number of integration platforms that have "Success" in the details.
SELECT count(*) FROM integration_platform WHERE integration_platform_details = "Success"
easy
387
government_shift
[ "customer_interactions", "customers", "integration_platform" ]
List the details of all the customers who are associated with a failed integration platform .
select distinct t1.customer_details from customers as t1 join customer_interactions as t2 on t1.customer_id = t2.customer_id join integration_platform as t3 where t3.integration_platform_details = "fail"
hard
388
government_shift
[ "customer_interactions", "customers", "integration_platform" ]
Which customers have integration platform details "Fail" in interactions? Give me the customer details.
SELECT DISTINCT t1.customer_details FROM customers AS t1 JOIN customer_interactions AS t2 ON t1.customer_id = t2.customer_id JOIN integration_platform AS t3 WHERE t3.integration_platform_details = "Fail"
hard
389
government_shift
[ "services", "customers_and_services" ]
Which service ( s ) has never been used by any customer ? List their details .
select service_details from services except select t2.service_details from customers_and_services as t1 join services as t2 on t1.service_id = t2.service_id
hard
390
government_shift
[ "services", "customers_and_services" ]
Find details of the services that no customer has ever used . Return the service details .
select service_details from services except select t2.service_details from customers_and_services as t1 join services as t2 on t1.service_id = t2.service_id
hard
391
government_shift
[ "analytical_layer" ]
Find all the layer type codes with their corresponding usage count.
SELECT analytical_layer_type_code , count(*) FROM analytical_layer GROUP BY analytical_layer_type_code
medium
392
government_shift
[ "analytical_layer" ]
For each analytical layer, return the analytical layer type code and the number of times it was used.
SELECT analytical_layer_type_code , count(*) FROM analytical_layer GROUP BY analytical_layer_type_code
medium
393
government_shift
[ "services", "customers_and_services" ]
Find details of all the services that have been marked as `` unsatisfied '' in customers and services details .
select distinct t1.service_details from services as t1 join customers_and_services as t2 on t1.service_id = t2.service_id where t2.customers_and_services_details = "unsatisfied"
medium
394
government_shift
[ "services", "customers_and_services" ]
Which services have been rated as "unsatisfied" in customers and services details? Give me the service_details.
SELECT DISTINCT t1.service_details FROM services AS t1 JOIN customers_and_services AS t2 ON t1.service_id = t2.service_id WHERE t2.customers_and_services_details = "Unsatisfied"
medium
395
vehicle_rent
[ "vehicles" ]
How many vehicles do we have?
SELECT count(*) FROM vehicles
easy
396
vehicle_rent
[ "vehicles" ]
Count the number of vehicles.
SELECT count(*) FROM vehicles
easy
397
vehicle_rent
[ "vehicles" ]
Show names for all vehicles in descending order of model year.
SELECT name FROM vehicles ORDER BY model_year DESC
easy
398
vehicle_rent
[ "vehicles" ]
What are the names of all vehicles, ordered by model year descending?
SELECT name FROM vehicles ORDER BY model_year DESC
easy
399
vehicle_rent
[ "vehicles" ]
List all distinct types of powertrain of vehicles.
SELECT DISTINCT type_of_powertrain FROM vehicles
easy