Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I don't need the answers, I just need the querries syntax not the output. Part A (PK) Answer (FK) 1. Region (RegionID) + USState (RegionID)

I don't need the answers, I just need the querries syntax not the output.

Part A (PK)

Answer (FK)

1. Region (RegionID) +

USState (RegionID)

2. USState (StateID) +

3. Customer (CustID) +

4. Customer (CustID) +

5. SalesOrder (SOID) +

6. Product (ModelID) +

7. Product (ModelID) +

Part B

Answers (9 Points Each)

1. For each customer state, output the state abbreviation (CustState) and the average household income for all customers in that state. Order results alphabetically by state abbreviation and be sure that the average household income column includes a meaningful column name. (Hint: You only need to use one table for this query since you are not asked to give the actual name of the state.) (Remember: only copy the top 10 rows do not worry about the Headers or Copy with Headers).

SQL Query Syntax

Output of the Query*

2. Output the customer name (Fname and Lname), marital status, state (use the actual state name), and household income for all customers located in Colorado (CO), Utah (UT), Washington (WA), and Wyoming (WY) who have a household income of under $119,500 and are married. Order results alphabetically by last name. Your query should not include the OR operator. (Remember: only copy the top 10 rows do not worry about the Headers or Copy with Headers).

SQL Query Syntax

Output of the Query*

3. For all orders placed on August 9, 2019 and valued at $1,125 or less, show the customers name (first and last), the order number, and the order total. Results should be put in order from the largest value to the smallest. (Remember: only copy the top 10 rows do not worry about the Headers or Copy with Headers).

SQL Query Syntax

Output of the Query*

4. For each state, what percentage of the states population purchased a DustBunny vacuum (assume everyone in the customer table has purchased a DustBunny vacuum)? Your output should include the state name, population, number of purchasers from that state, and the percentage (show as a decimal). Order the output from the highest percentage to the lowest and make sure each column has a usefully descriptive name. (Remember: only copy the top 10 rows do not worry about the Headers or Copy with Headers).

SQL Query Syntax

Output of the Query*

5. Show the five orders that included the highest number of items (e.g., if an order included 2 of one type of vacuum and 1 of another, that equates to three items). For each order, show the customer first name, customer last name, number of items, the order date, and the total value of the order. Order results from highest number of items to lowest.

SQL Query Syntax

Output of the Query*

I don't need the answers, I just need the querries syntax not the output.

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_2

Step: 3

blur-text-image_3

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

What is coaching? Is there one type of coaching? Explain.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago