Question: write a query to create a new table, Profit_Table, with variables date, sub_category, country, customer_age, and profit from the sales, product, and location tables where
write a query to create a new table, Profit_Table, with variables date, sub_category, country, customer_age, and profit from the sales, product, and location tables where the year is 2011 and the month is January.
the things is...date form is as attached picture below from sales table. and my result can not retrieves matching date which is January 2011 belongs to.

If I write query as...below, it will have result, but I need that WHERE clause.

result will shows.. as...
if I add
WHERE month = ' January' AND year =2011 ;
there is no result show up at all.
Last, do I need set key? primary key or foreign key? for which column?
Thank you.
\( \begin{array}{ll}1 & \text { CREATE TABLE Profit_Table AS } \\ 2 & \text { SELECT date, customer_age, profit, country, sub_category } \\ 3 & \text { FROM sales } \\ 4 & \text { INNER JOIN location ON sales.Location = location.LOC_ID } \\ 5 & \text { INNER JOIN product oN sales.Product = product.SKU; }\end{array} \) Date Customer_Age Profit Country Sub_Category
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
