The SQLite min()
function returns the minimum non-NULL value from all values in a group.
The minimum value is the value that would appear first in a query that uses an ORDER BY
clause on the same column.
The SQLite min()
function returns the minimum non-NULL value from all values in a group.
The minimum value is the value that would appear first in a query that uses an ORDER BY
clause on the same column.
The SQLite max()
function returns the maximum value from all values in a group.
The maximum value is the value that would appear last in a query that uses an ORDER BY
clause on the same column.
The SQLite avg()
function returns the average value of all non-NULL values within a group.
It accepts one argument, which is the value or group of values.
Continue readingIf you need to add a “count” column to the result set of a database query when using SQLite, you can use the count()
function to provide the count, and the GROUP BY
clause to specify the column for which to group the results.
The SQLite count()
function can be used to return the number of rows in a result set.
It can also be used to return the number of times a given column is not NULL in the result set.
It can be used in two ways. If you pass in the asterisk (*
) wildcard character, it will return the total number of rows in the group. If you provide the name of a column, it will return the number of times that column is not NULL.
The table below contains the valid format string substitutions that you can use with the strftime()
function in SQLite.
The RAND()
function in SQL Server returns a pseudo-random float value from 0 through 1, exclusive.
This function can be deterministic or nondeterministic, depending on how it’s invoked.
Continue readingIn SQL Server, the @@SERVICENAME
configuration function returns the name of the registry key under which SQL Server is running.
No argument is required. You can simply use it in a SELECT
statement to return the registry key’s name.
Note that SQL Server runs as a service named MSSQLServer. The @@SERVICENAME
function returns MSSQLSERVER if the current instance is the default instance. It returns the instance name if the current instance is a named instance.
SQL Server ships with a collection of built-in functions that enable you to perform a variety of operations. Each built-in function serves a specific purpose, and can’t be modified. If a function serves your purpose, you can go ahead and use it.
But what if you can’t find a function that serves your purpose?
Then it’s time to write your own user-defined function.
This article presents two ways to return a list of table-valued functions in a SQL Server database.