List Of SQL Built-In Functions
SQL (Structured Query Language) has many built-in functions for performing calculations on different types of data.
We have categorized sql functions depends on their actions, which is:
- Aggregate | Group By Functions
- Char | String Functions
- Numeric | Math Functions
- Date & Time Functions
SQL Aggregate Functions | Group By Functions
Function Name | Description |
---|---|
SUM() | The SUM() is a function, and return total sum of a table column from query result. |
AVG() | The AVG() is a function, and return average value of a table column from query result. |
COUNT() | The COUNT() is a function, and return total number of records or rows from query result. |
MAX() | The MAX() is a function, and return the largest or highest value of a numeric table column from query result. |
MIN() | The MIN() is a function, and return the lowest or minimum value of a numeric table column from query result. |
Related Links
SQL Numeric Functions | Math Functions
Function Name | Description |
---|---|
ABS() | The ABS() is a function, and return absolute value of a given number from query result. |
FLOOR() | The FLOOR() is a function, and return previous whole integer (no fractional digits) value that is equal to or less than a given input floating number from query result. |
CEILING() | The CEILING() is a function, and return next whole integer(no fractional digits) value that is equal to or greater than a given input floating number from query result. |
ROUND() | The ROUND() function is used to round a numeric field (floating point value) to the whole number (integer value without fractional) of decimals specified. |
RAND() | The RAND() function is used to generate a floating-point number or whole integer number by randomly. |
SQRT() | The SQRT() is a function, and returns Double specifying the square root of a non-negative number. |
POWER() | The POWER() is a function, and returns the value of X raised to the power of Y. |
SQL Character Functions | String Functions
Function Name | Description |
---|---|
LENGTH() | The LEN() function returns the length of the value of a given input string or in a table field. |
ASCII() | The ASCII() is a function, and return a number (ascii value) that represent of a given character from query result. |
CHAR() | The CHAR() | CHR() is a function, and return a character (ascii value) that represent of a given input number from query result. |
LCASE() | LOWER() | The LCASE() | LOWER() is a function, and converts the value of a column to lowercase. |
UCASE() | UPPER() | The UCASE() | UPPER() is a function, and converts the value of a column to uppercase. |
REPLACE() | The REPLACE() function is used to replace one or more characters (sequence of characters or string) from a string or expression. |
TRIM() | The TRIM() function is used to removes all whitespaces (by default) or any specified character(by user defined) from a string. |
CONCAT() | The CONCAT() function is used to concatenate or joins strings from one or more string or expression. |
REVERSE() | The REVERSE() is a function, and returns a string in which the character order of a specified string is reversed. |
CHARINDEX() | POSITION() | The CHARINDEX() | LOCATE() | INSTR() is a function and returns the index position of the first occurrence of substring of a given input string or text. |
LEFT() | The LEFT() is a function, and extracts substring or number of characters from a given input string or text. |
RIGHT() | The RIGHT() is a function, and extracts substring or number of characters from a given input string or text. |
MID() | SUBSTRING() | The MID() | SUBSTRING() function is used to extract substring or number of characters from a given input string or data column. |
Related Links
SQL Date Time Functions
Function Name | Description |
---|---|
NOW() | The NOW() is a function, and returns a date and time specifying the current date and time according your computer's system date and time. |
DAY() | The DAY() is a function, and return or extract the day value portion or day of the month (a whole integer number from 1 to 31) of a given input date value. |
MONTH() | The MONTH() is a function, and return or extract the month value (a whole integer number from 1 to 12) of a given input date value. |
YEAR() | The YEAR() is a function, and returns or extract year portion(a four digit number) of a given input date value. |
HOUR() | The HOUR() is a function, and return or extract the hour portion of a given input time value. |
MINUTE() | The MINUTE() is a function, and return or extract the minute portion of a given input time value. |
SECOND() | The SECOND() is a function, and return or extract the second portion of a given input time value. |
DAYNAME() | The DAYNAME() is a function, and returns the name of the weekday of a given input date value. |
MONTHNAME() | The MONTHNAME() is a function, and returns a string indicating the full name of the specified month of a given input date value. |
DAYOFYEAR() | The DAYOFYEAR() is a function, and returns a integer indicating day of the year of a given input date value. |
DATEPART() | EXTRACT() | The DATEPART() | EXTRACT() is a function, and returns a integer number containing the specified part of a given input date time value. |
DATEADD() | The DATEADD() | DATE_ADD() is a function, and use to add or subtract a number of time units to a date. |
DATEDIFF() | The DATEDIFF() is a function, and use to find the difference between two dates. |