SQL Aggregate Functions
This functions return a single value, calculated from values in a column.
Like Ex.-
AVG() - Returns the average value.
Syntax - SELECT AVG(column_name) FROM table_name
COUNT() - Returns the number of rows.
Syntax - SELECT COUNT(column_name) FROM table_name
FIRST() - Returns the first value.
Syntax - SELECT FIRST(column_name) FROM table_name
LAST() - Returns the last value.
Syntax - SELECT LAST(column_name) FROM table_name
MAX() - Returns the largest value.
Syntax - SELECT MAX(column_name) FROM table_name
MIN() - Returns the smallest value.
Syntax - SELECT MIN(column_name) FROM table_name
SUM() - Returns the sum.
Syntax - SELECT SUM(column_name) FROM table_name
SQL Scalar functions
This Functions return a single value, based on the input value.
Ex.
UCASE() - Converts a field to upper case
Syntax - SELECT UCASE(column_name) FROM table_name;
LCASE() - Converts a field to lower case
Syntax - SELECT UCASE(column_name) FROM table_name;
MID() - Extract characters from a text field.
Syntax - SELECT MID(column_name,start,length) AS some_name FROM table_name;
LEN() - Returns the length of a text field
Syntax - SELECT LEN(column_name) FROM table_name;
ROUND() - Rounds a numeric field to the number of decimals specified
Syntax - SELECT ROUND(column_name,decimals) FROM table_name;
NOW() - Returns the current system date and time
Syntax - SELECT NOW() FROM table_name;
FORMAT() - Formats how a field is to be displayed
Syntax - SELECT FORMAT(column_name,format) FROM table_name;
This functions return a single value, calculated from values in a column.
Like Ex.-
AVG() - Returns the average value.
Syntax - SELECT AVG(column_name) FROM table_name
COUNT() - Returns the number of rows.
Syntax - SELECT COUNT(column_name) FROM table_name
FIRST() - Returns the first value.
Syntax - SELECT FIRST(column_name) FROM table_name
LAST() - Returns the last value.
Syntax - SELECT LAST(column_name) FROM table_name
MAX() - Returns the largest value.
Syntax - SELECT MAX(column_name) FROM table_name
MIN() - Returns the smallest value.
Syntax - SELECT MIN(column_name) FROM table_name
SUM() - Returns the sum.
Syntax - SELECT SUM(column_name) FROM table_name
SQL Scalar functions
This Functions return a single value, based on the input value.
Ex.
UCASE() - Converts a field to upper case
Syntax - SELECT UCASE(column_name) FROM table_name;
LCASE() - Converts a field to lower case
Syntax - SELECT UCASE(column_name) FROM table_name;
MID() - Extract characters from a text field.
Syntax - SELECT MID(column_name,start,length) AS some_name FROM table_name;
LEN() - Returns the length of a text field
Syntax - SELECT LEN(column_name) FROM table_name;
ROUND() - Rounds a numeric field to the number of decimals specified
Syntax - SELECT ROUND(column_name,decimals) FROM table_name;
NOW() - Returns the current system date and time
Syntax - SELECT NOW() FROM table_name;
FORMAT() - Formats how a field is to be displayed
Syntax - SELECT FORMAT(column_name,format) FROM table_name;
0 comments :
Post a Comment