Dludora/DAIL-BIRD huggingface dataset:
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: How many bottles of beer have been bought by Jim Breech? bottles refers to ContainerType = 'Bottle'; */
SELECT 
SELECT COUNT(T3.ContainerType) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T2.CustomerID = T1.CustomerID INNER JOIN rootbeer AS T3 ON T3.RootBeerID = T2.RootBeerID WHERE T3.ContainerType = 'Bottle' AND T1.First = 'Jim' AND T1.Last = 'Breech'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: How many transactions have been made to purchase a root beer brand from California? California refers to State = 'CA'; */
SELECT 
SELECT COUNT(T3.RootBeerID) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.State = 'CA'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: What is the average review given by a subscriber? average review = AVG(StarRating); subscriber refers to SubscribedToEmailList = 'TRUE'; */
SELECT 
SELECT AVG(T2.StarRating) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.SubscribedToEmailList = 'TRUE'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: List out the name of the top 10 spenders and what credit card type are they using. top 10 spenders refers to MAX(PurchasePrice) LIMIT 10; */
SELECT 
SELECT T1.First, T1.Last, T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY SUM(T2.PurchasePrice) DESC LIMIT 10
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: Which of the root beer brand have the lowest purchase? root beer brand refers to BrandName; lowest purchase refers to MIN(COUNT(BrandID)); */
SELECT 
SELECT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) LIMIT 1
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: Please name all of the cities in California. California refers to State = 'CA'; */
SELECT 
SELECT DISTINCT City FROM customers WHERE State = 'CA'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: Which type of card did Dick Ruthven use to pay for all of his transactions? type of card refers to CreditCardType; */
SELECT 
SELECT DISTINCT T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Dick' AND T1.Last = 'Ruthven'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: How many transactions were made at Sac State Union? Sac State Union refers to LocationName = 'Sac State Union'; */
SELECT 
SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State Union'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: How many stars did Urijah Faber rate for Frostie? stars refers to StarRating; Frostie refers to BrandName = 'Frostie'; */
SELECT 
SELECT T2.StarRating FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T1.First = 'Urijah' AND T1.Last = 'Faber' AND T3.BrandName = 'Frostie'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: Which brand has the lowest star rating with a "Too spicy!" review? lowest star rating refers to MIN(StarRating); "Too spicy!" review refers to Review = 'Too Spicy!'; */
SELECT 
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T2.BrandID = T1.BrandID WHERE T2.StarRating = 1 AND T2.Review = 'Too Spicy!'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: What is the email address of the customer who made a purchase in transaction 100016? email address refers to Email; transaction 100016 refers to TransactionID = 100016; */
SELECT 
SELECT T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = '100016'
/* Given the following database schema: */
CREATE TABLE customers
(
    CustomerID            INTEGER
            primary key,
    First                 TEXT,
    Last                  TEXT,
    StreetAddress         TEXT,
    City                  TEXT,
    State                 TEXT,
    ZipCode               INTEGER,
    Email                 TEXT,
    PhoneNumber           TEXT,
    FirstPurchaseDate     DATE,
    SubscribedToEmailList TEXT,
    Gender                TEXT
)

CREATE TABLE geolocation
(
    LocationID INTEGER
            primary key,
    Latitude   REAL,
    Longitude  REAL,
    foreign key (LocationID) references location(LocationID)
)

CREATE TABLE location
(
    LocationID    INTEGER
            primary key,
    LocationName  TEXT,
    StreetAddress TEXT,
    City          TEXT,
    State         TEXT,
    ZipCode       INTEGER,
    foreign key (LocationID) references geolocation(LocationID)
)

CREATE TABLE rootbeerbrand
(
    BrandID             INTEGER
            primary key,
    BrandName           TEXT,
    FirstBrewedYear     INTEGER,
    BreweryName         TEXT,
    City                TEXT,
    State               TEXT,
    Country             TEXT,
    Description         TEXT,
    CaneSugar           TEXT,
    CornSyrup           TEXT,
    Honey               TEXT,
    ArtificialSweetener TEXT,
    Caffeinated         TEXT,
    Alcoholic           TEXT,
    AvailableInCans     TEXT,
    AvailableInBottles  TEXT,
    AvailableInKegs     TEXT,
    Website             TEXT,
    FacebookPage        TEXT,
    Twitter             TEXT,
    WholesaleCost       REAL,
    CurrentRetailPrice  REAL
)

CREATE TABLE rootbeer
(
    RootBeerID    INTEGER
            primary key,
    BrandID       INTEGER,
    ContainerType TEXT,
    LocationID    INTEGER,
    PurchaseDate  DATE,
    foreign key (LocationID) references geolocation(LocationID),
    foreign key (LocationID) references location(LocationID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE rootbeerreview
(
    CustomerID INTEGER,
    BrandID    INTEGER,
    StarRating INTEGER,
    ReviewDate DATE,
    Review     TEXT,
    primary key (CustomerID, BrandID),
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (BrandID) references rootbeerbrand(BrandID)
)

CREATE TABLE "transaction"
(
    TransactionID    INTEGER
            primary key,
    CreditCardNumber INTEGER,
    CustomerID       INTEGER,
    TransactionDate  DATE,
    CreditCardType   TEXT,
    LocationID       INTEGER,
    RootBeerID       INTEGER,
    PurchasePrice    REAL,
    foreign key (CustomerID) references customers(CustomerID),
    foreign key (LocationID) references location(LocationID),
    foreign key (RootBeerID) references rootbeer(RootBeerID)
)

/* Answer the following: Please name any three root beer brands that have the highest market evaluation and acceptance. root beer brands refers to BrandName; highest market evaluation and acceptance refers to MAX(COUNT(StarRating = 5)); */
SELECT 
SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 LIMIT 3
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: How many sales ids are there for customer id 80? */
SELECT 
SELECT COUNT(SalesID) FROM Sales WHERE CustomerID = 80
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: Count the total quantity for sales from id 1 to 10. sales from id 1 to 10 refers to SalesID BETWEEN 1 AND 10; */
SELECT 
SELECT SUM(Quantity) FROM Sales WHERE SalesID BETWEEN 1 AND 10
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: Calculate the average quantity per sales from sales id 20 to 30. average quantity = AVG(Quantity); SalesID BETWEEN 20 AND 30; */
SELECT 
SELECT AVG(Quantity) FROM Sales WHERE SalesID BETWEEN 20 AND 30
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: List down the product id for products with the highest quantity. highest quantity refers to MAX(Quantity); */
SELECT 
SELECT DISTINCT ProductID FROM Sales WHERE Quantity = ( SELECT MAX(Quantity) FROM Sales )
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: How many product ids have the lowest price? lowest price refers to MIN(Price); */
SELECT 
SELECT COUNT(DISTINCT ProductID) FROM Products WHERE Price = ( SELECT MAX(Price) FROM Products )
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: List down product names of free gifts. free gifts refers to Price = 0; */
SELECT 
SELECT Name FROM Products WHERE Price = 0
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: List down the product name for products from id 1 to 10. products from id 1 to 10 refers to ProductID BETWEEN 1 AND 10; */
SELECT 
SELECT Name FROM Products WHERE ProductID BETWEEN 1 AND 10
/* Given the following database schema: */
CREATE TABLE Customers
(
    CustomerID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Employees
(
    EmployeeID    INTEGER         not null
        primary key,
    FirstName     TEXT not null,
    MiddleInitial TEXT null,
    LastName      TEXT not null
)

CREATE TABLE Products
(
    ProductID INTEGER            not null
        primary key,
    Name      TEXT    not null,
    Price     REAL null
)

CREATE TABLE Sales
(
    SalesID       INTEGER not null
        primary key,
    SalesPersonID INTEGER not null,
    CustomerID    INTEGER not null,
    ProductID     INTEGER not null,
    Quantity      INTEGER not null,
    foreign key (SalesPersonID) references Employees (EmployeeID)
            on update cascade on delete cascade,
        foreign key (CustomerID) references Customers (CustomerID)
            on update cascade on delete cascade,
        foreign key (ProductID) references Products (ProductID)
            on update cascade on delete cascade
)

/* Answer the following: What is the name of the product with the lowest quantity? lowest quantity refers to MIN(Quantity); */
SELECT 
SELECT T2.Name FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.Quantity LIMIT 1