Day-22 SQL FUNCTIONS SESSION 2
Day-22 SQL FUNCTIONS SESSION 2
"Oracle Database"
Topic : SQL Functions-Session2
Date : 22/12/2022
(Session - 22)
___________________________________________________________________________________
__________________________________________
Important Information
*********************
>> Oracle Class Notes ::: https://github.com/ashokitschool/ORACLE_CLASS_NOTES
>> Class Related Updates "Join In WhatsApp Group" check with Admin Team.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++
SQL Functions
+++++++++++++
******************
a) String Functions
******************
1) length(): This function is used to find the length of given characters which
include white spaces
2) initcap() : This function is used to convert the first letter of every word
into capital letter
3) chr(): This function return the high level language code from ASCII Value
O/P :z
4) ascii(): This function return the ascii value form high level language code
5) upper() : This function is used to convert into upper case from given case
of letters
6) lower(): This function is used to convert into lower case from given case
of letters(uppers)
Ex: select lower('MAHESH') form dual;
8) trim(): This function removes the white spaces from both left and right hand
side of the given string
9) ltrim(): This function only removes the white spaces form left hand side of
given string
10) rtrim(): This function only removes the white spaces from right hand side of
given string
11) lpad() : This function add the specificed charaters from the left hand side
of the given string
12) rpad() : This function add the specificed charaters from the right hand side
of the given string
13) translate(): This function replaces the given string with another string
with only one character
14) replace() : This function is replaces the given string with another string
and it replaces more than one character
Ex: SELECT REPLACE('This is a test', 'is', 'IS' ) FROM dual; O/P : ThIS IS
atest
15) instr(): This function searches for a substring in a string and returns the
position of the substring in a string.
2) round(): This function rounds the given number into nearest integer
3) floor(): This functions rounds the given number into least integer
4) ceil() : This function round the given number into maxmimium integer
5) greatest(): This function return the maximumn value from the list of numbers
6) least(): This function return the minimium value from list of numbers
7) mod(): This function returns remainder values from the given numbers
8) sqrt() : This function returns the square root of the given number
10) log(): This function returns alogrithmic value fo the given number
11) sign(): This function returns the sign value of the given number
12) sin(): This functions return sin value of the given number.
13) cos(): This function retuns cos value of the given number.
14) tan(): This function returns tan value of the given number.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++
Date Functions
==============
1) add_months(): This function adds the given number of months to the given date.
3) last_day(): This function returns the last day of the given date
4) next_day(): This function returns the next day from the given date
5) extract(): This function extracts the date,month,year from the given date
RollForward Process
01/Jan/2023 - 31/Dec/2023 >>> Current Data
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++
Conversion Functions
====================
1) to_char(): This function converts the normal date into character format and the
format must be specified in single quotes
Syntax: to_char(date,'FORMAT')
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++