In PostgreSQL, the SUM()
function computes the sum of the non-null input values and returns the result.
In other words, it adds numbers and returns the result.
Continue readingIn PostgreSQL, the SUM()
function computes the sum of the non-null input values and returns the result.
In other words, it adds numbers and returns the result.
Continue readingIn PostgreSQL, the AVG()
function computes the average (arithmetic mean) of all the non-null input values, and returns the result.
Here are three options for listing out all functions in a PostgreSQL database.
Continue readingIn SQL Server, the SUM()
aggregate function returns the sum of a given expression.
It can also be used to return the sum of all distinct (unique) values in the expression.
SUM()
only works on numeric columns. Null values are ignored.
In SQL Server, an often used function is CAST()
, which converts an expression of one data type to another. But if the cast doesn’t succeed, then it returns an error.
Enter TRY_CAST()
.
The TRY_CAST()
function doesn’t return an error if the cast fails. Instead, it returns NULL
.
There are some occasions however, where it will return an error.
Continue readingIn SQL Server, the TRY_CONVERT()
function is very similar to the CONVERT()
function, except that TRY_CONVERT()
doesn’t return an error if the conversion fails (CONVERT()
does).
Instead, the TRY_CONVERT()
function returns NULL
if the conversion doesn’t succeed.
There are some occasions however, where TRY_CONVERT()
will return an error.
In SQL Server, the CONVERT()
function converts an expression of one data type to another.
Here’s a quick overview of the function with examples.
Continue readingIn SQL Server, the CAST()
function converts an expression of one data type to another.
Here’s a quick overview of the function with examples.
Continue readingIn PostgreSQL, the MAX()
function computes the maximum of the non-null input values and returns the result.
This function can be used on any numeric, string, date/time, or enum type, as well as inet
, interval
, money
, oid
, pg_lsn
, tid
, and arrays of any of these types.
In PostgreSQL, the MIN()
function computes the minimum of the non-null input values and returns the result.
This function can be used on any numeric, string, date/time, or enum type, as well as inet
, interval
, money
, oid
, pg_lsn
, tid
, and arrays of any of these types.