BUILT
BUILT
BUILT
2. Character Function:
4. Date Function:
5. Convertion Function:
CHARACTER FUNCTION:
UPPER(NAME)
---------------
MANO
EZHIL PRADHA
MAHALAKSHMI
KALAIVANI
ELANANGAI
LOWER(NAME)
---------------
mano
ezhil pradha
mahalakshmi
kalaivani
elanangai
INITCAP(NAME)
---------------
Mano
Ezhil pradha
Mahalakshmi
Kalaivani
Elanangai
SQL> select substr('manobharathi',1,4) from dual;
SUBS
----
mano
LTRI
----
come
RTR
---
wel
LPAD('WELCOME
-------------
$$$$$$welcome
RPAD('WELCOME
-------------
welcome$$$$$$
NAME
---------------
Mano
Mahalakshmi
REPLACE('JACK
-------------
back bill boy
TRANSLATE('
-----------
bck bll boy
DATE FUNCTION:
SQL> select add_months('25-dec-07',4) from dual;
ADD_MONTH
---------
25-APR-08
LAST_DAY(
---------
31-DEC-07
MONTHS_BETWEEN('15-DEC-07','13-AUG-07')
---------------------------------------
4.06451613
NEXT_DAY(
---------
06-JUL-07
GREATEST(
---------
22-may-07
AGGREGATE FUNCTION:
AVG(MARKS)
----------
75.2
MIN(MARKS)
----------
50
SQL> select max(marks) from stud;
MAX(MARKS)
----------
90
NUMERIC FUNCTIONS:
LN(35)
----------
3.55534806
LOG(10,1000)
------------
3
SQRT(25)
----------
5
Operators
Set Operators
1. Union
Description:
Multiple queries can be put together and their output combined using union clause with
duplication, the
union clause merges the output of 2 or more queries into single set of rows and columns.
SQL> select c_name from borrower union select c_name from depositor;
C_NAME
----------
Mano
Mahalakshmi
Ezhilpradha
Kalaivani
Elanangai
2. Union All
Description:
Multiple queries can be put together and their output combined using union all clause with
duplicate.
SQL> select c_name from borrower union all select c_name from depositor;
C_NAME
----------
Mano
Mahalakshmi
Ezhilpradha
Kalaivani
Elanangai
Mano
Mahalakshmi
15 rows selected.
3. Intersection
Description:
Multiple queries can be put together and their output combine using union clause intersect
clause output
Only rows produced by both the queries intersected.
SQL> select c_name from borrower intersect select c_name from depositor;
C_NAME
----------
Mano
Mahalakshmi
4. Minus
Description:
Multiple queries can be put together and their output can be combines using minus clauses.
The minus
Clause output the rows produced by both the first query, after filtering the rows retrieved by second
query.
SQL> select c_name from borrower minus select c_name from depositor;
C_NAME
----------
Mano
LOGICAL OPERATORS:
SQL> select * from student where name like('m%') and regno>10;
SQL> select * from student where not exists(select regno from student where dept='cse');
no rows selected
SPECIAL OPERATORS
SQL> select * from student where regno not between 20 and 35;
REGNO NAME
---------- ----------
27 mano
15 ezhil
21 kalavani
16 ilanangai
ARITHMETIC OPERATORS:
5 rows updated.
5 rows updated.
5 rows updated.
5 rows updated.
RELATIONAL OPERATORS
no rows selected
no rows selected
no rows selected