Functions in SQL
Functions in SQL
Functions
Functions serve the purpose of manipulating data items and
returning a result.
Functions
Aggregate Scalar
Functions Functions
Numeric Functions
String Functions
Date Functions
Conversion Functions
Aggregate Function
Functions that works on a set of values are called Aggregate
function or group function.
AVG() : Returns an average value of ‘n’, ignoring null values in
a column.
Syntax: AVG ( [ <DISTINCT> | <ALL> ] <n> )
Example: select avg(cur_bal) "Avg balance" from acc_master;
select TRIM('$' FROM '$$$Hi how are you$$$') "TRIM" from dual;
Continue…
LPAD() : Returns char1, left-padded to length n with the
sequence of characters specified in char2. If not specified char2
then by default oracle take blanks.
Syntax: LPAD(char1,n [,char2])
Example: select LPAD('Hi',4,'$') "LPAD" from dual;
Output: