Example 2: |
Q1: SELECT COUNTRY as C, DES_PROD as P, YEAR_ as Y, SUM (Sales) AS Total_Sales FROM Fact_Sales FS, DIM_GEOGRAPHY G, DIM_DATE D, DIM_PRODUCT P WHERE country='COUNTRY1' and YEAR_='2022' and SUBSTR(DES_PROD,9) <='100' AND FS.ID_PROD= P.ID_PROD AND FS.ID_GEO=G.ID_GEO AND FS.ID_DATE=D.ID_DATE GROUP BY COUNTRY, DES_PROD, YEAR_;
Q2: SELECT COUNTRY, SITUATION, YEAR_, SUM (Sales) AS Total_Sales FROM Fact_Sales FS, DIM_GEOGRAPHY G, DIM_DATE D, DIM_PRODUCT P, DIM_CUSTOMERS C WHERE country='COUNTRY1' and YEAR_='2022' AND FS.ID_CUST=C.ID_CUST AND FS.ID_PROD= P.ID_PROD AND FS.ID_GEO=G.ID_GEO AND FS.ID_DATE=D.ID_DATE GROUP BY COUNTRY, SITUATION, YEAR_;
Q3: SELECT COUNTRY as C, YEAR_ as Y, SUM (Sales) AS Total_Sales FROM Fact_Sales FS, DIM_GEOGRAPHY G, DIM_DATE D WHERE country='COUNTRY1' and YEAR_='2022' AND FS.ID_GEO=G.ID_GEO AND FS.ID_DATE=D.ID_DATE GROUP BY COUNTRY, YEAR_; |