The purpose of this assignment is to practice


The purpose of this assignment is to practice UNIONS and to use subqueries to analyze data in a record set.

For this assignment, you will analyze data to find similarities and UNION all data via a method that keeps the data uniform. You will use Microsoft SQL Server 2016 Developer Edition and the content from the AdventureWorks 2016 and Scripts for SQL Server 2016 CTP3 to complete the assignment.

Please note that when SQL queries are run, results are generated in the form of data. This data should be exported and saved to Excel for a visual check of accuracy.

Create a Word document that includes the SQL queries used to explore the database tables, and answer the following questions.

Query Scenarios

Problem One

As part of a yearly fundraising effort for the community, your manager has given you an Excel worksheet titled “Donations.” It includes all employees’ pledged donations for the year. The sheet consists of three tabs that correspond to the 3 months when employees were asked to submit pledges. Load this file into the AdventureWorks database through the Import and Export Wizard. Once loaded, use a UNION ALL statement to combine the three data sets into a temporary table called “#TotalDonations.”

Problem Two

Redoing the UNION ALL statement you created in Problem One, create a temporary table looking exclusively at “SUM of Donations by Month.” Title each of the three fields “Donations and Month” with the temporary table titled “#DonationsbyMonth.” When complete, provide the total of the final amount of donations raised.

Problem Three

Your manager e-mails you about the final results you provided in Problem Three, and believes you must have made a mistake when calculating the total donations. The amount is $100.00 less than the total amount calculated by the manager. The manager thinks it is possible that one employee might have accidently pledged $100.00 twice. Explain how this event might occur with a UNION ALL. Review the UNION ALL, and if there is an error, rewrite the first query with a UNION statement. Discuss whether the manager’s assumption was correct and explain why.

Problem Four

You receive an e-mail request from Human Resources requesting information about the last time a pay rate was changed for an employee. The employee’s “NationalIDNumber” is 486228782. Develop a subquery instead of an INNER JOIN to provide the answer to this request.

Note: A subquery is another method of writing a JOIN. It can be efficient when used at the correct times.

General Requirements

Compile the Excel data file and Word document containing the SQL queries and answers to the questions into a .zip file and submit to your instructor.

APA style is not required, but solid academic writing is expected.

This assignment uses a rubric. Please review the rubric prior to beginning the assignment to become familiar with the expectations for successful completion.

You are not required to submit this assignment to LopesWrite.


Order Now 100% Plagiarism Free Essay

do my work online
Order Now

Related Posts

Leave a Reply