Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a copy of my assignment it may be hard to answer considering they're all connected, but basically looking for any help possible. We

This is a copy of my assignment it may be hard to answer considering they're all connected, but basically looking for any help possible. We use SQL server for the assignments. If i am leaving out any information that is needed to answer this please comment. In chapter 6 and 7 you learned about writing SQL code. This lesson will have you write SQL code to perform five different actions (questions) A key component of writing code is understanding the data and the database/tables that you will be using. You need to review the tables and the related data that you will be using in each of the five questions. Just because you have records or results returned by your code doesnt mean that the code is correct. You must understand what the question is asking you to do and the expected results based on an understanding/review of the data in the tables. An example of this is Question #1. You are asked to return all the pledge records for donor 59034. Check the Pledge table in the Donors database to see how many donations were made by this donor. Your code should return this number along with the other requested information. You may need to include more than one table in your code to obtain the correct results. To review the data in a table you expand the databases in your SQL Server. Then expand the tables in the database. You can view the data by right clicking on the table name and clicking on Select Top 1000 Rows. You may have questions since the instructions will not tell you the exact code you need to write. Like many tasks you have flexibility in completing (writing the SQL code) it. Please post questions in the related discussion topic for HO #5. Include the table on the left (or at least one table where multiple are used), the code window, and the results window (dont need every result just a good sample). You can display the window to write your code by selecting New Query (see arrow on the included figure). Since there are many databases in your SQLServer you should tell SQLServer which database to use so I coded use Donors. Once you write the code you can execute it by selecting Execute. SQLServer will display the results in the bottom part of the window like my example. If there are errors, they will be displayed in the bottom part of the window where the results display. Test this process with some very basic code to get comfortable using the features. The questions are not related so you can complete them in any order. This may take some time if you have not written much code so please start ASAP. #1) Display Last Name, First Name, DonorId, Fundname, TotalPledged from the donors database (you may need to use donor and pledge tables to get the information) for Donor ID 59034. (Your results window should have 3 rows) #2) Display all records from the PurchaseOrderHeader from the AdventureWorks Database that were sold by Employee 261 (Your results window should have 401 rows) #3) Display salesorderid, orderdate, totaldue, and territory name from salesorderheader and salesterritory for all totaldue that are greater than $20,000 and from the Southwest territory. List the total ascending. You will be using AdventureWorks Database. (Your results window should have 351 rows) #4) Display Salesorderid, Order date, Due date, Order Quantity, Line Total, ProductId, Name, and Color from SalesOrderHeader, SalesOrderDetail and Product tables for ProductID 771. (Your results window should have 241 rows) In any of the above queries, if you are returning more rows then specified means that you have not joined the tables correctly. In the Where clause make sure you are specifying the join condition between the tables. e.g. Where SalesOrderDetail.ProductId=Product.ProductId when you are trying to retrieve the data that is common from these two tables. #5) Create a new database called Your initials_ERD (mine would be RVT_ERD). The SQL code to create a basic database is create database RVT_ERD. Using SQL (reference examples in chapters 6 and 7) create tables and relationships that match your ERD submitted in HO #4. Include primary and foreign key constraints plus data types. (15 pts.) I need screenshot of your ERD expanded with tables and relationships. Also a separate screenshot of each query you will write for questions 1 4. I need to see the query written, the data displayed in the results window and total number of rows returned at the bottom right corner of the results window. In total 5 or more screenshots for this Hands-On Lesson.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Explain Decentralization and Declassification

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago