Download as pdf
Download as pdf
You are on page 1of 27
Ye : _patductio “to. DBS. OL (Data Query Language) 1 pire, 2 Sub- Queries 3. Cotte latedl” tub ous » pet CData Centro! fanjuage) p grant L- revoKe 4 Tel CTianeostion Contyo| “Langoage) be Gemnit_ 2 Poll back, 3-Save Point 4- Flask, bace 4 me hth. 5 DDLC (Data, otis Language) - geet. ES airop 4: Rename (5 Princo. 6. DML (peta Mani pildtion language) | 4 ieee OD aa (2 Delete Bee SR Sf tr SIO EH i & erat ab 7 Punibns. i ae I Single row functions: Re ate VOD 2 -fanction | om eS ist = Banehte giletag oi Sk. ae ed SaTy Pes Aetamieaelis keh sdb dy Pst 4. Operators a Prrith metic ©4> Prine kag de ae ah, etl 46 cotkepa eB be axt, LAVSINISE r - spuctured Query Larguase veo 5 erm sy = * (8) sequenté Quey Language: ; Se peste: vb useful infdlmation white ia , Steg A einige location ae 2d dacto-lsaie al an cen" Database 1 ae ye defines] oS > useful inflection ‘Which be Sh by -follewing «Gerre set f- rules: jg wae as data base : pems - (Data Base Management. System) — , Et is defined o£ . collection. of: progiams .phich is written jin order to m ae eee al etfectivelY, f ta. sManagement Stand $3) K create the dota fetch the data. 2Mad 36 =55mm * Retrieving the data... : _— Updection of -the dota ‘ { * delete (A) drop ep ige nie Thpes: oF Bers mq Ladite if Fist file Dame. VE yt Hierearchia| DBM. 3-NetwSlk pgms. + RDBMS (Relational) a iS defined aga Galleon of data which is pritten in order by Following Same. rélationa) yules is Known as PpBms BH using RPBMs Ne can Jen Bale. ad "fetch te gota “free multiple tables ay in 2OBMS the qota will be adblays @e in the $81 of ables oer = peta bese Vendors — Si e ——— a “ eB = DES ; ? SAP — Sybase FSA JOASS ae * Ovacle —— log, 1G, N24 a “Wk te tosh

Select x from sterby 7 : — ‘ sT Name TAB TYPE Clustered ; 4 bere “TABLE | EMP TABLE “ Bonus TABLE is SAL GRADE TABLE SQL> Select from Gtje 8 i Thame TAB TYP clustered = Sas Na st Stebbins SAC ae ad EMP TABLE ; gonus on SALGRAPE = TABLE. ee & All 1 He ones NSn2ig. Sinn i eae in the OAM AG) © gyre pese table name; * peseriibe : evs cr 9 Name : Emp ni + wR SQL ade Sc adept; Pre veaae c Name - sauvdh, Siab, ee BEPENe 0) ula aa pname ST sbtkabed 2s Loa “4 a ‘SAL pre tnt SRL) desc emp * % pie < pe ete En oll the sable infSmation that is in oa table use the bela syntat” © select SE Fpl. name; % 280 =I puch theists erga eae SAL > Seledt “ye -frem dept; bepeNO — . D-Name - oft iA =e Bunting Newyork: sdar + “to ee 3-K Ss eee we’ i ets Lo | Peseoreh Patt. ac Raed 20 / Sales chico itenoastinn. : Boston. 40 3 epaations le To get Particuley column infSvretion Pron) | the table Use below syntart ! Ari 2 Select column name -frero “table name; (8) write 2 query to display all the emplojee nam Fron emplojce table pe ee Sete sia free Fon ne (@> write = “quarto display ol) the emplojec names along With their salary details. je F Selec; Enamé, = -freca epi | Ss |) Sou if ret a cece sersitive, rea i (2. enewing table name. aie elrOn nears is, i mandatby- 2 SQL atwrys ends with seeaiDion C84 80 | Table name end column names — a Jin He s@L should be ere as te ise _ Present in the d ee isin prite — Mery to dicplay oJ) the eraployee 0) 6 along With their ooo maPeES gto Select YC than “table; Salary increased by 4 prite a query to display all -the emplojée cy mes aleng with their ne annual salary. /é6 OL > Select erkmé capelr Bain amp] ) prite a Wer +o display al) -the enphiee nares ateng ” ioith “their “dedly. ‘colony ea Select Ename, gy) / 2p" ee si i? (ay - Sel mee ih Sat Pre rysklans Tica a (9) write ot ~ alee ee the ore names clang |, sane heir Salary erat Bospeve TOT ibs CD tae ae ae med (or7 | ep arg, - coloumn * — number te wm . be. elivided. with ado . on ia Aliasirg— 2 yey - “a Giving ‘anather rome’ to the existing -Colosee name. C8) table name wil). be called ac clerk Smithclerk $ wil seket enamel} tab -fram emp; pate Ne ee : : Smithclert ALLENS ALES Man. (OQ): write va giiery 2 ‘bela fBieat' ' ba My name ig Smith? ore aa earning 800, seteot Braet et 2a ios “Hy name ic(|Jenmel) and Lam earring lal te (G) write a query +. “ee belo f@muck Smith belongs Noe DePartrert 1702. card joined on |1-pec— ae ‘Scanned with CamScanner ee | telect Enare]||" belongs -to departrront nal pea) ‘ard _eined on’ || Hiredacte from emp; oe \ . r * . ° Dual — is an dummy! table Hote iS used “to ‘Ae sik sheet analysis Pe qi) Selecta eae ENS «Tiel aa Nile a tf econ elect '04- 1998! | from duals” a oe ‘ea ata lag na, soba. 24-11-1946 oh Bick spt ph retort Crier by Shei siameaar ase ae = (@) write a query to display a!! the yy details -in ascending erder a ALS Select sal From emp] | Order by Sal ascj 4 (Q)i write a query, tp display al] the em uy ‘ names in the descending order “i SL) Select name -fremempl.-)- . 3 order by ename desc; ‘ i (9) write a query -to display (Snare tre employees in ascending erder q el Hive date ‘ “EDE eye tabositeg . oa be—Fébes) Byikens5p 43° Siaici al > Bf ease Laine 7 7s we te a Prien hig) wate * query to display a4) the commision | yoro's “From the employed table arage | en jin descending sdlep. ° : CLD Seleat cameron ara Order by, Cero, «ASC; — el por eee 4 3 af »\qoo soo! - 2300 Oo { (g) write query +o display ol the onpleta aes oud © aviege 5th caluran in ‘dese etder 4. = Select sk -frem emp odes by Hire dete esc) (G) Write a query ito di: jetails aweng ¢ole oer: oS een CAL Select “fron emp ae oder by alert no ast, Sal desc, Clace in a single Query ard the Slecutig Ceterd column will ‘be based on the tiregl colum yeu given -in Sider by clause. 3 Spee erick is ee ill - ; o ect stotement chooses which column nedde’to ale splayed in the!’ ee te “Cheatec bat 3 fetch the daca | ee AS Per the cAndition Provide it will 2) mae cutte fbV each ord “eyery row ard decile pick yow “bo pick and Which rew to reject — : “lett x from webservices where Picard ® write 2 Wert +o display all the emrloge infimestion of ALLEN: DEE vepaahy =e gelect FOR emp olp— ‘i 4 ErpNo Ename Jos Mae HIPEDATE Sal Comm Dep 1444 ALLEN SALESMAN 1698 20-FeB-%1 160m 300 20 output !— 5 . a UEMPNb, Names : 70m, MGR; HIPEMNTE «SAE. Contag 479. CLERK Mawhare 16390 (4) nite a. duery to display all the “ein infSmatio whole maneder number is 7g 29% Select 3 -from*ernP | where MGR = 18317 4566 Jores Mancgey 1037 2 -API-BI 2415 — ‘ < 2 prpd Hues lae s7Ag3TH- BS, SAE andl AS Sdt- Os a =e Hatem oe aldéheni dese whoa @y "pea Spams pheoes elie a Bad caee @) writs a query * to dicpla AY afl the employee” Wade who joined ON 03» pec~—g}. * 2 Select > from emp where Hitedate fa = \o3~—pec-¢ (ae — ‘ ; enpno ENAME °“JoB * Mae | reebaTe SAL” cons bepers 4900 James “elére 1698 93-pec-| 450 t 36 @) write. om. WEN KO display ad] the employee 63 Earning. theiy ce male 5 output me taokt EMPND BIpN | ENAME JOB MGR Seecome ‘SAL oMM Dept Nn ares eee THe Gus Ss An id be 366 * jones Manger 1 cer gz REVI. 295 > ees (Q)- trite a query to. displays all. -the. _exaployee details Who iss Eaning” Ba00 and Less» than that to display all “ (Q) write a query Jes nna details who is carnird Slece ae from em | ore | Salavy S000, | Where sal ¢ / Logic. l AND Cal operators’ ( st } NoT eS whenever we aye, using -ANP ©peratésl yous will get elected H+ the bor Tied Satisfied oR Whenever née ae being “OR! operatH aoa pi get selected. Ff one Condition jg’ ‘aa Nop- ct iS on epposite oped — a (@) prite a query te idigplay sll the employ whe ae the mea rag eb cok Jett S Bone Sco. eT ee re. S jte a Juery (9) wy to display all -the. Lemplay details belongs to deptno io and 96 and one hows be in ascending evder Ix Select & From emp where Depend=1d BV eae 20° oGler see @ prite o query “ display Fi Eh 2, oper yeas: Who Jained in. the yaar 8). Select -frem emp 6 AND. HIREDATE where +HIREDATE >=: foi i 22 a -pecsl4 | @ write 4 Yer to display ‘ath the “erAploy Yeti’ > HE joined erogapher jn the Year 2%! and Mange in asdendirg. _ Zelect * from emp Where Hiredecte > = ‘1o-TAV-8]’ AWD HIREPATE \al= pec-8l! eiderby Hiredate; (Q) write a dWery display aul the emply details of Smith, Allen and ~humer. se select a digplay all the employee Q) write whose name ands porth ~ ee. yeas celect * rem emp where Enare like | Wie ca EMP - es ° 3o jee TURNER SALESMAN 1698 o6-Sep-él” +500 7934 MILLER CLEpR 1162 23 a8 (30d te a Wey te display Bi the empbtce (@) hv Stash qetalls whose eo ends ey ees ore — NO ENAME JoeB Mae HIREDATE SAL ee peprie soe = eee pp display all the (Qyurive a wert ., a erie who pained in the Year BY bys 13) live opere eelect * fren emp A where hive date ive (a) celece K fren erh where hiredate ites sl) "(@) jpvite a wer ‘40 ditplay all the 2 details who jeined in a menth of vel i \ a 4 Select +k. from emp : 3 where hiredate \iKe i peop 4 | ite & fuer wri Y to display si) the | amplojcc | a) whase gerails Slory consists. of 4 sigs: ard . cheuld end with zen ' celect st -Frem emp phere Sal like Ve OS pus null iS an empty Space 6) blank pace ye NULL means nothing. enue Will not occupy eu ae in’ thet (@ ea % NULL EO yte achieve NULL We have tp user 2 Special operat” Colledi 1S Operetbn. @. writ, Raat og : sae! the sorely, ing. Wang comission Not operator /— “KNOT 1S an opposite operats. Special ope ra tals Logica! OPE vatore| InP AND call ; seca = 7 Bee yor + Se ——— ig (Q) write va query to. display oy) the 2 details apart fren who belongs to 20 430. eS Select sk Fram: emp: where @@ Jeptro wet (Le, 20); 2) Write ee ~ Mer + se dicplay all the details who ic getting catary eee 2000 & mile than Zovo- - . L Seas mist x Foe Select from, ennp [g) write o Wert te displsy oul the employ details whe iS eaming camicsion. Select * frem emp where CornmisnoT NULL)

You might also like