December 22nd, 2008

WIDTH_BUCKET (get bucket value)

The WIDTH BUCKET gives values to buckets in an equal-width histogram.

Format: WIDTH_BUCKET(expression, min, max, buckets)

Expression represents a value to be assigned to one of multiple buckets. This is normally applied to multiple row values. The range of values is defined by min (which is included in the buckets) and max (which is not included in the buckets). When the expression is less than min, zero (0) is returned. When the expression is greater than max, then max+1 is returned.

Example:      SELECT X, WIDTH_BUCKET(X, 1, 10, 5) AS 'Bucket' FROM TABLEA;

Result:

                    

> Access, DB2, MySQL, Oracle, PostgreSQL, and SQL Server do not support WIDTH_BUCKET.

December 19th, 2008

SQRT (square root of no.)

he SQRT function returns the square root of a number.
Format: SQRT(expression)

Example:           SQRT(100)     Result: 10
                   SQRT(10000)   Result: 100

 

> DB2, MySQL, Oracle, PostgreSQL, and SQL Server support the POWER function.

> Access uses ^ (an up arrow) to raise a number to a power or exponent.

> Where 10 ^ 2 = 100, you can use 100 ^ (1/2) = 10 (the square root).
Alternatively, you could use 100 ^ .5 = 10.
1000 ^ (1/3) = 10 (the cube root).

December 18th, 2008

POWER (raise no. to power)

The POWER function raises a number to a specific power or exponent.
Format: POWER(base, exponent)

Example:           POWER(10, 2) Result: 100
                   POWER(0, 0) Result: 1
                   POWER(10, -3) Result: .001

> DB2, Oracle, PostgreSQL, and SQL Server support the POWER function.

> Access uses ^ (an up arrow) to raise a number to a power or exponent.

> MySQL supports POW(base, exponent).

Next Page »