Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| modul:m290:learningunits:lu04:loesungen:l03 [2024/09/27 12:49] – [E: SUM] vdemir | modul:m290:learningunits:lu04:loesungen:l03 [2024/10/17 12:35] (aktuell) – vdemir | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== | + | ====== |
| ==== A: MIN ==== | ==== A: MIN ==== | ||
| - | We want to know which of our products actually the most expensive | + | We want to know which of our products actually the cheapest |
| SELECT min(price) | SELECT min(price) | ||
| Zeile 13: | Zeile 13: | ||
| ==== B: MAX ==== | ==== B: MAX ==== | ||
| - | What is the lowest | + | What is the highest |
| SELECT max(price) | SELECT max(price) | ||
| Zeile 51: | Zeile 51: | ||
| For our anual report we need list of the orders, and the value of each, grouped by the OrderID. | For our anual report we need list of the orders, and the value of each, grouped by the OrderID. | ||
| - | SELECT sum(price*quantity) | + | SELECT |
| FROM OrderDetails, | FROM OrderDetails, | ||
| - | WHERE orderDetails.OrderID = 10255 | + | WHERE OrderDetails.ProductID = Products.ProductID |
| - | AND OrderDetails.ProductID = Products.ProductID; | + | GROUP BY OrderDetails.orderid; |
| + | |||
| + | *** Result from the db:** | ||
| + | {{: | ||
| + | | ||
| | | ||
| ===== Vocabulary ===== | ===== Vocabulary ===== | ||