/ (Divide) (SQL Server Compact)

Divides one number by another.

Syntax

dividend/divisor

Arguments

  • 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.

Result Types

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

Code Example

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