question
stringlengths 16
224
| schema
stringlengths 142
5.86k
| query
stringlengths 20
577
|
---|---|---|
What are the dates when customers with ids between 10 and 20 became customers? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20 |
Which payment method is used by most customers? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1 |
Find the payment method that is used most frequently. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1 |
What are the names of customers using the most popular payment method? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1) |
Find the name of the customers who use the most frequently used payment method. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1) |
What are all the payment methods? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT payment_method FROM customers |
Return all the distinct payment methods used by customers. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT payment_method FROM customers |
What are the details of all products? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT product_details FROM products |
Return the the details of all products. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT product_details FROM products |
Find the name of all customers whose name contains "Alex". | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%" |
Which customer's name contains "Alex"? Find the full name. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%" |
Find the detail of products whose detail contains the word "Latte" or the word "Americano" | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%" |
Which product's detail contains the word "Latte" or "Americano"? Return the full detail. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%" |
What is the address content of the customer named "Maudie Kertzmann"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann" |
Return the address content for the customer whose name is "Maudie Kertzmann". | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = "Maudie Kertzmann" |
How many customers are living in city "Lake Geovannyton"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton" |
Find the number of customers who live in the city called Lake Geovannyton. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton" |
Find the name of customers who are living in Colorado? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado" |
What are the names of customers who live in Colorado state? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = "Colorado" |
Find the list of cities that no customer is living in. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id) |
What are the cities no customers live in? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT city FROM addresses WHERE city NOT IN ( SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id) |
Which city has the most customers living in? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1 |
Find the city where the most customers live. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id GROUP BY t3.city ORDER BY count(*) DESC LIMIT 1 |
Retrieve the list of all cities. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT city FROM addresses |
List all the distinct cities | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT city FROM addresses |
Find the city with post code 255. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT city FROM addresses WHERE zip_postcode = 255 |
Which city is post code 255 located in? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT city FROM addresses WHERE zip_postcode = 255 |
Find the state and country of all cities with post code starting with 4. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%" |
What are the state and country of all the cities that have post codes starting with 4.\ | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%" |
List the countries having more than 4 addresses listed. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4 |
For which countries are there more than four distinct addresses listed? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4 |
List all the contact channel codes that were used less than 5 times. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5 |
Which contact channel codes were used less than 5 times? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5 |
Which contact channel has been used by the customer with name "Tillman Ernser"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" |
Find the contact channel code that was used by the customer named "Tillman Ernser". | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" |
What is the "active to date" of the latest contact channel used by "Tillman Ernser"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" |
Return the the "active to date" of the latest contact channel used by the customer named "Tillman Ernser". | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser" |
What is the average time span of contact channels in the database? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels |
Compute the average active time span of contact channels. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels |
What is the channel code and contact number of the customer contact channel that was active for the longest time? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1) |
Return the channel code and contact number of the customer contact channel whose active duration was the longest. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1) |
Find the name and active date of the customer that use email as the contact channel. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name , t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' |
What are the name and active date of the customers whose contact channel code is email? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name , t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' |
What is the name of the customer that made the order with the largest quantity? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = ( SELECT max(order_quantity) FROM order_items) |
Find the name of the customer who made the order of the largest amount of goods. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = ( SELECT max(order_quantity) FROM order_items) |
What is the name of the customer that has purchased the most items? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1 |
Give me the name of the customer who ordered the most items in total. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1 |
What is the payment method of the customer that has purchased the least quantity of items? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) LIMIT 1 |
Tell me the payment method used by the customer who ordered the least amount of goods in total. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) LIMIT 1 |
How many types of products have Rodrick Heaney bought in total? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney" |
Find the number of distinct products Rodrick Heaney has bought so far. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney" |
What is the total quantity of products purchased by "Rodrick Heaney"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney" |
Tell me the total quantity of products bought by the customer called "Rodrick Heaney". | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney" |
How many customers have at least one order with status "Cancelled"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled" |
Return the number of customers who have at least one order with "Cancelled" status. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled" |
How many orders have detail "Second time"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(*) FROM customer_orders WHERE order_details = "Second time" |
Tell me the number of orders with "Second time" as order detail. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT count(*) FROM customer_orders WHERE order_details = "Second time" |
Find the customer name and date of the orders that have the status "Delivered". | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name , t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered" |
What are the customer name and date of the orders whose status is "Delivered". | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name , t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered" |
What is the total number of products that are in orders with status "Cancelled"? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = "Cancelled" |
Find the total quantity of products associated with the orders in the "Cancelled" status. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = "Cancelled" |
Find the total amount of products ordered before 2018-03-17 07:13:53. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < "2018-03-17 07:13:53" |
What is the total amount of products purchased before 2018-03-17 07:13:53? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < "2018-03-17 07:13:53" |
Who made the latest order? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1 |
Find the name of the customer who made an order most recently. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1 |
Which product has been ordered most number of times? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1 |
What is the most frequently ordered product? Tell me the detail of the product | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1 |
Find the name and ID of the product whose total order quantity is the largest. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1 |
What are the name and ID of the product bought the most. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1 |
Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT address_content FROM addresses WHERE city = "East Julianaside" AND state_province_county = "Texas" UNION SELECT address_content FROM addresses WHERE city = "Gleasonmouth" AND state_province_county = "Arizona" |
What are all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT address_content FROM addresses WHERE city = "East Julianaside" AND state_province_county = "Texas" UNION SELECT address_content FROM addresses WHERE city = "Gleasonmouth" AND state_province_county = "Arizona" |
Find the name of customers who did not pay with Cash. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers WHERE payment_method != 'Cash' |
What is the name of customers who do not use Cash as payment method. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers WHERE payment_method != 'Cash' |
Find the names of customers who never ordered product Latte. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' |
What are names of customers who never ordered product Latte. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' |
Find the names of customers who never placed an order. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id |
What are the names of customers who never made an order. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id |
Find the names of customers who ordered both products Latte and Americano. | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano' |
What are the names of customers who have purchased both products Latte and Americano? | Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255))
Products: product_id (INTEGER), product_details (VARCHAR(255))
Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255))
Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME)
Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50))
Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255))
Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15)) | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano' |
How many artists are there? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT count(*) FROM artist |
Count the number of artists. | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT count(*) FROM artist |
List the age of all music artists. | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Age FROM artist |
What are the ages of all music artists? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Age FROM artist |
What is the average age of all artists? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT avg(Age) FROM artist |
Return the average age across all artists. | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT avg(Age) FROM artist |
What are the famous titles of the artist "Triumfall"? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Famous_Title FROM artist WHERE Artist = "Triumfall" |
Return the famous titles of the artist called "Triumfall". | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Famous_Title FROM artist WHERE Artist = "Triumfall" |
What are the distinct Famous release dates? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT distinct(Famous_Release_date) FROM artist |
Give the distinct famous release dates for all artists. | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT distinct(Famous_Release_date) FROM artist |
Return the dates of ceremony and the results of all music festivals | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Date_of_ceremony , RESULT FROM music_festival |
What are the dates of ceremony and results for each music festival? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Date_of_ceremony , RESULT FROM music_festival |
What are the category of music festivals with result "Awarded"? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Category FROM music_festival WHERE RESULT = "Awarded" |
Return the categories of music festivals that have the result "Awarded". | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Category FROM music_festival WHERE RESULT = "Awarded" |
What are the maximum and minimum week on top of all volumes? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT max(Weeks_on_Top) , min(Weeks_on_Top) FROM volume |
Give the maximum and minimum weeks on top across all volumes. | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT max(Weeks_on_Top) , min(Weeks_on_Top) FROM volume |
What are the songs in volumes with more than 1 week on top? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Song FROM volume WHERE Weeks_on_Top > 1 |
Give the songs included in volumes that have more than 1 week on top. | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Song FROM volume WHERE Weeks_on_Top > 1 |
Please list all songs in volumes in ascending alphabetical order. | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Song FROM volume ORDER BY Song |
What are the the songs in volumes, listed in ascending order? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT Song FROM volume ORDER BY Song |
How many distinct artists do the volumes associate to? | artist: Artist_ID (INT), Artist (TEXT), Age (INT), Famous_Title (TEXT), Famous_Release_date (TEXT)
volume: Volume_ID (INT), Volume_Issue (TEXT), Issue_Date (TEXT), Weeks_on_Top (REAL), Song (TEXT), Artist_ID (INT)
music_festival: ID (INT), Music_Festival (TEXT), Date_of_ceremony (TEXT), Category (TEXT), Volume (INT), Result (TEXT) | SELECT COUNT(DISTINCT Artist_ID) FROM volume |