GROUP FUNCTIONS

GROUP FUNCTIONS Group functions will be applied on all the rows but produces single output Sum Avg Max Min Count   SUM This will give the sum of the values of the specified column. Syntax sum (column) EX SQL> select sum(sal) from emp; SUM(SAL) ———- 38600   AVG This will give the average of the […]

CONVERSION FUNCTIONS

CONVERSION FUNCTIONS Bin_to_num Chartorowid Rowidtochar To_number To_char To_date   BIN_TO_NUM This will convert the binary value to its numerical equivalent Syntax bin_to_num( binary_bits) EX SQL> select bin_to_num(1,1,0) from dual; BIN_TO_NUM(1,1,0) ———————— 6 1     If all the bits are zero then it produces zero. 2     If all the bits are null then it produces an error. […]

STRING FUNCTIONS

STRING FUNCTIONS Initcap Upper Lower Length Rpad Lpad Ltrim Rtrim Trim Translate Replace Soundex Concat (‘II Concatenation Operation’ Ascii Chr Substr Instr Decode Greatest Least Coalesce   INITCAP (This will capitalize the initial letter of the string) Syntax initcap (string) Ex SQL> select initcap(‘computer’) from dual;   INITCAP ———– Computer   UPPER (This will convert […]

NUMERIC FUNCTIONS

NUMERIC FUNCTIONS Abs Sign Sqrt Mod Nvl Power Exp Ln Log Ceil Floor Round Trunk Bitand Greatest Least Coalesce       ABS (Absolute value is the measure of the magnitude of value. Absolute value is always a positive number) Syntax abs (value) Ex: SQL> select abs(5), abs(-5), abs(0), abs(null) from dual;   ABS(5)    ABS(-5)     […]

Date Function

DATE FUNCTIONS Sysdata Current_data Current_timestamp Systimestamp Localtimestamp Dbtimezone Sessiontimezone To_char To_date Add_month Month_between Next_day Last_day Extract Greatest Least Round Trunc New_time Coalesc   Oracle default date format is DD-MON-YY. We can change the default format to our desired format by using the following command.   SQL> alter session set nls_date_format = ‘DD-MONTH-YYYY’; But this will […]