• Login

DataSoft Corporation

Select Functions Examples

The following example selects the minimum salary from the Faculty table.

SELECT MIN(salary) FROM Faculty

MIN(expression), MAX(expression), SUM(expression), STDEV(expression), AVG(expression), COUNT(*), and COUNT(expression) are supported.

COUNT(expression) counts all non-NULL values for an expression across a predicate. COUNT(*) counts all values, including NULL values.

The following example counts all the rows in q where a+b does not equal NULL.

SELECT COUNT(a+b) FROM q

The STDEV function returns the standard deviation of all values based on a sample of the data. The expression must be a numeric data type and an eight-byte DOUBLE is returned. A “floating point overflow” error results if the difference between the minimum and maximum values of the expression is out of range. Expression cannot contain aggregate functions. There must be at least two rows with a value in the expression field or STDEV is not calculated and returns a NULL.

The following returns the standard deviation of the grade point average field in the Student sample table.

SELECT STDEV(Cumulative_GPA) FROM student
Thursday, 18 April 2019 Posted in Example SQL Statements