In Built Functions - SQL
In Built Functions - SQL
FUNCTIONS
1. INBUILT/ PREBUILT/BUILT IN
2. USER DEFINED
INBUILT FUNCTIONS:
Available in the system.
Just pass the parameter.
No need to write the code exclusively by
the programmer.
USER DEFINED FUNCTIONS:
Code has to be written exclusively for the
specific task
It has to define in the program seperately.
TYPES OF IN BUILT FUNCTIONS IN SQL:
1. Numeric functions
2. Character functions / String functions
3. Date and Time functions
NUMERIC FUNCTIONS
ABS ( m )Absolute value of m
MOD ( m, n )Remainder of m divided by n
POWER ( m, n )
ROUND ( m [, n ] )
TRUNC ( m [, n ] )
SIN (n)
COS (n)
TAN (n)
CEIL (n)
FLOOR(n)
EXP(n)
LOG(n)
STRING FUNCTIONS
LOWER(string name)
UPPER(string name)
INITCAP(string name)
CONCAT(string name)
LENGTH(string name)
SUBSTR(string, startindex, length)
INSTR(expression, string, [,m], [n]) from
dual;
LPAD (expression, n, string);
RPAD(expression, n, string);
TRIM(both, trim_char FROM source);
REPLACE(TEXT, search_string,
replacement_string)
LTRIM(string, no.of.chrs)
RTRIM(string, no.of.chrs)
DATE FUNCTIONS
ADD MONTHS(d,n);
LAST_DAY(d);
MONTHS_BETWEEN(d,e);
NEXT_DAY(d, day);
SYSDATE();
GREATEST(d1,d2,d3,.....dn);
LEAST(d1,d2,d3,....dn);