t gnipulating relational
(Ab ke co
[Mon=
Tag. red by al) major RoBnms
ia Prostave SQL, Oracle, SQL Sesver) S
1 S
[pesmi dara _de¥inition, manipulation, «
Bier features . y
S
|
[os SQL Components : a
| ipok CData_ Definition Language )-
-~ | defines Schema C Create, Alter, Dio p)
apm Cd Mani j Li y=
[manipulates data Insert. Update , delede>
|BQt Cpata Guew Language) ~
{ queries dota _Cselect >
aloce ¢ Sara Cont Language )_-
commls _accesS_(C Grant, Revohe>_
-|TeLeC Transaction. -Comtyol| Language) =
manages kcansactions C_Commit , Roll back
Save point )
DOL Commands _¢ Data _ Definition Language
Ceeate =. Creates 9. new table, view) oy
_dodabase sharcture
Lenton: Create table Student ¢
\ udent -\D INT pvimay Key
\ Name Varchay (52 not nal)
; |__9epk “varenar C10), 908 DATE) 5
@ scanned with OKEN ScannerAlter _- Used +o modify an existing
fx, Alter table student Add email varg Tf Cty
Alter table student ie a hag Coase
Alte table student dp column + DoB
S:l| DROP = Deleres a database Object petmanenthy
Diop table __ student ;
Once _dwpped, all data t stucture gee lost .
32 || DML Commands C pasa Plani pulation
Ll Insert _- Adds new) seconds jnto a table .
Lnsert Into Student values (Jol, ? Anjali’
‘ecA', '12-12-2025') 5
Insert Into Student CStudent 1D, Name?
values ( 102, ' Nikita’ D3
2. yy ul if ii Ast el
ve 3 = ‘NT!
Student. WD = \ol 3
$.l| Deleve - Removes secords From _a_ table.
Meleke From student where student. ID = lo2 ;
without q_odnere clause all wows ase deleted -
$-4|| Basic _stucture of SOL Seleck Query +
Syntax z
aect column list fmm table-name where
condition Group By _¢ vin - (rio.
order By column case | pesci:
Ee.
Select Nome, Dept. from Student where’ ——
Dept = ‘cs’ order By ASC;
@ scanned with OKEN Scanner/Tosncle spParts—< a Ap of functions these
L 3 ‘aly i
| fun Aigferen of
(a Sosa Function +
\
(syntax: ae Cdata) a
(Ley. SGL> Select Ags (200) from Dual:
| olp 4 206
[Cet Function : [4 return. the smallest Integer
|_aveaxer equal a
| ayprow CETL Cdeura>
eg, SGL> Select 74-58) eel Wein
(te olp >» 15
FLOoR Function + 1k returns tne largest integer
less tan or equal 40 dada .
Syntoa_: Flog C data :
Go, SQL > Select FLOOR (14S) from Duo!
oP > 714
ee
4.
pop funcon : It vetuens thi modulus as_semal-
\ Syntax: prod C dota yD
leo. S8LY elect Mad CII, 2) from Dual §
rt
@ scanned with OKEN Scanneros
fet]
| Ane power of yas given ela
e
[oynkam 2 Power Cdafa ȴ)
Bg SQL > Select Power C9, 25 rar Oud 5 ~
oip = 4
Round function , 1k rounds wp the data 4o
Specified number of aecima! places
Syntax : ROUND C data, nd
Eg. SQL> Select Round ¢123'5 0) frm dual.
O|P >» j24
aa ect Roun. 123-58, 1) I,
OlP > 123-6
| ‘
Sart Function + Ik aeturnS the Square wot of city
Syntax : Sart Cdaka>
Lig, SQL Y Select SORTCBID From dual ;
olp > 4
$.|Teunc function - 1k tyunettes the data tp _the
Specified be. ‘cimal places
Trane. Cdata nD
Eg. SEL > Select tyne C23. 55 , 1D fam dud
G6 {Pp > 1235
b)| Aggseqate Functions
CT
They am also“ Known functions
Tnese functions ve _as _follons =
YG Function Average valu:
Bg, Select. : fivg .¢ basic) from Salary
Bn
4
@ scanned with OKEN Scanneri Aunction «1k sums tne values,
Seer sun Chasic) «fom salary;
4. [Noviance function : To find the variance of she.
| argument specifi ied»
leo, Select variance Clasic) from salaw
i Linixcop Catia) : Fivsi_ ledter Xo. uppercase
lea, Sele mikcap CANTALI') fiom dual ;
©1P. Pnjats
-Nengtinc datas + Leratin of the sifting
Teg Salect_length @pnjali) fom dual,
cae cical duo 5
Se Tipe Onwty 9787 From duel >
o\p : j-U
@ scanned with OKEN Scanner: aa
© acllinety C dara, 22: find the location of Shing x
Eg Select Instec 'GGSsiPu Delhi’ ypu" Fr dug
6IP =» 4
Sl \nete C data, X, 3°) N) + Find the Location of the
Ln _ovccirance shring inte Shing dake
koxting fron tne position © -
Bug, Select Instr "GS 1PU, Delhi"; *2' 4 oD fey
l OIP > 12 "4 occurance of 19 dasa,
G.I) Sk Capy 2. z cr
IL t 5
o[p » 955
—— eg Select greatest CTo date. C'26 = Tan 49’ >
H To -date C26 - Bug'-02'>) form dual +
GIP 4» 96: Aug = b
tT | Least Cexpet expr 2 CepeS, 1) tleast valiee
Pq, Select lease (85 95+S) 74-4) Pym dual ,
6IP 74-4
ad l Comversion _ Functton_+
1 Ii To. Chay function: To Covert a mae oo aust
to acharacter: eiing et
Sg.,—Select _To-chat C Sysdate | "MonTH’) Agpn dual,
OIP 4 Plarch
Select To chat C Syadare , "dd J mms yyy") fom duals
oIP » 04 /o3] 2004
2] Nvi function + To substitute Qny NULL value
colt 4 uses Specified value
"|
@ scanned with OKEN ScannerFunction +
| |
| Dake
—?T pad amantns Cdote _ count):
pu
eg, Select add. mnths C'4 mar. 2000", 2 fiom
Fatt) Play - 2004 - :
eipa 4-
| Last. day. C dare) :
[eo Select last day C!4 = Plar= 2009 ')_-fom i
Tapia a) mor = 2004
Months. benween Cdare 2 date 1) + ;
berween ¢15-Tan-24
Ra, select months = “
‘ Vgo- Mar -49 ui) fom dual
oP > 2+ 16124
@ scanned with OKEN Scanner@ scanned with OKEN Scanneries .
sesh) n/ Ow
aence . access)
i Ssabili
@ scanned with OKEN Scannere Studies?
Simple Retrieval +
Select Name, tf otud ere.