Based off the below table write a query to get the quantities of the sold products on
Question:
Based off the below table write a query to get the quantities of the sold products on Wednesday in the category Footwear provided by vendor Pacific Gear within the Tristate region between the 1st and the 2nd quarter of 2016
CREATE TABLE CALENDAR
(
CalendarKey INT PRIMARY KEY AUTO_INCREMENT,
FullDate DATE,
DayOfWeek VARCHAR(10),
DayOfMonth INT
);
-- PRODUCT Dimension table
CREATE TABLE PRODUCT
(
ProductKey INT PRIMARY KEY AUTO_INCREMENT,
ProductID INT,
ProductName VARCHAR(255),
ProductPrice DECIMAL(10, 2),
ProductVendorName VARCHAR(255),
ProductCategoryName VARCHAR(255)
);
CREATE TABLE STORE
(
StoreKey INT PRIMARY KEY AUTO_INCREMENT,
StoreID INT,
StoreZip VARCHAR(10),
StoreRegionName VARCHAR(255),
DollarsSold DECIMAL(10, 2)
);
CREATE TABLE CUSTOMER
(
CustomerKey INT PRIMARY KEY AUTO_INCREMENT,
CustomerID INT,
CustomerName VARCHAR(255),
CustomerZip VARCHAR(10),
UnitsSold INT
);
CREATE TABLE SALES
(
SaleID INT PRIMARY KEY AUTO_INCREMENT,
Month INT,
Quarter INT,
Year INT,
CalendarKey INT,
StoreKey INT,
ProductKey INT,
CustomerKey INT,
FOREIGN KEY (CalendarKey) REFERENCES CALENDAR(CalendarKey),
FOREIGN KEY (StoreKey) REFERENCES STORE(StoreKey),
FOREIGN KEY (ProductKey) REFERENCES PRODUCT(ProductKey),
FOREIGN KEY (CustomerKey) REFERENCES CUSTOMER(CustomerKey)
);
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi