CREATE TABLE Addresses (
    address_id NUMBER PRIMARY KEY,
    address_content TEXT,
    city TEXT,
    zip_postcode TEXT,
    state_province_county TEXT,
    country TEXT,
    other_address_details TEXT
);
CREATE TABLE Products (
    product_id NUMBER PRIMARY KEY,
    product_details TEXT
);
CREATE TABLE Customers (
    customer_id NUMBER PRIMARY KEY,
    payment_method TEXT,
    customer_name TEXT,
    date_became_customer TIME,
    other_customer_details TEXT
);
CREATE TABLE Customer_Addresses (
    customer_id NUMBER,
    address_id NUMBER,
    date_address_from TIME,
    address_type TEXT,
    date_address_to TIME,
    FOREIGN KEY ("customer_id") REFERENCES Customers("customer_id"),
    FOREIGN KEY ("address_id") REFERENCES Addresses("address_id")
);
CREATE TABLE Customer_Contact_Channels (
    customer_id NUMBER,
    channel_code TEXT,
    active_from_date TIME,
    active_to_date TIME,
    contact_number TEXT,
    FOREIGN KEY ("customer_id") REFERENCES Customers("customer_id")
);
CREATE TABLE Customer_Orders (
    order_id NUMBER PRIMARY KEY,
    customer_id NUMBER,
    order_status TEXT,
    order_date TIME,
    order_details TEXT,
    FOREIGN KEY ("customer_id") REFERENCES Customers("customer_id")
);
CREATE TABLE Order_Items (
    order_id NUMBER,
    product_id NUMBER,
    order_quantity TEXT,
    FOREIGN KEY ("order_id") REFERENCES Customer_Orders("order_id"),
    FOREIGN KEY ("product_id") REFERENCES Products("product_id")
);

Question: Find the name of all customers.
SQL: SELECT customer_name FROM customers

Question: What are the names of all the customers?
SQL: SELECT customer_name FROM customers

Question: How many customers are there?
SQL: SELECT count(*) FROM customers

Question: Return the total number of distinct customers.
SQL: SELECT count(*) FROM customers

Question: What is the average amount of items ordered in each order?
SQL: SELECT avg(order_quantity) FROM order_items

Question: Find the average order quantity per order.
SQL: SELECT avg(order_quantity) FROM order_items

Question: What are the names of customers who use payment method "Cash"?
SQL: SELECT customer_name FROM customers WHERE payment_method  =  "Cash"

Question: Which customers use "Cash" for payment method? Return the customer names.
SQL: SELECT customer_name FROM customers WHERE payment_method  =  "Cash"

Question: Find the "date became customers" of the customers whose ID is between 10 and 20.
SQL: SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20

Question: What are the dates when customers with ids between 10 and 20 became customers?
SQL: SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20

Question: Which payment method is used by most customers?
SQL: SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1

Question: Find the payment method that is used most frequently.
SQL: SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1

Question: What are the names of customers using the most popular payment method?
SQL: SELECT customer_name FROM customers WHERE payment_method  =  (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)

Question: Find the name of the customers who use the most frequently used payment method.
SQL: SELECT customer_name FROM customers WHERE payment_method  =  (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)

Question: What are all the payment methods?
SQL: SELECT DISTINCT payment_method FROM customers

Question: Return all the distinct payment methods used by customers.
SQL: SELECT DISTINCT payment_method FROM customers

Question: What are the details of all products?
SQL: SELECT DISTINCT product_details FROM products

Question: Return the the details of all products.
SQL: SELECT DISTINCT product_details FROM products

Question: Find the name of all customers whose name contains "Alex".
SQL: SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%"

Question: Which customer's name contains "Alex"? Find the full name.
SQL: SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%"

Question: Find the detail of products whose detail contains the word "Latte" or the word "Americano"
SQL: SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"

Question: Which product's detail contains the word "Latte" or "Americano"? Return the full detail.
SQL: SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"

Question: What is the address content of the customer named "Maudie Kertzmann"?
SQL: 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"

Question: Return the address content for the customer whose name is "Maudie Kertzmann".
SQL: 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"

Question: How many customers are living in city "Lake Geovannyton"?
SQL: 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"

Question: Find the number of customers who live in the city called Lake Geovannyton.
SQL: 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"

Question: Find the name of customers who are living in Colorado?
SQL: 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"

Question: What are the names of customers who live in Colorado state?
SQL: 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"

Question: Find the list of cities that no customer is living in.
SQL: 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)

Question: What are the cities no customers live in?
SQL: 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)

Question: Which city has the most customers living in?
SQL: 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

Question: Find the city where the most customers live.
SQL: 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

Question: Retrieve the list of all cities.
SQL: SELECT DISTINCT city FROM addresses

Question: List all the distinct cities
SQL: SELECT DISTINCT city FROM addresses

Question: Find the city with post code 255.
SQL: SELECT city FROM addresses WHERE zip_postcode  =  255

Question: Which city is post code 255 located in?
SQL: SELECT city FROM addresses WHERE zip_postcode  =  255