SELECT Query Assignment | Homework For You

1. Write a SELECT query which returns the amount of orders each customer has placed, including those who have made zero orders. Use a correlated subquery in the SELECT clause to retrieve the amount of orders. Return the following columns:Homework For You

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

• The CustomerID column from the Customers table.

• A calculated column with alias Fullname which returns the customer’s last name and firstname with a comma and space between them, example: (Haley, Shane).

• The count of orders made by the customer. Use alias TotalOrders for the aggregated column.

Sort the result set in descending sequence by TotalOrders and ascending sequence by Fullname.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

2. Alter exercise 1 so that it does not use any subqueries and returns the same results.

3. Write a query which selects data from two common table expressions (CTEs). The first CTE should be called ShippingAddresses and should return all of the columns from the Addresses table where the address is a customer shipping addresses. The second CTE should be called CustomersSingleAddress and should return all of the columns from the Customers table where the customer uses the same address for both shipping and billing purposes. Using both CTEs, write a select statement which returns the following:

• A calculated column with alias Fullname which returns the customer’s last name and firstname with a comma and space between them, example: (Haley, Shane). All customers should be returned from CTE CustomersSingleAddress regardless of the ShippingAddresses CTE.

• The Line1 column

• The City column

• The State column

Sort the result set in ascending sequence by State, ascending sequence by City, and ascending sequence by Fullname.

CONSTRAINTS: Do not use any joins in the CTEs. Use subqueries in the CTEs if necessary to compare data from one table to data in another table. Joins may be used in the final SELECT statement which queries the two CTEs.

4. Write a query which selects data from two common table expressions (CTEs). The first CTE should be called CategoryTotals and should return the following:

• The CategoryID column from the Categories table.

• The CategoryName column from the Categories table.

• An aggregate column with alias TotalCatOrders which sums the Quantity from the OrderItems table The second CTE should be called ProductTotals and should return the following

• The CategoryID column from the Products table.

• The ProductName column from the Products table.

• An aggregate column with alias TotalProdOrders which sums the Quantity from the OrderItems table

Using both CTEs, write a select statement which returns the following:

• The CategoryName column

• The TotalCatOrders column

• The ProductName column

• The TotalProdOrders columnHomework For You

Sort the result set in descending sequence by TotalCatOrders and descending sequence by TotalProdOrders

CONSTRAINTS: None. With the exception of the usage of the CTEs, no subqueries are required to complete this exercise (everything can be accomplished using joins, even within the CTEs). Get Computer Science homework help today

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Homework Writing Services
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Medicine
Good work
Customer 453187, May 25th, 2022
Business and administrative studies
Excellent.
Customer 462995, June 9th, 2022
Commitment Statement for Canberra - Subclass 491 Offshore Visa
Thank you so much for all your help and support. Thank you writer for all your efforts and great work. Thank you all once again.
Customer 455757, January 29th, 2022
English 101
Always use Grammarly before submitting your papers.
Customer 462495, April 6th, 2022
Business and administrative studies
Good work.
Customer 452615, May 9th, 2022
Law
Commendable.
Customer 456823, April 29th, 2022
Ethics
Good Job!
Customer 454777, July 8th, 2020
Psychology
This paper is beautifully written and is above my expectations. Thank you to the writer for writing a beautiful paper and a huge thank you to the customer service team for ensuring I received an outstanding product. I want to issue a special thank you to John for not only ensuring that I received an outstanding product, but also for assisting me with the website issues that I have been having. Thank you to everyone!
Customer 452455, April 5th, 2023
ASCI 491: Operational Applications in Aeronautics
Well articulated.
Customer 457731, April 12th, 2022
Film & Theater studies
Good work.
Customer 462687, July 4th, 2022
Web Design
Well done
Customer 452441, April 15th, 2022
Business
Blends well with the target website's affairs.
Customer 452441, June 22nd, 2022
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat