In: Computer Science
SQL
Consider the following business question and determine which of the following should be included in a fact/dimension table of the star schema
What was the revenue of the McDonald’s in Russia and France in 2017?
A. Russia
B. France
C. Revenue
D. Countries
Answer for both Fact and Dimension tables.
Please determine from the question which is part of the fact, and which is part of the dimension. There should be two answers.
A. Star Schema may look like below diagram
As per the structure of Star Schema, Fact would be Revenue and Dimensions would be Russia, France and Countries.
Explanation :- Mostly Fact tables contains the more aggregated and Amount columns. So in our case Fact is revenue. Where as in Dimensions we keep more detailed information related to Products, Sales Organization, Countries, Customer and more of descriptive information. Means in our case France,Russia and Countries.
B. Table Structure Would look Like below Diagram
##Revenue amount of McDonald's in 2017 in France and Russia.
select sum(r.Net_Amount) from Revenue r
left outer join Countries c on r.storeID=c.storeID
where c.country in ('France','Russia')
and year(r.date)=2017