2. Write a SELECT assertion that produces one document for every product class that has the next columns:
The column class title within the Classes database.
The variety of gadgets within the Merchandise desk.
The value of the costliest merchandise within the desk of Merchandise.
The end result set is sorted such that the class containing probably the most items shows first. Take a snapshot of the executed question and the ensuing knowledge.
Question
SELECT c.class title and c.class title COUNT (p.product id) AS depend, MAX(p.checklist value) FROM classes AS c ON c.class id = p.class id INNER JOIN merchandise p Group by the c.class title class ORDER BY quantity DESC;
Write a SELECT assertion that produces one row for every shopper with orders with the next columns: The column electronic mail tackle within the Clients desk, The full of the merchandise value multiplied by the quantity within the Order Objects database.
The sum of the low cost quantity column multiplied by the amount column within the Order Objects database.
Kind the end result set by the sum of the merchandise costs for every shopper in lowering order. Take a snapshot of the executed question and the ensuing outcomes.
Question
SELECT c.electronic mail tackle,SUM(o.merchandise value)*COUNT(o.merchandise id) AS “First Sum” and SUM(o.low cost quantity)*COUNT(o.merchandise id) AS “Second Sum” FROM prospects AS c INNER JOIN orders AS o c.buyer id = ord.buyer id; ORDER BY SUM(o.merchandise value) DESC; INNER JOIN order gadgets AS o ON o.order id=ord.order id GROUP BY c.buyer id;
4. Write a SELECT assertion that produces a single row for every shopper whose purchases have the next columns:
The Clients desk’s electronic mail tackle discipline.
A tally of the amount of orders.
The full quantity for every order (Trace: Subtract the quantity of the low cost from the value). Multiply then by the quantity.)
Return solely rows through which the shopper has a number of orders. Kind the end result set in descending order by the entire variety of the road gadgets. Take a snapshot of the executed question and the ensuing outcomes.
Question
(SUM(merchandise value)-SUM(low cost quantity))*SUM(amount) AS “Whole Quantity” FROM prospects SELECT electronic mail tackle,COUNT(orders.order id) AS “orderCount”,(SUM(merchandise value)-SUM(low cost quantity))*SUM(amount) AS “Whole Quantity” JOIN prospects ON orders.buyer id = prospects.buyer id JOIN order gadgets ON orders.order id=order gadgets.order id GROUP BY electronic mail tackle WHERE COUNT(orders.order id) > 1 AND ORDER BY SUM(merchandise value);