CREATE TABLE Addresses (
    address_id NUMBER PRIMARY KEY,
    line_1_number_building TEXT,
    city TEXT,
    zip_postcode TEXT,
    state_province_county TEXT,
    country TEXT
);
CREATE TABLE Staff (
    staff_id NUMBER PRIMARY KEY,
    staff_address_id NUMBER,
    nickname TEXT,
    first_name TEXT,
    middle_name TEXT,
    last_name TEXT,
    date_of_birth TIME,
    date_joined_staff TIME,
    date_left_staff TIME,
    FOREIGN KEY ("staff_address_id") REFERENCES Addresses("address_id")
);
CREATE TABLE Vehicles (
    vehicle_id NUMBER PRIMARY KEY,
    vehicle_details TEXT
);
CREATE TABLE Customers (
    customer_id NUMBER PRIMARY KEY,
    customer_address_id NUMBER,
    customer_status_code TEXT,
    date_became_customer TIME,
    date_of_birth TIME,
    first_name TEXT,
    last_name TEXT,
    amount_outstanding NUMBER,
    email_address TEXT,
    phone_number TEXT,
    cell_mobile_phone_number TEXT,
    FOREIGN KEY ("customer_address_id") REFERENCES Addresses("address_id")
);
CREATE TABLE Customer_Payments (
    customer_id NUMBER PRIMARY KEY,
    datetime_payment TIME,
    payment_method_code TEXT,
    amount_payment NUMBER,
    FOREIGN KEY ("customer_id") REFERENCES Customers("customer_id")
);
CREATE TABLE Lessons (
    lesson_id NUMBER PRIMARY KEY,
    customer_id NUMBER,
    lesson_status_code TEXT,
    staff_id NUMBER,
    vehicle_id NUMBER,
    lesson_date TIME,
    lesson_time TEXT,
    price NUMBER,
    FOREIGN KEY ("customer_id") REFERENCES Customers("customer_id"),
    FOREIGN KEY ("staff_id") REFERENCES Staff("staff_id"),
    FOREIGN KEY ("vehicle_id") REFERENCES Vehicles("vehicle_id")
);

Question: What are the names of the states that have 2 to 4 employees living there?
SQL: SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING count(*) BETWEEN 2 AND 4;

Question: List the first name and last name of all customers.
SQL: SELECT first_name ,  last_name FROM Customers;

Question: What are the first and last names for all customers?
SQL: SELECT first_name ,  last_name FROM Customers;

Question: List email address and birthday of customer whose first name as Carole.
SQL: SELECT email_address ,  date_of_birth FROM Customers WHERE first_name = "Carole"

Question: What are the email addresses and date of births for all customers who have a first name of Carole?
SQL: SELECT email_address ,  date_of_birth FROM Customers WHERE first_name = "Carole"

Question: List phone number and email address of customer with more than 2000 outstanding balance.
SQL: SELECT phone_number ,  email_address FROM Customers WHERE amount_outstanding  >  2000;

Question: What are the phone numbers and email addresses of all customers who have an outstanding balance of more than 2000?
SQL: SELECT phone_number ,  email_address FROM Customers WHERE amount_outstanding  >  2000;

Question: What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina?
SQL: SELECT customer_status_code ,  cell_mobile_phone_number ,  email_address FROM Customers WHERE first_name = "Marina" OR last_name  =  "Kohler"

Question: What is the status code, phone number, and email address of the customer whose last name is Kohler or whose first name is Marina?
SQL: SELECT customer_status_code ,  cell_mobile_phone_number ,  email_address FROM Customers WHERE first_name = "Marina" OR last_name  =  "Kohler"

Question: When are the birthdays of customer who are classified as 'Good Customer' status?
SQL: SELECT date_of_birth FROM Customers WHERE customer_status_code  =  'Good Customer'

Question: What is the date of birth of every customer whose status code is 'Good Customer'?
SQL: SELECT date_of_birth FROM Customers WHERE customer_status_code  =  'Good Customer'

Question: When did customer with first name as Carole and last name as Bernhard became a customer?
SQL: SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";

Question: When did Carole Bernhard first become a customer?
SQL: SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard";

Question: How many customers in total?
SQL: SELECT count(*) FROM Customers;

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

Question: List all customer status codes and the number of customers having each status code.
SQL: SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;

Question: For each customer status code, how many customers are classified that way?
SQL: SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code;

Question: Which customer status code has least number of customers?
SQL: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;

Question: What is the status code with the least number of customers?
SQL: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1;

Question: How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
SQL: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";

Question: How many lessons did the customer Ryan Goodwin complete?
SQL: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id  = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed";

Question: What is maximum, minimum and average amount of outstanding of customer?
SQL: SELECT max(amount_outstanding) ,  min(amount_outstanding) ,  avg(amount_outstanding) FROM Customers;

Question: What is the maximum, minimum, and average amount of money outsanding for all customers?
SQL: SELECT max(amount_outstanding) ,  min(amount_outstanding) ,  avg(amount_outstanding) FROM Customers;

Question: List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
SQL: SELECT first_name ,  last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;

Question: What are the first and last names of all customers with between 1000 and 3000 dollars outstanding?
SQL: SELECT first_name ,  last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000;

Question: List first name and last name of customers lived in city Lockmanfurt.
SQL: SELECT T1.first_name ,  T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";

Question: What are the first and last names of all customers who lived in Lockmanfurt?
SQL: SELECT T1.first_name ,  T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt";

Question: Which country does customer with first name as Carole and last name as Bernhard lived in?
SQL: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"

Question: What is the country in which the customer Carole Bernhard lived?
SQL: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"

Question: What is zip code of customer with first name as Carole and last name as Bernhard?
SQL: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"

Question: What is the zip code of the customer Carole Bernhard?
SQL: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"