Similar to any programming language, SQL contains many built in SQL functions that we can use to perform arithmetic calculation or just simply to find out the largest value of a result set.
Some of the most commonly used functions are:
| Function Name |
Description |
| AVG() |
Getting the average value of a data field. |
| CONCAT() |
Join two strings together as one string. |
| COUNT() |
Getting the total number of rows in the result set. |
| FIRST() |
Getting the first value in the result set. |
| FORMAT() |
Enable you to customise how the data will returns in the result set |
| LAST() |
Getting the last value in the result set. |
| LCASE() |
Convert the field into a lower case text. |
| LEN() |
Getting the total length of a text field. |
| MAX() |
Getting the maximum value of a data field. |
| MID() |
Enable you to retrieve some part of the text in the data field. |
| MIN() |
Getting the minimum value of a data field. |
| NOW() |
Getting the current system date and time. |
| SUM() |
Get the sum value of a text field. |
| UCASE() |
Convert the field in an upper case text. |
The above mentioned list of functions are just general functions, different RDBMS vendor may have different name for this functions. For example in Oracle LCASE is know as LOWER in Microsoft SQL Server but they still serve same purpose. Check with the RDBMS vendor reference manual for the exact syntax.
You will learn more about some of these functions in the next few tutorials.
|