Question
make a report which will give you information about shipments sent by your lower-commission employees. Create a query which will Include only all those
make a report which will give you information about shipments sent by your lower-commission employees. Create a query which will
⦁ Include only all those shipments which were sent by an employee whose commission is 10% or less (include commissions of exactly 10%)
⦁ Print the state, company name, total quantity in the shipments for that customer, and the maximum employee commission in that order left to right.
⦁ Sort it alphabetically by state (ascending). If one state has several companies in it, they should be sorted within the state, with the highest total order quantity on top.
Your data may or may not match the example below.
⦁ [SQL Week 2 Question 200-503] You suspect certain employees are not servicing very many shipments, and some may not have any shipments at all.
Create SQL to run a report which will
⦁ List all your employees and the customers they serviced along with the number of shipments for each customer. Include all employees, including those who may not have serviced any customers.
⦁ Note you want the number of shipments, not the sum of shipment quantity. For example, if you have one shipment of 10 units, and another shipment of 20 units, our number of shipments here is 2.
⦁ Sort the list ascending on number of shipments (so the smallest numbers of shipments are at the top), and then on employee id. If an employee has not serviced any customers, display that employee at the very top.
For the Question 4, you may want to review the SQL Aliases functionality ("select X from Y as Z"). There is a section in WWW3 SQL schools on this.
You also may find the following syntax helpful. If we have a table named "table" with columns A and B in it, "select table.RecordID, table.A, table.B, (table.A + table.B) as Answer from table;" will give you the following. The (table.A + table.B) performs the addition for each row, and the "as
⦁ [SQL Week 2 Question 200-504] You want to compute the order total for your shipments. For all of your shipments, put together a report which contains the following columns.
⦁ Sort it ascending on idShipment
⦁ Create a new field in the output result called OrderTotal, which is the price per unit multiplied by the order quantity. You will need to calculate this field in SQL.
⦁ [SQL Week 2 Question 200-505] You want to report on a certain group of your products. Select
⦁ Only customers who have a balance of 0
⦁ Only shipments which were sent by employees whose employee location is California, Maryland, or New York
⦁ Only products which have had a shipment
⦁ Only employees who have made a shipment
⦁ Only customers who have received a shipment
⦁ Compute the total quantity of shipments which meet these criteria. Here we want the number of items shipped. If you have one shipment of 10 items, and another shipment of 20 items, this number should be 30.
⦁ Aggregate it by manufacturer and by product name. This means each manufacturer/product name combination appears on only one row in the table. If a manufacturer makes more than one product, it's OK if it shows up once per product.
⦁ Sort it descending by the sum of the shipment quantity, so the largest shipment quantity shows up on top. Within shipment quantities, sort it alphabetically on manufacturer and then product name.
Your results should look a little bit like this. Your data may or may not match this example.
Input example:
Shipment ID Manufacturer Product Name Shipment
1 Alpha Mfg Gamma Zap 5
2 Alpha Mfg Gamma Zap 5
3 Alpha Mfg Gamma Zap 5
4 Beta Mfg Gamma Zap 10
5 Alpha Mfg Delta Cross 6
6 Alpha Mfg Delta Cross 1
7 Alpha Mfg Epsilon Ray 8
8 Beta Mfg Frank Zappa 10
Output example:
Manufacturer Product Name Total Shipment Quantity
Alpha Mfg Gamma Zap 15
Beta Mfg Frank Zappa 10
Alpha Mfg Epsilon Ray 8
Alpha Mfg Delta Cross 7
⦁ [SQL Week 2 Question 200-506] Last one! You want to know how many times products were shipped to customers. Note you want the total number of shipments, not the number of items shipped - one shipment of 10 items and one shipment of 20 items would be two shipments, not 30 items.
⦁ Include all products, even if they had no shipments. In this case, their count would be 0.
⦁ Include the manufacturer and the product name
⦁ Include the customer company name
⦁ Sort it so the smallest count of shipments is on top. After that, sort ascending by Manufacturer name and then product name.
Step by Step Solution
3.49 Rating (142 Votes )
There are 3 Steps involved in it
Step: 1
For the first query ...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