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

SQL ASIN Function

Example

Return the arc sine of a number:

SELECT ASIN(0.25);

Definition and Usage

The ASIN() function returns the arc sine of a number.

The specified number must be between -1 to 1, otherwise this function returns NULL.

Syntax

ASIN(number)

Continue reading SQL ASIN Function

SQL ACOS Function

Example

Return the arc cosine of a number:

SELECT ACOS(0.25);

Definition and Usage

The ACOS() function returns the arc cosine of a number.

The specified number must be between -1 to 1, otherwise this function returns NULL.

Syntax

ACOS(number)

Continue reading SQL ACOS Function