Question
I don't need the answers, I just need the querries syntax not the output. 6. Which states customers have an average household income over $120,000?
I don't need the answers, I just need the querries syntax not the output.
6. Which states customers have an average household income over $120,000? Output the name of each state that meets this requirement, the name of the region where the state is located, and the states customers average household income (HHI); order the output in descending order from highest HHI to lowest and be sure each column has a meaningful name. | |
SQL Query Syntax | Output of the Query* |
|
|
7. How many units of each vacuum model were sold during the period from August 11-20, 2019, and what was the total revenue generated by those sales? Order results from the product with the highest revenue to the lowest, include the ModelName in your output, and be sure that all columns have meaningful names. Your output should only include vacuum models (not warranties). | |
SQL Query Syntax | Output of the Query* |
|
|
8. What is the most popular product for customers who own pets? Answer the question by outputting the name of the most popular product and the number of units sold to pet owners as well as the total amount of revenue generated from the sale of those units to pet owners. Be sure your columns have meaningful names and that your query only outputs the one most popular product. | |
SQL Query Syntax | Output of the Query* |
|
|
*If the query returns more than 10 lines, include only the first 10 lines of output. |
Part C | Answers (5 Points Each) |
1. Assume you wanted to add another state to the database, the state of Nevernia. Nevernia has a state code of NA, is in region 2, and has a population of 40,000. Nevernia is a small state. Include in your submission (1) the query that you would use to add this additional record to the database and (2) the output of a query that shows the StateIDS, RegionID, Population, and StateName of all states with a population under 1,000,000 AS WELL AS the query you used to generate this output. | |
INSERT INTO Query Syntax (1) | |
SELECT Query Syntax (2) | Output of the Query* |
2. Vivian Dunn (CustID 936) was recently married. Vivian has formally requested a name change and also a marital status change. Change the Customer table in your personal database so that Vivian Dunns last name is now Bryant and her marital status is changed from single to married. Run the following query to verify Vivians Customer ID and to get acquainted with all the customers in the Customer table with the Lname Dunn or Bryant (note: only one last nameViviansof the 6 records should change when you run your UPDATE query): SELECT * FROM Customer WHERE Lname = 'Dunn' OR Lname = 'Bryant'; Include in your submission (1) the query that you would use to change (update) Vivians record in the database and (2) the output of a query that shows Vivians updated record AS WELL AS the query you used to generate this output. | |
UPDATE Query Syntax (1) | |
| |
SELECT Query Syntax (2) | Output of the Query* |
Part D | Answers (10 Points) |
| |
Describe what the query will output (i.e., what are you trying to show with the query?). Describe how DustBunny might use this query to gain insight into their business. | |
SQL Query Syntax | Output of the Query* |
*If the query returns more than 10 lines, include only the first 10 lines of output. Do not about copying the Column Headers. |
Extra Credit | Answers (2 Points Each) |
1. For each order placed on August 18th, 2019, how many unit items (a unit item is 1 vacuum cleaner; two of the same model would be 2 unit items; one of one model and one of another would also be 2 unit items) were purchased? Output only those orders that included two or more unit items, include in your output the order number and the number of unit items, and order your output by order number (lowest to highest). (Hint: you will need two tables, SalesOrder and OrderLine.) (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. What is the total value of all orders placed for each region? The output should include the name of the region as well as the total value of all orders placed there. Order results alphabetically by region. (Hint: the USState table and the Customer table will need to be part of your query.) Based on these results, to which region do you think the company marketed most heavily during the early part of August 2019? | |
SQL Query Syntax | Output of the Query* |
|
|
3. Which three customers bought the highest number of MadHare units during the period covered by the database? Your output should include first name, last name, and the number of units purchased and should include information only about the three customers with the highest number of MadHare units. Be sure your query references the Model table (i.e., do not look up the model number for MadHare, instead include in your query content that figures out which records refer to MadHare). | |
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started