 |
 |
Customer and Suppliers by City |
 |
Top |
 |
 |
 |
 |
create view "Customer and Suppliers by
City" AS
SELECT City, CompanyName, ContactName, 'Customers' AS
Relationship
FROM Customers
UNION SELECT City, CompanyName, ContactName, 'Suppliers'
FROM Suppliers
--ORDER BY City, CompanyName
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
Customers |
 |
 |
 |
CompanyName |
 |
 |
Customers |
 |
 |
 |
ContactName |
 |
 |
Customers |
 |
 |
 |
City |
 |
 |
Suppliers |
 |
 |
 |
CompanyName |
 |
 |
Suppliers |
 |
 |
 |
ContactName |
 |
 |
Suppliers |
 |
 |
 |
City |
 |
|
 |
 |
 |
 |
 |
 |
Alphabetical list of products |
 |
Top |
 |
 |
 |
 |
create view "Alphabetical list of
products" AS
SELECT Products.*, Categories.CategoryName
FROM Categories INNER JOIN Products ON Categories.CategoryID =
Products.CategoryID
WHERE (((Products.Discontinued)=0))
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
Products |
 |
 |
 |
ProductID |
 |
 |
Products |
 |
 |
 |
ProductName |
 |
 |
Products |
 |
 |
 |
SupplierID |
 |
 |
Products |
 |
 |
 |
CategoryID |
 |
 |
Products |
 |
 |
 |
QuantityPerUnit |
 |
 |
Products |
 |
 |
 |
UnitPrice |
 |
 |
Products |
 |
 |
 |
UnitsInStock |
 |
 |
Products |
 |
 |
 |
UnitsOnOrder |
 |
 |
Products |
 |
 |
 |
ReorderLevel |
 |
 |
Products |
 |
 |
 |
Discontinued |
 |
 |
Categories |
 |
 |
 |
CategoryID |
 |
 |
Categories |
 |
 |
 |
CategoryName |
 |
|
 |
 |
 |
 |
 |
 |
 |
 |
create view "Current Product List" AS
SELECT Product_List.ProductID, Product_List.ProductName
FROM Products AS Product_List
WHERE (((Product_List.Discontinued)=0))
--ORDER BY Product_List.ProductName
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
Products |
 |
 |
 |
ProductID |
 |
 |
Products |
 |
 |
 |
ProductName |
 |
 |
Products |
 |
 |
 |
Discontinued |
 |
|
 |
 |
 |
 |
 |
 |
 |
 |
create view "Orders Qry" AS
SELECT Orders.OrderID, Orders.CustomerID, Orders.EmployeeID,
Orders.OrderDate, Orders.RequiredDate,
Orders.ShippedDate, Orders.ShipVia, Orders.Freight,
Orders.ShipName, Orders.ShipAddress, Orders.ShipCity,
Orders.ShipRegion, Orders.ShipPostalCode, Orders.ShipCountry,
Customers.CompanyName, Customers.Address, Customers.City,
Customers.Region, Customers.PostalCode, Customers.Country
FROM Customers INNER JOIN Orders ON Customers.CustomerID =
Orders.CustomerID
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
Orders |
 |
 |
 |
OrderID |
 |
 |
Orders |
 |
 |
 |
CustomerID |
 |
 |
Orders |
 |
 |
 |
EmployeeID |
 |
 |
Orders |
 |
 |
 |
OrderDate |
 |
 |
Orders |
 |
 |
 |
RequiredDate |
 |
 |
Orders |
 |
 |
 |
ShippedDate |
 |
 |
Orders |
 |
 |
 |
ShipVia |
 |
 |
Orders |
 |
 |
 |
Freight |
 |
 |
Orders |
 |
 |
 |
ShipName |
 |
 |
Orders |
 |
 |
 |
ShipAddress |
 |
 |
Orders |
 |
 |
 |
ShipCity |
 |
 |
Orders |
 |
 |
 |
ShipRegion |
 |
 |
Orders |
 |
 |
 |
ShipPostalCode |
 |
 |
Orders |
 |
 |
 |
ShipCountry |
 |
 |
Customers |
 |
 |
 |
CustomerID |
 |
 |
Customers |
 |
 |
 |
CompanyName |
 |
 |
Customers |
 |
 |
 |
Address |
 |
 |
Customers |
 |
 |
 |
City |
 |
 |
Customers |
 |
 |
 |
Region |
 |
 |
Customers |
 |
 |
 |
PostalCode |
 |
 |
Customers |
 |
 |
 |
Country |
 |
|
 |
 |
 |
 |
 |
 |
Products Above Average Price |
 |
Top |
 |
 |
 |
 |
create view "Products Above Average
Price" AS
SELECT Products.ProductName, Products.UnitPrice
FROM Products
WHERE Products.UnitPrice>(SELECT AVG(UnitPrice) From Products)
--ORDER BY Products.UnitPrice DESC
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
Products |
 |
 |
 |
ProductName |
 |
 |
Products |
 |
 |
 |
UnitPrice |
 |
|
 |
 |
 |
 |
|
|