Question

This assignment deals with multidimensional querying in a data warehouse (AdventureWorkdsDW) The finance department wants to...

This assignment deals with multidimensional querying in a data warehouse (AdventureWorkdsDW)

The finance department wants to be able to project future financing details. The department manager sent you a request for a rolling 3 month average on past financials. Develop the SQL query code used to explore the database tables and write a query that retrieves finance amounts from "FactFinance" in the AdventureWorkdsDW database and returns those amounts organized by month and showing a 3-month rolling average.

Table Name - FactFinance

Table Columns - FInanceKey, Date Key, Organization Key, DepartmentGroupKey, ScenarioKey, AccountKey, Amount, Date

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Command to create the table is as follows:

Create table FactFinance

( FInanceKey INT (6),

DateKey varchar(10) NOT NULL ,

Organization Key VARCHAR(10),

DepartmentGroupKey VARCHAR(15),

ScenarioKey VARCHAR(15),

AccountKey VARCHAR(15),

Amount INT (6),

Date date (6),

PRIMARY KEY (FInanceKey)

);

Command to explore the database tables:

Show tables;

Command to view database table:

Select* from FactFinance

Query that retrieves finance amounts from "FactFinance" in the AdventureWorkdsDW database and returns those amounts organized by month and showing a 3-month rolling average is as follows:

SELECT avg(amount) as Financeamount

FROM FactFinance

WHERE timestamp >= now()-interval 3 month order by month(Date);

Add a comment
Know the answer?
Add Answer to:
This assignment deals with multidimensional querying in a data warehouse (AdventureWorkdsDW) The finance department wants to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The assignment requires reading and understanding the data model used by Cassandra and representing a given ER model with Cassandra “tables”. The decision of which tables to define is driven by the qu...

    The assignment requires reading and understanding the data model used by Cassandra and representing a given ER model with Cassandra “tables”. The decision of which tables to define is driven by the queries that need to be answered. A software company is interested in developing a Video Sharing application. They have designed a conceptual model of the data they need to handle in order to offer users these main functions: 1. The creation of channels where they can upload videos....

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT