Part B: for this part, you will use tables from IST302 database as source tables. 1...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Part B: for this part, you will use tables from IST302 database as source tables. 1 Create a copy of SALES table from IST302 database to your database. Name this table MY SALES. SELECT * INTO newtable FROM oldtable WHERE condition; 2 Create a view PRODUCT SUMMARY_V that has the Product ID, Year (i.e. year component of TIME_ID), Month (i.e. month component of TIME_ID), Total Amount Sold, Total Quantity Sold, and Average Sale Price (=Total Amount Sold/Total Quantity Sold) for each product in the MY_SALES table. Round the Average Sale Price to 2 decimal places. Note: you should include WITH SCHEMABINDING option when creating the view to prevent underlying tables being changed under the view. Create an indexed view PRODUCT_SUMMARY_M that correspond to your PRODUCT_SUMMARY_V. (HINT: you will get an error code 8668 if you simply create an indexed view using the same query as part B.2. The work around is to create an indexed view that do not include the Average Sale Price column; and then create a view PRODUCT_SUMMARY_M_AVG on top of the indexed view with the additional calculated column Average Sale Price.) Note: you must verify that the view definition is deterministic; and you must create the view by using the WITH SCHEMABINDING option. Also, if GROUP BY is present, the VIEW definition must contain COUNT_BIG(*) and must not contain HAVING. 3 4 Run a query that JOINS PRODUCT_SUMMARY_V and PRODUCTS table, and outputs Product ID, Product Description, Year, Month, Total Amount Sold, Total Quantity Sold, and Average Sale Price where the product subcategory is 'Documentation' or 'Accessories'. Report the query execution time from Messages tab. Note: you should run SET STATISTICS TIME ON command before running the query; and run SET STATISTICS TIME OFF after. The query execution time includes SQL Server parse and compile time and execution time. Report both. 1 Read Create Index View document before you proceed. 5 Save output as above, but the query JOINS PRODUCT_SUMMARY_M_AVG and PRODUCTS table. Report the query execution time from Messages tab. The query execution time includes SQL Server parse and compile time and execution time. Report both. Compare the query execution time of part B.4 and part B.5 with your explanation. 6 7 Same as part B.4 but use an In-Line view that corresponds to PRODUCT_SUMMARY_V. APPENDIX A: Additional Tables for Computer Exercises In these exercises, you will continue using tables in the AdventureWorksDB: Human Resources Schema (see CE4) as the source data. You will also be using Person.Person and Sales. PersonCreditCard tables see below. You can click the data dictionary link to understand the meaning of the columns and relationships between tables. Table Person. Person: Column Name Business EntityID PersonType NameStyle Title FirstName MiddleName LastName Suffix EmailPromotion Additional Contact Info Demographics rowguid ModifiedDate NULL? NOT NULL int NOT NULL nchar(2) bit Credit CardID NOT NULL |nvarchar(8) nvarchar (50) NOT NULL |nvarchar (50) NOT NULL |nvarchar(50) Invarchar(10) NOT NULL |int xml xml Table Sales. Person Credit Card: NOT NULL uniqueidentifier | NOT NULL datetime Column Name NULL? Type Business EntityID NOT NULL int NOT NULL int L Part B: for this part, you will use tables from IST302 database as source tables. 1 Create a copy of SALES table from IST302 database to your database. Name this table MY SALES. SELECT * INTO newtable FROM oldtable WHERE condition; 2 Create a view PRODUCT SUMMARY_V that has the Product ID, Year (i.e. year component of TIME_ID), Month (i.e. month component of TIME_ID), Total Amount Sold, Total Quantity Sold, and Average Sale Price (=Total Amount Sold/Total Quantity Sold) for each product in the MY_SALES table. Round the Average Sale Price to 2 decimal places. Note: you should include WITH SCHEMABINDING option when creating the view to prevent underlying tables being changed under the view. Create an indexed view PRODUCT_SUMMARY_M that correspond to your PRODUCT_SUMMARY_V. (HINT: you will get an error code 8668 if you simply create an indexed view using the same query as part B.2. The work around is to create an indexed view that do not include the Average Sale Price column; and then create a view PRODUCT_SUMMARY_M_AVG on top of the indexed view with the additional calculated column Average Sale Price.) Note: you must verify that the view definition is deterministic; and you must create the view by using the WITH SCHEMABINDING option. Also, if GROUP BY is present, the VIEW definition must contain COUNT_BIG(*) and must not contain HAVING. 3 4 Run a query that JOINS PRODUCT_SUMMARY_V and PRODUCTS table, and outputs Product ID, Product Description, Year, Month, Total Amount Sold, Total Quantity Sold, and Average Sale Price where the product subcategory is 'Documentation' or 'Accessories'. Report the query execution time from Messages tab. Note: you should run SET STATISTICS TIME ON command before running the query; and run SET STATISTICS TIME OFF after. The query execution time includes SQL Server parse and compile time and execution time. Report both. 1 Read Create Index View document before you proceed. 5 Save output as above, but the query JOINS PRODUCT_SUMMARY_M_AVG and PRODUCTS table. Report the query execution time from Messages tab. The query execution time includes SQL Server parse and compile time and execution time. Report both. Compare the query execution time of part B.4 and part B.5 with your explanation. 6 7 Same as part B.4 but use an In-Line view that corresponds to PRODUCT_SUMMARY_V. APPENDIX A: Additional Tables for Computer Exercises In these exercises, you will continue using tables in the AdventureWorksDB: Human Resources Schema (see CE4) as the source data. You will also be using Person.Person and Sales. PersonCreditCard tables see below. You can click the data dictionary link to understand the meaning of the columns and relationships between tables. Table Person. Person: Column Name Business EntityID PersonType NameStyle Title FirstName MiddleName LastName Suffix EmailPromotion Additional Contact Info Demographics rowguid ModifiedDate NULL? NOT NULL int NOT NULL nchar(2) bit Credit CardID NOT NULL |nvarchar(8) nvarchar (50) NOT NULL |nvarchar (50) NOT NULL |nvarchar(50) Invarchar(10) NOT NULL |int xml xml Table Sales. Person Credit Card: NOT NULL uniqueidentifier | NOT NULL datetime Column Name NULL? Type Business EntityID NOT NULL int NOT NULL int L
Expert Answer:
Answer rating: 100% (QA)
Answer Create an indexed view without Average Sale Price ... View the full answer
Related Book For
Modern Systems Analysis And Design
ISBN: 9780134204925
8th Edition
Authors: Joseph Valacich, Joey George
Posted Date:
Students also viewed these programming questions
-
What are the current statutory requirements for tax compliance? Which is the most suitable commercially available financial-management accounting software for Career Training? What are the...
-
The payroll project that follows is the online version of the same project you completed manually in Chapter 7 of your text. For this project, you will use the Cengage Learning General Ledger to...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Differentiate implicitly to find 2x + 5xy + 5y +16y - 8 = 0; dy dx . Then find the slope of the curve at the given point. (-2,0)
-
A butterfly at eye level is 20 cm in front of a plane mirror. You are behind the butterfly, 50 cm from the mirror. What is the distance between your eye and the image of the butterfly in the mirror?
-
A. You must apply for this credit card offer by July 1. B. You must apply for this credit card offer by July 1 2020. C. You must apply for this credit card offer by July 1 2020 in order to be...
-
A trade discount is a reduction from the list or catalog price offered to different classes of customers. True/False
-
Periodic versus Perpetual Entries Chippewas Company sells one product. Presented below is information for January for Chippewas Company. Jan. 1 Inventory 100 units at $6 each 4 Sale 80 units at $8...
-
Tamarisk Corporation donates equipment and a truck to the community Home Assistance Centre. The equipment had a cost of $119,000, accumulated depreciation to the contribution date of $45,000, and a...
-
Fair value accounting: the shortcomings Find and read the following article: Benston, \(\mathbf{G}\) 2008, 'The shortcomings of fair value accounting described in SFAS 157', Journal of Accounting and...
-
Read chapter 1 of Birzer's Police Field Operations. Write a Summary of this chapter and include At least four topics from the chapter
-
Stock return r_stock is either +2500% or -100% with equal probabilities. Find: E[r_stock] = Var[r_stock] = std_stock= Is such stock attractive? Would you like to invest everything in this stock? What...
-
Sprints stock is currently trading at $36.00 The stock will pay a dividend of $3.40 and dividends are expected to increase by 7.00% thereafter. What is the cost of equity for Sprint based on the...
-
4. Suppose that the Mayfields decide to retire at age 60. How much do they need in assets at that time to fund income needs from ages 60-62, assuming that they still want $90,000 (in today's dollars)...
-
You need to borrow money to purchase Holiday inventory.You have a $300,000 line of credit with a 12% compensating balance requirement. The quoted interest rate is 7.5% annually. You need to borrow...
-
Use Euler's method to find y-values of the solution for the given values of x and Ax, if the curve of the solution passes through the given point. Check the results against known values by solving...
-
Required information [The following information applies to the questions displayed below] The balance sheets for Federer Sports Apparel for 2025 and 2024 are presented below. 2. Prepare a horizontal...
-
31. What is the income that can be received over 15 years from $500,000 earning 6% annually? 32. What is the semiannual payment required to retire $50,000 in debt over 5 years at 8% compounded...
-
What are the common security threats to systems? How can they be addressed?
-
What is a use case diagram?
-
What is the conventional wisdom about implementation success?
-
The following summarised information relates to the Pagg group of companies. Additional information: 1 Pagg acquired its shareholding in Ragg Ltd on 1 April 2005. Raggs profit and loss account...
-
You are presented with the following summarised information relating to Block plc for the year to 30 September 2008: Additional information: 1 Block purchased 80 per cent of the share capital of Chip...
-
Pop and Mom Ltd bought 120,000 of the 200,000 issued ordinary 1 shares of Sonny Ltd for 300,000 on 31 July 2004. Sonny Ltd financial statements are drawn up annually to 31 December. The balance sheet...
Study smarter with the SolutionInn App