Using Microsoft Office for Mac as a Relational Database

By Jim Gordon, co-author of Office 2011 for Mac All-in-One For Dummies.

Part 17 - Queries - Calculated field

This syntax using AS creates a new calculated field called AvgOfUnitPrice on the fly in SQL using ExampleData.xls as the data source.

SELECT SupplierID, Avg(UnitPrice) AS AvgOfUnitPrice
FROM Products

PERFORMING CALCULATIONS IN SQL
This example multiplies order quantity times price.

SELECT Orders.OrderID, Orders.ShipToName, Order_Details.Quantity, Order_Details.UnitPrice, quantity*Unitprice FROM Orders, Order_Details WHERE (Order_Details.OrderID=Orders.OrderID)



Part 1
Part 16 (Previous)
Part 18 (Next)