Northwind › Views
Order Subtotals view
830 rows. A view stores a SELECT statement, not rows: each time you open it, SQLite runs the query again.
Columns
| # | Name | Type | Not null | Default | Key | References |
|---|---|---|---|---|---|---|
| 0 | OrderID |
INTEGER |
no | — | ||
| 1 | Subtotal |
(none) | no | — |
Definition
CREATE VIEW "Order Subtotals" AS
SELECT OrderID, sum(round(UnitPrice * Quantity * (1 - Discount), 2)) AS Subtotal
FROM "Order Details"
GROUP BY OrderID