SQL FLOOR Function

Example

Return the largest integer value that is equal to or less than 25.75:

SELECT FLOOR(25.75) AS FloorValue;

Definition and Usage

The FLOOR() function returns the largest integer value that is smaller than or equal to a number.

Tip: Also look at the CEILING() and ROUND() functions.

Syntax

FLOOR(number)

Continue reading SQL FLOOR Function

SQL EXP Function

Example

Return e raised to the power of 1:

SELECT EXP(1);

Definition and Usage

The EXP() function returns e raised to the power of a specified number.

The constant e (2.718281…), is the base of natural logarithms.

Note: See also the LOG() function.

Syntax

EXP(number)

Continue reading SQL EXP Function

SQL COUNT Function

Example

Return the number of products in the “Products” table:

SELECT COUNT(ProductID) AS NumberOfProducts FROM Products;

Definition and Usage

The COUNT() function returns the number of records returned by a select query.

Note: NULL values are not counted.

Syntax

COUNT(expression)

Continue reading SQL COUNT Function

SQL CEILING Function

Example

Return the smallest integer value that is greater than or equal to a number:

SELECT CEILING(25.75) AS CeilValue;

Definition and Usage

The CEILING() function returns the smallest integer value that is larger than or equal to a number.

Tip: Also look at the FLOOR() and ROUND() functions.

Syntax

CEILING(number)

Continue reading SQL CEILING Function

SQL AVG Function

Example

Return the average value for the “Price” column in the “Products” table:

SELECT AVG(Price) AS AveragePrice FROM Products;

Definition and Usage

The AVG() function returns the average value of an expression.

Note: NULL values are ignored.

Syntax

AVG(expression)

Continue reading SQL AVG Function