Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Divides one number by another.


dividend/divisor
dividend

The numeric expression to divide. The dividendcan be any valid expression in Microsoft SQL Server Compact of any of the data types of the numeric data type category, except the datetime data type.

divisor

The numeric expression by which to divide the dividend. The divisorcan be any valid SQL Server expression of any of the data types of the numeric data type category, except the datetime data type.

Returns the data type of the argument with the higher precedence.

The following example uses the divide arithmetic operator to determine the average total cost for each order of a specific product (with a Product ID of 51) in the Order Details table. Product 51 has 39 orders.

SELECT (SUM(UnitPrice * Quantity))/39 AS "Avg. Cost per Order" FROM "Order Details" WHERE ProductID = '51'

This is the result set:

Avg. Cost per Order
-------------------
1147.2461
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.