nl
stringlengths
22
185
sql
stringlengths
22
608
db_id
stringclasses
40 values
table_schema
stringclasses
305 values
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
customers_and_orders
[{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}]
How many customers do not have an order?
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_orders)
customers_and_orders
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}]
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)
customers_and_orders
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}]
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
customers_and_orders
[{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
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
customers_and_orders
[{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
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"
customers_and_orders
[{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
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"
customers_and_orders
[{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
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"
customers_and_orders
[{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
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"
customers_and_orders
[{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
How many customers have an order?
SELECT count(DISTINCT customer_id) FROM Customer_orders
customers_and_orders
[{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}]
Count the number of differnt customers who have made an order.
SELECT count(DISTINCT customer_id) FROM Customer_orders
customers_and_orders
[{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}]
Show all customer ids without an order.
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Customer_orders
customers_and_orders
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}]
What are the ids of customers who have not made an order?
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Customer_orders
customers_and_orders
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}]
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;
customers_and_orders
[{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
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;
customers_and_orders
[{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}, {'table_name': 'order items', 'table_schema': [{'col_name': 'order item id'}, {'col_name': 'order id'}, {'col_name': 'product id'}, {'col_name': 'order quantity'}], 'foreign_key_columns': ['product id', 'order id'], 'primary_keys': []}]
How many buildings are there?
SELECT count(*) FROM building
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
Count the number of buildings.
SELECT count(*) FROM building
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
List the names of buildings in ascending order of number of stories.
SELECT Name FROM building ORDER BY Number_of_Stories ASC
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
List the addresses of buildings in descending order of building completion year.
SELECT Address FROM building ORDER BY Completed_Year DESC
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
Sort the buildings in descending order of building completion year, and return the building addresses.
SELECT Address FROM building ORDER BY Completed_Year DESC
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
What is the maximum number of stories of buildings not completed in 1980?
SELECT max(Number_of_Stories) FROM building WHERE Completed_Year != "1980"
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
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"
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
What is the average population for all regions?
SELECT avg(Population) FROM region
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
Compute the average population of a region.
SELECT avg(Population) FROM region
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
What are the names of regions in ascending alphabetical order?
SELECT Name FROM region ORDER BY Name ASC
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
List the names of regions in alphabetical order.
SELECT Name FROM region ORDER BY Name ASC
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
What are the capitals of the regions with area bigger than 10000?
SELECT Capital FROM region WHERE Area > 10000
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
Give me the capitals of the regions whose area is larger than 10000.
SELECT Capital FROM region WHERE Area > 10000
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
List the capital of the region with the largest population.
SELECT Capital FROM region ORDER BY Population DESC LIMIT 1
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
Which region has the largest population? Give me the capital of the region.
SELECT Capital FROM region ORDER BY Population DESC LIMIT 1
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
List the names of the regions with the top 5 largest areas.
SELECT Name FROM region ORDER BY Area DESC LIMIT 5
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
What are the names of the 5 largest regions in terms of area?
SELECT Name FROM region ORDER BY Area DESC LIMIT 5
region_building
[{'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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"
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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"
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
Please show each completion year and the number of buildings completed in that year.
SELECT Completed_Year , COUNT(*) FROM building GROUP BY Completed_Year
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
For completion year, return the year and the number of buildings completed.
SELECT Completed_Year , COUNT(*) FROM building GROUP BY Completed_Year
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
In which year did the most building constructions complete?
SELECT Completed_Year FROM building GROUP BY Completed_Year ORDER BY COUNT(*) DESC LIMIT 1
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
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)
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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)
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}, {'table_name': 'region', 'table_schema': [{'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'capital'}, {'col_name': 'area'}, {'col_name': 'population'}], 'foreign_key_columns': [], 'primary_keys': ['region id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
Show the distinct addresses of buildings.
SELECT DISTINCT Address FROM building
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
Give me a list of distinct building addresses.
SELECT DISTINCT Address FROM building
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
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
region_building
[{'table_name': 'building', 'table_schema': [{'col_name': 'building id'}, {'col_name': 'region id'}, {'col_name': 'name'}, {'col_name': 'address'}, {'col_name': 'number of stories'}, {'col_name': 'completed year'}], 'foreign_key_columns': ['region id'], 'primary_keys': ['building id']}]
List details of all the channel in alphabetical order .
select channel_details from channels order by channel_details
government_shift
[{'table_name': 'channels', 'table_schema': [{'col_name': 'channel id'}, {'col_name': 'channel details'}], 'foreign_key_columns': [], 'primary_keys': ['channel id']}]
What is the list of channel details ordered alphabetically ?
select channel_details from channels order by channel_details
government_shift
[{'table_name': 'channels', 'table_schema': [{'col_name': 'channel id'}, {'col_name': 'channel details'}], 'foreign_key_columns': [], 'primary_keys': ['channel id']}]
How many services are there?
SELECT count(*) FROM services
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}]
Count the number of services.
SELECT count(*) FROM services
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}]
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
government_shift
[{'table_name': 'analytical layer', 'table_schema': [{'col_name': 'analytical id'}, {'col_name': 'customers and services id'}, {'col_name': 'pattern recognition'}, {'col_name': 'analytical layer type code'}], 'foreign_key_columns': ['customers and services id'], 'primary_keys': ['analytical id']}]
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
government_shift
[{'table_name': 'analytical layer', 'table_schema': [{'col_name': 'analytical id'}, {'col_name': 'customers and services id'}, {'col_name': 'pattern recognition'}, {'col_name': 'analytical layer type code'}], 'foreign_key_columns': ['customers and services id'], 'primary_keys': ['analytical id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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)
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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)
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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)
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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)
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
How many distinct customer and services details are there?
SELECT count(DISTINCT customers_and_services_details) FROM customers_and_services
government_shift
[{'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
Count the total number of available customers and services details.
SELECT count(DISTINCT customers_and_services_details) FROM customers_and_services
government_shift
[{'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
Find all the customers whose name contains "Kutch".
SELECT customer_details FROM customers WHERE customer_details LIKE "%Kutch%"
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}]
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%"
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'channels', 'table_schema': [{'col_name': 'channel id'}, {'col_name': 'channel details'}], 'foreign_key_columns': [], 'primary_keys': ['channel id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'channels', 'table_schema': [{'col_name': 'channel id'}, {'col_name': 'channel details'}], 'foreign_key_columns': [], 'primary_keys': ['channel id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
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"
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
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"
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}]
How many integration platforms are successful?
SELECT count(*) FROM integration_platform WHERE integration_platform_details = "Success"
government_shift
[{'table_name': 'integration platform', 'table_schema': [{'col_name': 'integration platform id'}, {'col_name': 'customer interaction id'}, {'col_name': 'integration platform details'}], 'foreign_key_columns': ['customer interaction id'], 'primary_keys': ['integration platform id']}]
Count the number of integration platforms that have "Success" in the details.
SELECT count(*) FROM integration_platform WHERE integration_platform_details = "Success"
government_shift
[{'table_name': 'integration platform', 'table_schema': [{'col_name': 'integration platform id'}, {'col_name': 'customer interaction id'}, {'col_name': 'integration platform details'}], 'foreign_key_columns': ['customer interaction id'], 'primary_keys': ['integration platform id']}]
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"
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}, {'table_name': 'integration platform', 'table_schema': [{'col_name': 'integration platform id'}, {'col_name': 'customer interaction id'}, {'col_name': 'integration platform details'}], 'foreign_key_columns': ['customer interaction id'], 'primary_keys': ['integration platform id']}]
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"
government_shift
[{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'customer details'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer interactions', 'table_schema': [{'col_name': 'customer interaction id'}, {'col_name': 'channel id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'status code'}, {'col_name': 'services and channels details'}], 'foreign_key_columns': ['customer id', 'channel id', 'service id'], 'primary_keys': ['customer interaction id']}, {'table_name': 'integration platform', 'table_schema': [{'col_name': 'integration platform id'}, {'col_name': 'customer interaction id'}, {'col_name': 'integration platform details'}], 'foreign_key_columns': ['customer interaction id'], 'primary_keys': ['integration platform id']}]
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
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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
government_shift
[{'table_name': 'analytical layer', 'table_schema': [{'col_name': 'analytical id'}, {'col_name': 'customers and services id'}, {'col_name': 'pattern recognition'}, {'col_name': 'analytical layer type code'}], 'foreign_key_columns': ['customers and services id'], 'primary_keys': ['analytical id']}]
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
government_shift
[{'table_name': 'analytical layer', 'table_schema': [{'col_name': 'analytical id'}, {'col_name': 'customers and services id'}, {'col_name': 'pattern recognition'}, {'col_name': 'analytical layer type code'}], 'foreign_key_columns': ['customers and services id'], 'primary_keys': ['analytical id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
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"
government_shift
[{'table_name': 'services', 'table_schema': [{'col_name': 'service id'}, {'col_name': 'service details'}], 'foreign_key_columns': [], 'primary_keys': ['service id']}, {'table_name': 'customers and services', 'table_schema': [{'col_name': 'customers and services id'}, {'col_name': 'customer id'}, {'col_name': 'service id'}, {'col_name': 'customers and services details'}], 'foreign_key_columns': ['customer id', 'service id'], 'primary_keys': ['customers and services id']}]
How many vehicles do we have?
SELECT count(*) FROM vehicles
vehicle_rent
[{'table_name': 'vehicles', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'model year'}, {'col_name': 'type of powertrain'}, {'col_name': 'combined fuel economy rate'}, {'col_name': 'city fuel economy rate'}, {'col_name': 'highway fuel economy rate'}, {'col_name': 'cost per 25 miles'}, {'col_name': 'annual fuel cost'}, {'col_name': 'notes'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
Count the number of vehicles.
SELECT count(*) FROM vehicles
vehicle_rent
[{'table_name': 'vehicles', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'model year'}, {'col_name': 'type of powertrain'}, {'col_name': 'combined fuel economy rate'}, {'col_name': 'city fuel economy rate'}, {'col_name': 'highway fuel economy rate'}, {'col_name': 'cost per 25 miles'}, {'col_name': 'annual fuel cost'}, {'col_name': 'notes'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
Show names for all vehicles in descending order of model year.
SELECT name FROM vehicles ORDER BY model_year DESC
vehicle_rent
[{'table_name': 'vehicles', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'model year'}, {'col_name': 'type of powertrain'}, {'col_name': 'combined fuel economy rate'}, {'col_name': 'city fuel economy rate'}, {'col_name': 'highway fuel economy rate'}, {'col_name': 'cost per 25 miles'}, {'col_name': 'annual fuel cost'}, {'col_name': 'notes'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
What are the names of all vehicles, ordered by model year descending?
SELECT name FROM vehicles ORDER BY model_year DESC
vehicle_rent
[{'table_name': 'vehicles', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'model year'}, {'col_name': 'type of powertrain'}, {'col_name': 'combined fuel economy rate'}, {'col_name': 'city fuel economy rate'}, {'col_name': 'highway fuel economy rate'}, {'col_name': 'cost per 25 miles'}, {'col_name': 'annual fuel cost'}, {'col_name': 'notes'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
List all distinct types of powertrain of vehicles.
SELECT DISTINCT type_of_powertrain FROM vehicles
vehicle_rent
[{'table_name': 'vehicles', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'model year'}, {'col_name': 'type of powertrain'}, {'col_name': 'combined fuel economy rate'}, {'col_name': 'city fuel economy rate'}, {'col_name': 'highway fuel economy rate'}, {'col_name': 'cost per 25 miles'}, {'col_name': 'annual fuel cost'}, {'col_name': 'notes'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]