Owner: | dbo |
Schema bound: | |
Encrypted: | |
Creation Date: | 08/06/2000 |
Description: |
Name | Data Type | Length | NULL | IsGUID | Description | |
|
CategoryID | int | 4 |
|
|
|
|
CategoryName | nvarchar | 30 |
|
|
|
|
ProductName | nvarchar | 80 |
|
|
|
|
ProductSales | money | 8 |
|
|
Objects that [dbo].[Sales by Category] depends on
Object Name | Owner | Object Type | Dep Level | |
|
Categories | dbo | Table | 1 |
|
Customers | dbo | Table | 1 |
|
Employees | dbo | Table | 1 |
|
Shippers | dbo | Table | 1 |
|
Suppliers | dbo | Table | 1 |
|
Orders | dbo | Table | 2 |
|
Products | dbo | Table | 2 |
|
Order Details | dbo | Table | 3 |
|
Order Details Extended | dbo | View | 4 |
create view "Sales by Category" AS
SELECT Categories.CategoryID, Categories.CategoryName, Products.ProductName,
Sum("Order Details Extended".ExtendedPrice) AS ProductSales
FROM Categories INNER JOIN
(Products INNER JOIN
(Orders INNER JOIN "Order Details Extended" ON Orders.OrderID = "Order Details Extended".OrderID)
ON Products.ProductID = "Order Details Extended".ProductID)
ON Categories.CategoryID = Products.CategoryID
WHERE Orders.OrderDate BETWEEN '19970101' And '19971231'
GROUP BY Categories.CategoryID, Categories.CategoryName, Products.ProductName
--ORDER BY Products.ProductName
See Also
List of views