0% found this document useful (0 votes)
225 views158 pages

SQL by Jai Shankar Sir

Uploaded by

samsulansari1650
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
225 views158 pages

SQL by Jai Shankar Sir

Uploaded by

samsulansari1650
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 158
ces a 3 Be SS 3 ac ~ | w& 20 Jos Bs b PILTTIILLLILINVALIT OP PP eee ee eee f , — | er | Sal Steswrumad Guiry Longueye * Dato is ramfect which aitar av proper olyon object + preprativs is oto Known a4 Atbsibut © obey OBL freon o& Entity Be PhiNo- 100. Fiddhan No- nee exe J x Le Tent 4 PAWE Phere psy [zosest WIN _/ ) Email abca@giaitio UOMfECHion = jor —Fit } ' Blea yp OM 420098 ! > 5 sof rc COs oa Dato) Raufare Dotobass:- i iy 0 plow ex medium in which ewe Sse ths tate An) gysiematic ‘and orgaritsd mann. SOL a Sata a ong e i euhenwed puswy Longa? é Tallman ’ + Orgorisso) . Dolabase. 8 Tn datobnke we on erming oF ti . oe Pederming ons opsation calucl CRUD : i ¢ Ri velo” : l_ 1 Quote / Reno] —ronte «ELE TE/ wd im Tnspe RETRIVE Monify — DRep swe ~ - -- 3S > eins VB amraeh any a ee ; = (Was 4 (os 5 Teas erajtenn NOMAginN yom) — Quecy ~ + Seomity Lee a Hewore hich sued do maintain ond manage thy Datei Aongucge 3 TX lation .f > ROY ond Aauthosusation ote the Tos min fnew povided hy z) L sein ead) S—PBINS solttoare 1 Rik _ Lt Cand, a, Ty the DEMS Fofluoee we Shore dh doin in WL fowmad , * "PHT eemmuticate with OAs Aoftlearee we ude quwoy Jang. ® Drawtoaurs of 08MS 5 6 tn, consuming ° Metrory Ausacye Longe , ROBMS ( Ralasionas Database Man System) o) mocindain * S RBGMS SofoeK oy yor eo DeMG soffodu.odhich Bs Ue Ord monage the DalaBaxe 1 . Sucurelty Ond Authorization ox the deco main fetes provided by ROBMS cotinaosey \ In RDBMS BoftWeU we Sh@ the Dato un Toble format. © We UAC surthwud Raw language (SL) 40 communicate Golth ROMS — gofeowe LEdgar Frank coda) Pams —s Relotionay 7 ROBINS vy noo} S GRR AA Tobh, Tobby SUUYEELULI LLL ne onna UUIVSG i ) fl wie VUCTCIIIS > Table & Dasa combination of Hews ond columns. Toh consist al three bypes — © column © Row ® ay @® column: 2 Veetiod position of the dobl 14 known 2 column > Column 23 alo Rnown as a HU.-bucbuy ‘ ® Row: Pe pont or pial SSS Fo Dela obsuk ah data wre called Jt ab muta dada © Mea olatos. ou CuO gunerorticl . Ye stato can be volo ty the say steps! - 2D By owigning odo. hyous 4 By odtigning — Constvants - NOb3- dela aype osu. Mandodory anol consivalnts ow opirena|. y Meta dat 5 Loy —_ Sdoudent rs Photo [Shun Tp |aunt Nome] Ceuucd Gundy] Phoncae. | Ta ae Qowiabh ts Mole | 3324s 12 2p Poa Tova | Remade [ery < | 4 Keostishmg | 88° Ramon | 7 i 3 “Tcouas WebTech | moe | -- = - ¥ 5 sAmere | Python Pmate | ~ —~ Hine? : 4 whith Ls Uted cto tye ty ae ° a Troan Trumurty tocation Tyers ol dedatypes in sQu +e CHAR %€ VARCHAR /VARCHARZ xX DATE * Numaer © LARUE oBsecT CHARACTER LARUE OBTECT BINARY LARNE OBJECT Fe CHARS. SHAR doletyp: sor ocafat capita} A407 Amo) LEZ 2 nubs fom 0-9, gpa) chatackoy 274 Rilpho. Nam S SES CHAR ENUM 2 FnyAhing eretestel within singly ee, or call sti chon datatype a orga CHAR(ST2B) ample cuaRcg) ef cHAR datetypr 5 ‘2000! ° hex datatyer follows find Example + CHARGS) * 2000 cs CHAR (2000) ver gianni KOT Mk eb HTT rm ie. 34s 6 SED Protks | 7 YNUSE p Tey Bhodes, Usep — ONWIED Bue Bixhy cos AP VARCUINR > VARUIAR datatype can accspt copttal ‘Ato 7", small taroz’ , Rumkeas pom bg - 9’ , Sapected chootacterts* aS worl Us ‘Alpha Naumencs! Aryaring enctesrol dn single gguetes we call 1% ynRcAnr datatype . Syntoni= une cnar¢stze) © Whenever we are ausiny vorddy Ah se S The maximum size af varchar decker is ‘2900! chanacdued dalatypr use aheuld mention © VAR EAR dedotypr follows —yosiiabls -lingth Mumory ableton Example $ ad VARCHAR (3) VARCHARG SS) Nae 3 yy ey MIatale[s bE emmy } rr re ad SaaS Ne flien a Bloks Blokes Qtek c VARCHAR 2 datatype 3 the uupdedion ch varciar datatyas Te maximum seh VARCHAR? delatype is "4000" chavactect Vrsnewer ux ae uaing varcHhy clatiatyoe it cuit] automeebia Conve into varcine 2 datatype + Exampst7 44 YAR CHAR 2 29 . VARCHAR (40) =) VARCHAR? (30) ‘ Ero o Dot. doiaypr 4s Udtol do sid thy dole in o porctiaulan formots hy Oracle Syntax:- pate “DD-MON-Yyyy’ (ow 'pD- Mon - yy" “\Y-FEB-2024 (or) “14-Nov-25? = NUMBER 3 oD Ub do Store the Numede Values Sgoian:— NuinBeR (PRESTON, ceALE) LELELLLE Let 1 ) PRECISTONS~ © His used Jo Jne tha ram ad = u buy of, cligus a> Ads to ae a Antgen valusy - = SCALE RT) bs wid to dutremine the numbnr of digits dase] 7 Fo sou ditined voli ugithin thy Was = © SCALE ix net imondétie’ , Paty = ° Try difowtt vols of geal is zu0- 2 exomplt- 7 ~~ NUOMBER(6 5) = + 4.369469 Blocks cm a) a an jane Puatid 7 NUMBER G3) = #3!" 5.2 4 g |e eh => Pos ae ett irr geo vale > NoMBFR(S.4) = 4-0 orga y yrs LSlhrs » Pes re cla a= NMMBER YG) = 4.5 POS Ty ot NUMBER (5,6) = 4.26 4° G |2 P=5 “ ~ Sy = NMBER (4) 2 4 BD YB ad Pp 7 — LARGE Of) 1) CHARACTER LARUE ORECTI= Tei suid to stow charcetoy MO pte @ 4m YnB of size. = = =) 2 9 — - UNEQUE fs 4 Constraints which comet acupt ; duplicated oY | supeadeo values - NM 3 Ta tk 0 constraint which Connet accept rely —— 7 : , ¢ Nutt ta De moans ermply « a CHEcK sa 4s a constraint which is extra volidedtion assigned) | SSS) do thu colunn uslth 20m) condition Lf Dh Condbitee Bs Sodidfico 3+ wlY elu dows . HK PRIMARY KEY t- Teds a conspialnt whith eruqteely Adontify —— ~ aN @ Suconcls. J A Chesuttousti, of pismasiy Reg ° conn} ocespy duphicobd oy supeated velues , ° cannot auup| a ru voles Parnas key iy olwoys CEnstraints, 2 Te dob con aceph a combibation of sunigne Ghd not only Ons column ab & Pim asy kay « & Prima Key bs net mendtatoy but uy highly see or ndsof LOU YE FORELUN KEY 2> This a constalns ushith iy sued Jo establish thy connection blw tur tablos => K Chosactstic, of Loss Rey 9 ad oT can accept aaeoted or ovpratd voluss S eTF con acwpt NULL Values « ~ ° Foreign Ly net a Combination of Luniqu ond ad Nor NIL constraints . a) o Tre toble can acopt moe than on column ata a fercigyn Roy. 2 . UF 9column @ha to become o fovign ley it ds S wandodegy do bap pmo key on Jt, oon table > e BB pusnt In oiiid aa faut St belong, do — 3 Porent rable. { © Bas ato Rnown ak sdfwuntial Incegiity conswrains ? * REFFeRe, — 5 NTIAL INTE betty ? einP Tab. E 5 _ res DEPT Table 3 Part NoTNve? \ ae {onsece j \ = gota [VARCHAR ‘Numa | Nuumoea | viecrer dw) SYYASH | PrRewy \ H Qvouin gh SOL Sotuments +> 7 + Voto dhflnotien Longuage (PDL) + pee 2 Doda Manihuledion Longuoge (DML)- Om 3- Tronsackion tonbio| Longuage CTCL). oo 4. Dato Condo} Language (DEL). Deu 5- Doto Quo Longuaye (DQ UL), ee 7 Said Quooy Language DOD) 3-54 Te i, ubid do subdie or Fath the dog poworn the Aotabass *#D hod {0U7 stobmenta: + eSELecT © atl wil © PROJCTION fet dv clate Jem thy sable A boted © SELECTION © JoIns Fe SELECT t> oT ty 0 pros of nan or tech Hu. dota ftom Ary dobbs and it Wil displ HE PROIECTION 33-3 a pHouas cof pubs ov hutch tha dota 4H0r any doble py selecting {SPY e Coluynns 2 Rogen, jt 5 PROTECTEON + ahd Hy SELECTION? -S 6 Th iy 2 pyouss Of stabdve or fitch the data from, Ane dfobl. by | Saletting beth columnsand i> Rneron os aleckion - FP TOINS$> This o pyowass of dubuve oY tetch thr data tHom dhs musttipl. tables Bmuborvausly ds known od, Terns. D Losats a guoowy bo display names of all the eoployfb bul = PROsECTION > dy wsd to subtive o¥ felch the dala ———— Bom the doable by ~falecting only thaLolury 4s Rnewn os LOJeCHLON + Syntax 32 Pe sevect */ [pIsrincy] col- NAME | EXPRESston) FRom Treve-wame ; j (Aun s| iy BUI fer ORPER oF ExEcutroyss fc > cpa ‘hg Latimer eT) eee feat > the, We ude, Ae S€LecT PU wu ekeld Nec OF Col Npme { ails! OF Exprurrlon 9 f U NOTE $3 © Epon dameny, coll ee euuky four © Th FRom Clause é on “Ud the dalle Nome oy LLUIELLIILLE » Put the doble unckin eeuntion: © Ths Job of prom Alotise iy Complated- = © Atty the exoution ° Ths job of gelet owssr ts 40 ge te the doable which iy ‘andor excaution and gsaxch for Bu Coltunn which we have mentien i Ou Frames losis o Yosory oto hsp Nomad of olf the employes SELECT ENAmE LAVSE FROM Emp 5 01P FROM CLA Reseur ¥ oe TELIIIS f. writ, questy Jo display salete of Em? a Aras Sevect sa Feom Eme 5 althe ; b. wxitro gueey do display Qeails ol EmP pase ee => To cis ploy aU the cetails we howe sto usr ee FROM EMP 5 AY ASTER TSK CH) ts Astodak iy wel do gotect atl th Cottimns piem the dole . FR SECIS ) 25 TF hans ond coh aha pe Ww g ee NAME, SALARIES @h =the Employgo « HELO queen to diplay, SELect ENAMS SAL FRom, EMP; ®. WARTO ENAME, SA uney | WIRE DATE, and commrsteny of a he Empioyus. : SELECT ENAME,SAL, HIRE DATE, Comm, 2 FROM EMP 5 OF we can unsd cy Feom emp } ash uth ole on 5 ASSIGNMENT QUESTIONS +. WAQTD all athe dutails Som dre EMPLOYEE +ohle- Ana> SsevecT & 7 FROM EMP5 ES. 2. WAQTD NAMES oh oll tre EMPLOVE Ares SELECT ENAMES FROM EMS ~ 3. ae NAME and SALARY given to OU the EMPLoyp if Es. ~ Rnb SELECT ENAMme, SAL on FROM Emp; ae 4 WAQTO NAME and commtsszon) given to aL) the Etsy x Ans=) SELECT ENAME, Comm a FRom Emp; SF WARD EMRE TD ond DEPARTMENT NOmago of of S ths employes in EMP rable = free) SELECT Se pePTNO 2 FROM ep s d 7 6 WAQTD ENAME ond HEREDATE oh aM tr employees . Ans) SELECT ew pme Fo) FROM Sion? HIREDATE ; 5. WA@TO NAME and DEsamNATION of oll ths employes 2 3 Ainss) SELECT fENAME, TOR = FROM EMP, => %- WAETD NAME Joe ond SATAY gucn GUthaemplaye) = Ay 3 SELECT ENAmE, JOB, SAL oat FRom EMP: =} 2. WAGTO DNAMES rudink Jn Depesetmend Aabl. Ans) SELECT BEPENAIM DAME FRom DEPT; ro. WAOTO NAME Ond Location Pusan dr DEPrtobl Ans 2) Serecr = =DNAME Vol FROM DEPT, i JJ wow Weuus Q WAETO atl the clitaits af emplqyess ‘, => SELEcT ” - = CT 3 FRom « Emp; i ( gy AY. “AITD cepartron no of Gf employes qsithoul vepdetion — GF Sececr DISTINcT. DEPTNO | From Emp ; | iste OISTINeT ctause ced © OsTinct CURUSE JS Lssd do Seamove he duplia.bd or Japtad | Noluss Pom the susult tobl, 7 i cea oe a Tage Claus os the fat oguenent : Example : nue aE oh employees, caithout i Q@ WRETD ENAME sSALARY, DEPIWO af, thy SELECT DIst Inez EnNme , Der FRom EMP; Sroplegpes PTNO, gar , S¥ @WARTD |ALARY of employes . ba Geect spat tT. FROM EMP : |AGTO Annual SALARY of employers . . : cl air EXPRESSLON 2° Fl Statemand which giver ths Sesull Ws known EXPRESSLON i Cd gxppiaasion s © Exprassion 4 a usmbination of Spuwad ond gprjator. S QPERAND 2 TRE cpu thy values thot We pass. bid CPERATER > This cv ths AymboLL which Regan ome RQ Operation oh the GpVIand. = Fxamph 35 SEeRAIdS = \00 ¥12=1200 SS Opanedoy 1 | “PG WAG Aonualf SALARY oof employets : Ans SELECT gatxi2 SS FRom Emp; . =F QUAI — Hal town SALARY © emplogies, = > SEleCT sHL x ¢ =p i Pmployes allen uaith ennuiod SAL => SEvect ENAME SALY JL From fh 7 =z COROT Dernrts af ary SMPKeYe> along Coith annual spc =) nate SRE FY, SAL, X ds Wel for efi Ss RRM TEMPS, Gull thy eluloits bul af — Bberomie SELecT EinPe , caLxya | es re y : EMP... pay S Rauld Fron EPS dapteyey au cous } a 5 TS Colin Hh Coburn | gh column iy OW the Dosaj by Spy ]2 enter GEIS ee hiles ee Q. wheto SAL of Fre eMmployeercdth the ad Oh lop tere 7 SELECT SAL+ SALKIO- : 100 FRom Emp: Q. WATD NAME and SALARY e| Ah ermpleyi clerg wih Salaxy with the hile ab 1S). SELECT ENAme, SAL, SA ae FRom Emp: 3 Q AYTD Datol ds of the employes along) woth onuod Solon with thy fkro} 12]. Oi oe BOYS ELECT EMP =, SALE SALH 12 KID one FROM. Emp) monty aL 3212 y not posible J UL SELECT EMP | SALKID+SALEIE any FROM, Emp; Q. WAQTO Annual olosy Of orploypn udith he WiRrof 2S%h SELECT SALE IZ+ SAUL 25 [99 From Emp, FY ALIAS &7 oTr iy the obtenat, name given to the column, © Ue con give ANAS name With oy watithout Luring Ase © By dines WoYs we coh pL th ALTOS Noms ANNUALSAL ) FINNUAL-SAL : ANNUAL gL" Q PAOD crush Jolaxy of employer Ualth 4h QUed nam @ Onna sat 2 SELECT SAL¥EIZ AS “ANNUAL say! FRom emp; bi ee °c ne ——— or ™~ a SELECT — sHLx 12 AS ANNUAL. SAL a3 From = Emp; s m& eet SALK IL DS ANNUALSAL a Feary EMP} FA) ASSEtNMENT QUESTIaN fo EXPRESSION. > QWRATO NAMES of aty RmeLoyes long vith thay Ronua, enue » SELECT ENAME, SAL¥I2 AS ANNUALSAL > FROM Enp: 3 SEROTD EMAMES ond Tos por all the employes with thin Sp Hatbtom sncagy, sot) = SELECT ENAME, sALy¢ AS HALE TeRmen L FRom . ae Emo, = QS PAGO atl the dotodls Of the employer olong with Gn i FANNOALBANUS OF 2000 : i SELECT EMP Spewin+2000 AS ANNELBeNUS SQ FROM eyape > O41: NED NAME, SALARY ond. SALARY with A ie of toh => GEtecT ENAME, = FRom Emp: GS WROD NAME AWD SALARY wlth DEDUCTION e& 267. SELECT ENAME, SALS FRom Emp > QE WACTO NAME and “SALARY udkth Mord HIKE a} 6O SELECT &NeME » SAL+59 AS HIKES FROM Emp; Q> _WAQTD NAME ond ANNEAL SALARY coith DEDUCTION of {0's SELECT ENAME , gALKI2 ~SALHIFED, FIS De Duero SAL, SALt SALX nos AS HIkElo” \O SALK > ~ AS DEpvcrron 254 FROM Be! Q& OPETD Totol SALARY giveh to each employer (SALEM Mm) ab SELECT Np FRoW) 4s : A as ao SAL | 23 WRETO cdeloils Of all the Employes long eaith anual ca APY | SELECT EMP, SALKI2 o FRom Mp; oe Mo WAWTO NAMES ond DRS Te WAT TON oeng arth 100 Parents = | an Solouy SELECT NAMES , ToB , snL-l00 & FRom Bmp, ia Se Q WNYD OU Ahe dataits of Senpl : SELECT y 3 € FRom Emp; | — &. wAQTO NAMES op atl ths empl ops | SELECT ENAmME FRom Emp) © WALT Departmunt-ns- of ob th omployses SFLEcT DFPTND Fron Fam = Emp7 Q “AOTD NAME and DEPTNO oh all thy employses SELECT ENAMP, OF PT ND From Emp, FQ WAGTO NAME and DEPMIO Of thy employees Lhe OLE doorRing gm the —DEPINO 10 SELECT ENAmE , DFPINO From, Ftapy WOMERE OEPIO = 103 : ; : HO, Suboveui HW SELECTION 29 oy iy Ante Belch the’ dato foiom ath dodle oy talading both sous as welfery Column. ty new OL Soleed ton SYNIAR 7, SELECT COl-NAMe [Pxpecgston FROM, TABLE WAMe WHERE creer < py ‘TER Cova troy) + CROER oF Hefcutions— 1 a haa ae th oe . NOTE ¢>ewhewe couse 2s ude to file ary vocancts S WHERE Claus caly ensuite Mfr tha exacestin of COHERE pewill execute sow by sou © In wHeReE Clause wecan sits the wondition- e We con ude multiol: conditions sn who Clore (ith ahs hulp of, Aogicat SPViQdoy . Examples > © woteTo Nome and O:ping ay DEPTN | ] UT itll Ormeau, Fina Secrecy ENAme, DePrwo FRom Emp WHERE DeEPTNo=10, UE a vo SWYNS ol al oNldag EMRE dae " — ho Xe UDarks Q WAY TD Name ond FoR of Aho Amployssd vo! 6 On Aaluaman. SELECT ENAME , JOR Fron) tmp WHERE pane Sener $7 epceemaw ‘SnLe ; vis Note g> , he in Single Quorts © BAL 4s neta caro Sonaldtve. Jon, Lag noe & Thy stds gry case Sonsitive « * ONTO display atl thy fables Pion thy dlatobase . Seuecr x | FRom ThB:, © LAID Nome OF the EMP who Ou wort, SF lect ENN Me FROM Emp WHERE DEPINO= 30; ¢ 4 cbpinn Zo RQ. WAQTD Axtobls oh dhs Em Who or Yelling Aolooy mou chan 2000 SELECT BNAmg 3 FROM Emp Wllere SALY2000', Q WARTS datails of +ry EmP Uho hud often 1930 SELECT FROM Emp W108 Sti a% Wilere” CATE > '30-pec- \930' POM TD dstatls of ty EMP udho hiad hiyww 1982. SP lee re FRom EMP WHERE cure DATE < ots ASSICINMENT Corey son An WERE Clune ONO TD aby Arve SALARY of Aho Fenny SELECT SAL x yo FRom Emp WHERE ENAmE = ‘start! AN 19R2’ Ployer whos Noms asm ty AS Avnwne DZWAQTD NAME af thy employers working ad CLERIC SELECT ENAME FROM EMP WHERE ToB =!CLERK'; @3WAQTD NAM SALARY of the employer who os casting oe SALESMPY . SELECT SAL FROM EMP WHERE & TB = SALESMAN: G4 WROTE Duals of AL EMP wgho ears meuthan 2000 SELECT FRomw. Emp WHERE SAL > 26007, GBS WACK Retails of the EMP whes NAMES is TONeS SELECT ¥ FRomM Emp WHERE “ENAME = ‘Tones’ ; as ARTO Dalal of ths EMP woho Wok HIRED aftr ot TAW-g) BETTIE LL TSR SELECT 39 FRom\ EMP. HERE SRP ATED o1-TAN- _ Vs WAR] NAME and sAL oleng wslth annual olny AY the Onwu0) Solasyy 4s mow -than j200e0 eleer ENAME | SAL, SALXI2 AS ANNUAL From = Emp WHERE SALYIL? 12000 5 GS URGTD WAP EMPID of the Emplo SELECT Empno FR Me WHERE OFPTNO=S07 QI. WRGID ENAME ond HIRCOATC Sy ale a hired bepon x S8\ SELECT ENAME, ARF DATE v vy Ys WhO WU Lworked .th OFPr5o we i} J sd FROM Emp Fn} WAE RE Hage PATE <'o4 -SAN— War; =p VO MNETO AL, Gh ths emp uarking a eaeNMaRD - SELECT From =&MP UHERE % ToB='mANA mee? QL WOT NAIME” and sALney given to an Errployes th employe RaxNd —d_Lgmnission of, Rupes (Yoo select FNAME , SAL FRom = EMP WHERE = COMM= (400 5 BAR WRATH Axteils ch employer Hauing LomM mor than Salary select ¥ From = Emp a WHERE Coomm ys SAL Qis WAQTO EmPno sf EMP HIRED Bihou ty yeoy 27 SELECT EmpNO FROM, Emp a wrd70 WHERE treeate < | o4-JAN- Q4'5 ay Radel EroP werking as eee ge CMRI os FV ANAL ys Feo Emp : ay WHERE TeB=! ANALYST 5 Qs ae on Sk EMP eanin y mee thon 2000 Rupes SEVECT & From Emp WHERE FSALY 2000 5 -Q@ WAGTD “OM the dotodls“ of, emplorses + SELECT & From Emp; @ WAGTO deal of the em plsyees whd ane LsErking OA Salesman sevect x e . FRom Emp WHERE TeB= ‘SALESMAN! ; © WAVTD Oxtaily @} the emplaypes uoho wu esr king ap ths DEPING 30° crt ecy Fram emp . HERE DEPTNO=305 rxPORQTD Datedls ol the em; whe GU workis in Hoy DEPTNE Se! Pegs " S SOURS m SELECT ¥ FRom EMP BND WHERE ToB='sALESMAN?- ef, PEPTWo= 30; - Sf OPERATOR %> 4 DerIMETIC ofPeMR Cr — X UNGTANATION OPFRATR CII) X COMMISION oPFRATR (=, |= OP)S>) K — PFLO TIONAL OPFRATOR C4, >) © Wa} C ANP, OR, NOT } fete dee lth eau ies , BETWEEN, US NUT RE TWECHY c. 5, SNOT, ake, Notlrre) ~ SUB GUFERY OFFRATOR Ly CN, AMY, Exdsts, NOTEKIsTs) CONCATINAT ON OPERATR 2» see OLB sid Jo. Jol ate sud ‘Ys'|] Eran BS SELECT ‘Hy! ILENnme ° HS Jones FRom Emp op WE BLACK WHERE = oR = ‘MAN , AE tar ov N= Se 7 Sete tH." |] ENAme Srallennme FRom EMP olp HI. Tones WERE TPB= "MANAGER! ; isorelned HEcuARK we LOMLG@AL OPERATOR g- oe do wits he mutioh. conden inside gh who — Clouke 6 We have are types oh Jogi opuroctior 4. Logica AND 2. Logica OR # 3- Logual iT dt Worcar AND oPrern PERA TR “eo AND | SPvOlor selma uw if aU ths condition are Seatishlad » EX- Q WANATD Glass of dhy @ Crployses Whi ae WM “SALCSmoy th dhy DEPTND go. SELECT FROM EMP HERE PPLELELEELLECEL EEL Be I 4 had wawkiry JEB=" SALESMAN AND DEPLN® =30; A ROA EEN RG RE ee a Q.LAGTD dulails of Aha emplayetd who ore gettiny SALNRY Mee than ooo in thy 00Pr ve LD > SELECT & Fem EMP WHERE sly woo AND DE PTNO=10; = 3[ we Uke SNL 6000 PAD DR PT ND= is hon Lortstion. © ols ond Huss salu, NS Rows galretd 2. OR OPERATR <5 2 DR OPERATOR suturna cour th ny ons. af +h. condition 4 a Bomeli> @ waero astoily Othe employus Whe oe wring as dateamniy or t0 OFPT NW 30 > Select x FRam me WHERE ToB= 'SALESmpn’ Q. WARTD details ol shy Chopard no \O oy 20. 4 = select a FRom MP WHERE DEPTNO=10 OR DEPTNO=20; 3 NOT OPERATOR 8 OR DEPTAY=39 5 Umpleyes who axa Usorking in ) Bis o Smee opuiadoy, tre galected values coil] 9, dugectid. Examplt> Q WAOTD NAME and OEeTND of Whd au Nel workin a > SELECT H ENRME , DEPTNO Fhe employers He DEPT 20 — FRIM EMP ERE PEPTND j=20% ers LIMERE PF eee is Weean UL 5 sor WHERE DEPrNO <7 205 atthe tree Foe OR Conditions. WHERE Not PEPrNO=205 | Sat Aon Aan RSSLANMENT Ques7 TENS FoR LowIcAt OPFANTOR GHOAGTP cletails of the EmP Uorking os CLERIC AND eoxning dass than \soo > SELECT X& FROM EMP WHERE ToB='CLERK' FIND SAL 41500; Q2WAGTD NAME and HEREPATE af sth EMP vowing Us NDNAIKER tn PEPT30 >SELECT WENAME , HIREORTE FROM Emme \OHERE = OB ="ManninEe! AND DEPTNO= 395 G3- WORTH datos of the Emp eng wlth ANWAL SAL Mh Any xe working .in DECTNOSO Ob SALESMAN and this ennuay SALARY Hos to br gan than 1Yoso SELECT EMRX > SALE FRom Emp WHERE DEPTNO=30 AND ToB=‘SALESMAN’ AND SALE 12y1Yovo S BY WAGED Al the dials of the Emp luring in OFPT 30 oRas BNALYST ‘ = sevect * ) FROM Emp WHERE DRPTNO=ZO OR TOB='ANALYST' 5 Qs WAQTO Names of the EMP Wohod Bolosty is Less thon 1100 PNO Fhe Keds nation 4s cre = SELECT ENAMES FRom Emme WHERE SALC\J00 AND JoB='CLERK’; KE WPETO NAME and SAL » ANNUALSAL AMD PEPTWO Bk PEP 1s 2O SMUVAY MOXA shan {oo ANd - FNAL SAL extads |2000 A SELEC ENAINE, SAL, SALXIZ , OFPTNVO UVUBUGLELELECLLUL LEE ta p « a = FRom Fine 4 . P ane WHERE DEPINO=29 AND SALIHO ANP SHtxI2 712000, 5 TD EMPNo ond NAMR: thy Emy Od MANA 3 Peet Sof thy Emp vorrking eR = SCELECT Emeno, ENAME 2 From Emp i \ . - WHERE — TOR ='MANNGER AND DeEPINOT20 + a a | =] a SE ATEN Na cla! Nealon EE D duos . ° C aaa OFEMP Lanking LD pep ar RS SELECT & : FAN ~Eme wit. LOHERE DEPTNO=20 OR DEPTNO] 395, a QS WHE] auiaids ooh EME wosrring a2 ANALYST fo PEP. SELECT ¥ DEES raB= SANALST! AND DEPTND=107 LAO OAQTO dAstals ab EMP wourting © prssidant with SAL ab Rupaery Yovo - QELET Faery EMP WERE TEB='"PRESLOENT’ AND SAL=4004 Qu WRETO NAMES and DFPTNO , Joe of FMP Loveming AS CLERK in DEPT oR 20. / SELECT ENAME, Depo, TOS Rom EMP . WHERE JoB=!CLERK? AND (OEPINO =10 OR DEPTAD= Qi2-WAETO detally al, EINE working as CLERK OR MANAHER 3) DEPTIO > SELECT Feom Teme WHERE (TOR CLERK' of TOR =kEERK MANNER) AND DEPTNO=103 ye © Day wad for eha, epuetion 40 by hodt Sxedasl BAO) Intern bw . 3 oly Q PATO NAMES ol, EmP werking “) KEPTHO 20, 23 yo SELECT ENAME “ FaoM = EMP oR oR WHERE DEPTNO=IO AAD DEPTND=20 AetORDEPID=g Pad OPT Ko- ayo ¥ AY WPRETD diab, of EMP Lolth Emeno 4902, 1839 SELECT 4 : FRom MP oR WHERE EMmPNo= 490 Rai Emeno= 3339 5 OAS wROTD das af Eme Wotkiy GA MANDHER or SALEGMAN or CLERK SELECT & Feom fem? WHERE TOE="MANANER’ oR ToR2'SALESMAN! oR TBR ILRI 5, * : Pere = tb WATD NAMES @LEMP HIRED Ahir st AND BFRoug) SELECT ENAINE => FRM EMP \ — LOHERE HUTROATES'34-DEC- BI" AND HLREDATES - "ol-TAN-239"5 PS Qed ALT Dalodls of EMP eaxning mov Ahan 1250 fut diss thon tg BOOS eect FRom EMP : é WHERE SALY[ISO AND SAL< 30003, PY GIS WALID NAMES af EMP HIRED aftr Into DEPTIO oR — GELECT ENAME —) FROM EMP = WHERE HtREORIE>'34-DEC-8! AND (OEPM= 10 - s OR DE PINo= 0) 5 me TO RRO NAMES of Fn Olengwith prMwL sAL gor the — EMP WRINg OA MANKAGER OR CLERIC Jinto DEPT ID oR30 => SELECT ENAME , SALII2 + FROM Emp ~~ WHERE (oa= (MANNER! of T= 'CLeni !) AO ; CREPTNO=\0 8 DEPTNO= 30) 5 R20 WAGTD aU the dttajly oeny wskth onnuel go} Ay splay 7 9 ble jom end Yooo prMac . AL Moy FhaN (goo > »\ SECT REMP.X | SALEIL + Fearn Epp X WHERE (AL 1900 AND SAL=4o00) AND @SALX!Z7 | S005 VY WHERE (BAL>[900 pNP SALL4900) AND SALX 12> 190005 Ge Should net wy brackets hou boacaur oY au PND 47% WAOTD dwlails ofthe Emp olong wlth anaual SAL ond -the EMPloy2 who wu voorking os SSOLESMAN', mammace oa PNALYST CLERK PRESIDENT in the OGprNo 19,20, 30,40 r Hing SAL MR than 00 AyD 6233 thon Ofte 1980 but bo t9gg . a MEL A AL A RE eB 2 a ree SELECT: emp. FRemM Emp WHERE 7 SAL] tH SPEcaA OPERATOR 3 > a) IN 2) NoT IN 3) BE TWEEN 4) NOT BE TWEEN S) Is 6) TS NoT | a Uke Q notcme | FIN OPERATOR % 0B ds a muttivolue apviator MM can acupt one volue at LHS and mrutdipla_ _ Valuss at RUS | e We Can Ubi Ty Opurodoy Snstiod af sing equay SINTERS Col-vame [exp TNCV) Vas... vn) 5 oo | LHS onl | Example sepuisdts 0 qwsy do ditplay Name and DEP Pe OL eMPloyts Who Ce ~ WesRing in he DEEZ | 10, 20, t SELECT ENAME, DEPTNO FROM EMP VWOHERE PEPTNO INC 1S, 20)} Y- Wott 0 quwoyy do duploy dalla ol she emp Whe aru uoerteing 04 Aalsamoun , MANAMER, ip tha PRETO! 36 SELECT ¢ From Emp , WHERE Jo IN CSALESMmow!, MANAGER’) AND REPING'=30 ¢ Ge WAOETP NOM ond SAL of Aho EMP who ove wee gel bing BAL MeL han \90o anol WaAkINg sh LE DEPTIVO oO | ULELITTILLL SP 0 u u i 29,30 SELECT ENAME, SAL FROM EMP | WHERE SAL > \o00 AND DFPTNO EN CLO, 20, aq) RB NETH Aeiails af Ae EMP ho axe cooking Jo the | Aspard mont N20 SFLECT FROM PMP WHERE DEPrNo=20; c OR s Saint sal 2 al] ote Same oR DFP TNO RIN 2.9)5, # NOTIN oPERATR 39 NOT IN OPERATOR et & slmilar do en @puiotor Instead cof seleted Valuoy WI br sua seajected . SYNTAX — col-name|exe NoTIN (Vj 2V%*- Vp): Example: © WAGTD Name ond OFPrAD of the Eme who ote NoT wooring in ahs pEPTAD Ie, 20. SELECT ENAme , DF PrNo e FROM Emp # a eee DEPTNO NOT TN La, 29) - 7 . tos of 4) kt oo ae he FMP who we nel woking as SELEcT Me 7 FRom Emp WHEE + 4 @ WHET nein HERE FoR Nort C'satrsmpny ‘Mownuce') ob te CMP WhO OW working a sntesmnn y y _ MNES, ANALY &, . ba tal MYST, CLERK iy dine AtPINs 19, 20,30, and 7 ; SHOU mou ahah 2000 farsdhan {ooo ) FROM Emp WHERE AB TnGsaLesmnn’nennege Yammtygi' ERK!) DEPTNO TN(10 20,30) AND SALJ2000 HNO SAL Horo, lg SELECT 2% OO . than \ooo TQRATD SAL of the erp who are gutting Solo%y tore And bss than Yooo 3 SELECT & sAL Fem Emp a 7d WHERE SALDIO00 —PIvD SAL SELECT Ewame, SAL . Fem emp . HERE SAL BETWEEN 1000 ANID 2000; Q- WARQTD Name ONd SAL wh +the EMP ocho, wu getting SAL 29 abe RANUE BErwEEY 1200 45 Yooo > SELECT ENpme, SAL FRom emp ; - * WHERE SAL BETWEEN 200) AND Yoo 5 wv GRERE 6p L BETWEEN 204 PND 3999; Range Charge Bla) og [Routan jbsathan) \ooo ‘3 & dod | Tabs BR Qe WAQTO Name SAL who Cou getting Sovleoy Fira Bary goo- laut hea hour) 25005 SD SELECT BNAME, oni FRom erp HERE HORE DATE BE tuRpy ode saveg,' AnD Va4 ~4q)e ai —DEc SF y ~ Q WRETD Details af the EMP cohe HERE aftr 1991 brave. \9B4 « > SFLECT FRM Ene { \ ' LOHERE WIREDATE BETOFEN 'oL- TAN: 82! AND Seon y BL DEC-a6!; I wo ET, QWRATD tals cof tho Emp SELECT & FRom Emp 5 TA Name ond HIREDATE of the EMP Who a wer a8 ‘sacesmeny! 70 the ceptno 10 , 20, 80, ang] getting ony 4M Mang blu 1000 49 Yoo SECECT ENAME, HLREDATE FRM Emp WKERE JoR ='SALesmpny! ¥SAL. AIND » SETWEEN * NOT BETWEBN SPERATOR ¢ PND DEPTNO TN (0, 22,30) 100] ANO 3939) rr bu rT & i Eg tT B ‘i & BT! N Way fo. bativeon opaoter insted ol asliche) values cath br rajecticl SYNTAX + SEK COl-NAMmE EXP Not BETWEEN joweR RANE AND ; HIaHER RANUE ; Exorehs @ WAG NAME and spe S| ARs EMP who Oe Het spty mange Bh [000 fo 3000 SFLECT ENAMmE (SAL Fron emp WHERE vu VUES ® 8 2 SAL Not BRTWRENV 1909 AS 30005, BQ WROTO NAME ond y196 PME al dhe AMP therturho ou Net Hbed afta \931 eygoer (g 94 SELECT EN AMP | SAL HIRE DATE From) Emp WHERE HIRE RATE Not BETWEEN 'o4 ~sANV-g2! AND ‘81 -pec-a$! | wv f ws % TS OPERATER 25 —_ ve vals - TS opontoy is used Jo compare only uath ae SyNTIX ¢ Col-Wpme Jexp rs moll; Example: - Q wreto NAME ONO comm cof -ths employus dhs axe net getting comm. => SEtect ENAME Comm Feary Emp ; HERE comm 3s mutt; DWACTD NAME, Mer Crmanagin) ef ‘ths employer theds udho exe Trot hang rapaxting mur DS Sect ENAME, Mar Frey Emp WHERE muUR 5 NULLS | * TS NOT OPERATOR 25 \ s « 4 é ¢ G é é € e © © © TS NOT Opeiatoy is similay do Ts epyrcdor Inshad of Select Noluws voll) be Sujeeteal « SYNTAX =~ C@lLNQME/[EXP TS nT Nol; Ext oO WAT NAME and comm @h Aha EMP zhoa, udhd ava getang comm - =} SELECT ENAMFE, Comm Fem EmMme WHERE Comm TsNor NOLL, . PF WARIO NAME MAR, Of ADL EMP shox sho ce hawlny my . > SELECT ENATME, MUR From EMP. VRERE Man Isnt NULL) W LIKE OPERATOR 2 é LIKE opmnoter ds sand p uoireneaen we have pattxnn marching SYETAR*~ Cols xP! Me SEBE'~ col-Name [KP , 'POTrERN —"to-mpTeH’ SELECT ENAME Rory BMP. ‘ ° 5 WHERE ENRIME LTA ‘Al a oY oy SELECT ENNme = WOHERET TE ‘Arp! map VUARTD NAME of EMP whed Names ens with RQ, SELECT ENme me Mores. FROM Ennp ; ae WHERE FNAME Lace Sor? : | Jo Alo aused dy Adplay Asin qnams anywhua , ) RAAT is shed 4s duplay eam a pity Consecutive AL, TAA. ay Reed dh deploy oo AL: nah, hame . | = NOTES To acheive Portion motchi > “he and _ RY heed two Spacig) hortatus = JO bind Ahs pp of hanaeton ~ Q- WA@TDH Name Of the Emp ee Ge SELEC ENA Mek hed many fons fh 5 chorea. a» FRom Emp = WORERE ENAme Like | eo EE % NOT ULKE OPERATE L. SAwedyy Ahstag of Atlebd Volites way => => BY Simon He, ” bo Syjecktd. => \ es SYNTAX GslLVAMe a Gee wow } A i x GUIs es ee oe Assignmen| Juestiens for Speciod opoodarn, ee: ul YY UTSTAL the emp Lohede commiission ds NoU SELECT ENAME FROM ENP WHERE comm Ts NUL ate emp whe dont have 0 Reporking manager - SELECT EName From Emp SHRE MR Ts now; 3) LIST QY she sptesman In CFT 30 SECT ENAme Y LTstoll From EMP WHERE = joR= ‘SALESMAN BID OFPrNO=30 5 or \ SH TNUSALEEMAN)) ANID DEprN Tnt3o)» [el 4) LISTAY ade SRLESMPN In DEPT aR 30 ahd haretng sa Pook than 100 SELECT ENAme | ToR ERM Emp WHERE TOB Th (SALESMAN!) ANID DEPT ND In (30) anp SAL |s005 S) List af GRE where Name SELECT ENPme, From Emp \ WHERE ENAME LIKE 's %,! 8) UIST olf sty amp AOL lth 8" og 'p? OR ENAME TK Ab! ALP AHO Lohe ow vin O07 wo lO Lr. nr Ring SELECT Enpme FRom Emp VHERE DEPTIO A ust tty OP Whe Nome poe nel Mosh wit rg). SELECT ENAmEe Fen Emp NOTIN (19,20) 3 9 LIST al] thy emp whore ow. Howing porceingy MINDED din Tt Nw JO ee ENAME i From emp i mag | SQ WHERE Joa, IN CIMANQGERAY) Rr MR AND DEPNO thy dod; SELECT ENAME a FRM Ete ; : WHERE mune TS NOT NULL AND DEPTNO Th Qa) 3) LIST OU thy amp uahose COMM iy NULL ang WOOTRIINY Os CLP SELECT Brame Feo Emp HERE commits NULL AND To®s! CLERIC, ©) LIST aU dry emp uaho dont hove o epasdting manpc any DEPT AD [> 030 Ys SELECT EName From Emp WERE MuRIS NOLL AND Aku SALESmpny Tr DEPT SRECT Eneme FRM, me WHERE Jo@ In CSALE& man! AND SALY 2YS0 . YST IN PRET AD 20 and Having SALARY Boot dahon agoo SELECT ENpme je Ere | Emp i WHERE TORE ANALYST? SALS 2800 3 ‘3) UStal ths emp thou by SELECT ENAME FRom Emp WHERE NAME UTKE ‘ms. ! WW) List aut dtu emp With onnw Eines ENDINE | SRUIL FROM Emp . WHERE DEPT No Not IN (ae) ¥ DEPTNo Try (49, o)5, W Ltst ay — 80 walth BAL moge than ou ) pro DEPT NO IN (30) BND DEPT NO=20 ANDO Se ae — cy les! oR |p! 'S) UIST ahs emp whose name. ceanat end. uslth SELECT enpme hen OHERE a Not Live ‘2/6 Es! oR ENAME Nut TEETER PI ah am uch or Howiny suporting maweder 0 PEST po Along ubith sl HEE an SALARY SRECT Evame From Ey L+SALAIO WHEE a TSNOT NULL AND PEPFNO Tn (10) ANA SAI 1 \e) Uist AS \O°GHTKE s Tp whe oc. 'SALEEMAN'S Having 'E! AS 4a dost Bot o Chostautuy Jn Eneme ‘aud colosy honing, ox ly Whats sean SEUBCT ENAmE , FRom Emp le WHERE JOR XN ‘saceempn! FNP BNAME Like type! of FD SAL A385 ye 18) Prerpy alt the emp who Ore yoirus} after Yeon 8] SELECT NAME RHIREMOTES Jot ANB! Fron Emp OR hy WHERE HIRE oATE > CA TAN Sal | 34-DEC - 19g) 5 '9) Display af ahs emp Aho emp tho ow Yolnd ww FRR | SELECT ENAme HT REA TE ' FRom Emp WHERE HIRepA TE Uke ! 22) UIST EY @mp who ou net Ob Manag ang CLERKS 4H DEP 2 andl 20 with A SALARY in Hho Range Bh LOTS good, SELECT. EnAme FRom Emp WHERE TAR KY TOR NOT “ty ( ‘mMannner', AND OEPTNO TW (19,28) AND SAL BET \eee AND 3000 5 “le FER~ 9/4! 5 ‘ctenie') WREN f v1 ) ca Tir) ert t AW Nn Sepeeeer reese eee e eee eee eee eee eee » *. @ wAQD me name, SAL, HIREDATE , comm, AMVALSAL , ond those coho omgeting SAL MeY AhON gO and thoy osu. getting SALIN the Han; oj so fo ‘hay oXe cOorking IN SNCESmAN, MaNAGER, ANDLYS 4 ANAGER, ANALYST, “CLERK PRESLOENT in he DEPWN012/20/3,49" hoy Whe are EMM and net having MUR and thy ENNME sieus wath ‘Yond enoms ends woth (6! and those Chesed oyr 1959. nd hfou 197, dhose whe VY nel golting CAL in any orange bebveen aa me Ang 3) SELECT ENAME, SAL, HIREDATE , COMM SALE I2 From EMP HERE SALXI2>G000 AND SAL BETWEEN Goo PAID 2009 ARID 708 IN CISA UEsmaN',MAVAKER', ANALYSZ! - 5 CLERK! | PRE NE DEPINO IN (12/29,39 49) PND Cammy IS Aor Now ANID meee TSNOLL AND ENAME CWE '8.) AND ENPme ike ‘o8' PND HIREDATE BETWEEN 'ot ~TAN~5o! 134'~pec-¢a' AND SAL* Not’ BETWREN Bv0d meee A —= EATEN Rm ee ; Gr WARTO dual, of the EMP ewhose Mame sorts uaith Nowets SBuEcT x From EmP VOHERE AME LIKE ‘Ase! oR ENAME LIKE 'E4,! OR ENAME LIKE 'Telo! op ENAME LIKE ' 0%)! OR ENAME LTKE ‘UL 5 - 00 P- WAQTD Lai of, he Emp whese noms stories wtth ‘J. SEvecT 9 FRom Emp WHERE NAME Lice ‘ya's QUALTO astaits of 4te Emp whos ham. ends sith IR!. FRom Emp WHERE ENAME Lice bags “@ ORCC dats of tu EMP het rome -stow’t usith L_! Select x FRom Emp WHERE ENAME LIne TT ESCHFE CHARACTER 3- wa g ULELLE wo ULULUTTLI LAURE i VUUGUES a u q Nay Ul f \ u P ESCAPE chovtactr is Lubed 10 sumove dhs APICiol bshawiguy, eh a spacial chayacte, and do dual 31 as 0 Kemal cheractot , EscnPR charatts: mud be ca Hen ifOV 4M ApeGal choy whith has go bs duct as 0 NWA! Chanactey FscrnPe chavacky must be dubine obter Losing . © We can tise Any Choriaeton ebbigh Ch an escape chant but Sucommndted chonactog to Scope chaxacty, osu. Ch $489 a We tr the conupl of escape charactou only to Jeek for *fe' and’. SYNTAX = Cot-NAME[EXP LIKE/gor UKE *Pameen 7 eae . a ~ W-| Te ESCAPE “CHAR J EXSS TAT_sANKAR. kK ORL TONY oy —RUcHAA A IoD els ToM_ 2202 LVERAT |, KOHLT 13 __ “lo CIFT_waity apt FOOD Names ahat ends witht _* SELECT ENAME . FROM Sep ESC PHEEE EnAme Cie ‘eh $' estnpe' 8! 5 Spatial} | “Rignmod Nia ae chestatdan, Chatty, $ tN FeGCAPE ares Cine nct Any enol then @Y AGT NAMES shat Chandy SELECT wn ENAmEe FROM boc WHERE ) \ x ENPMe bite $0! Benepe 1825 OR ,! = ’ Vpath! Reenpe 84) $s sanecrsensetsnnnmstnscosnimmi RoC vames Ald Moot ard ends oxsth — SEE er ENAmME FROM eg ut 9, _. are 5 weer ewame cre '7— Ye 7! Escore '/ | FO We Sec oc QWAQTO NAMES tohich ha ‘fe in Jt. SELECT ENAME From Esc. WHRE ENAmE tIke 9 '%, 4 4, o/,! ESCAPE (5 '" of EC Ne Se. QwaAgro détails Of tho emp whose Notre shasets with _ and ends with ei, SELECT SARME , FROM ESC WHERE ENAME LIKE 1 Sede! Escape igs J. WARTD atl the dulaits ol emp prusend tn employ doble S€uecr y Rom Emp 5 @ WAQTO sabsy oh atl the emp SELECT SAL FRom tps #QWACTD buy manimun Salary SEvectT Max CsA FROM Emp s ~ He Funetion. ty Functions a block of cols or Cra of s insbucion oohich & sd to padoun some spucifte mw 4ask + mS Funden, 3 7 USER DECINE FUNCTION TN BULLT FUNCTLON i es SINGLE ROD RUNTZN ~ Pan Flnere Fasnttum, Ts He cle op SAUCE: Row Funtio ie slg ore [ei ey Fonthion wey 1p el ae ut Tp rae 1") mee [BS » 2p ot nm No- eh Llp =No-of ofp Ue fn ~ No-0} T1p= Singkop <5 SINGLE -ROW FONCTION §— [Nook TIp= Sign a > Tue give ore Inpuk to the ihghe 100 function finally we = + Th uk give mnulétpl J\ps #0 the singh sew fuundionfinally = ue wi get mullipls outputs + [No oh Fle-= No-eh slp [ol 2edays wt = | - | Atuly ope » a MuLTL Row FUNCT Ian 3— = ST We give ons input do. multi seo function fanoly ux wil! | => get Ang cutput- , . | 58 Th or give musttipole: Anputa to the multi iow function 2 pint ee unt gut rg utp Tw | | © [Noch tp =Sirgl ole =F > LIST of MULTI ROW FUNCTION 3— u e K MAK) %* MING 2 * sur) 2 * AVVO) Bp ¥ COUNTCY EEE TORTI MeN YMA) > mas aed do ohiotn mannii value laf pousered ty the column. DMING) 1 His Athed to eblain ynininun valu presi in the Column, 3 some re Tis wad do eblain sum ef values prusent in the column. NAVEL 5 ~ 3h is weg to Shiain axgs of ty volun Prwant in athe Colm , 5) COUNTO +~ 4 4 Wwed to obtain otal Noch VoLUs psUrsent in Aha column: NOTE $—* Multi Reus Function camet accept null value if «In SEuEcT cunuce We canna) Name ateng with mutitsrou » We CON Ake more 4h, the Solel clauge. Ty WHERE clause we tonne tre rutin ew feretion » © COON 3s) the ony muukorew bunctiny Which can accept *® af an Bigement+ Ext> © waetn max Aalory ol, emp. SELECT max (SAL) - From — Emp 3 coal t B-WAQTO PTNEMEn Sahasy, @{ emp, b uke ONY bho column Surction: an na multdiow function ANE MIN Avy max lo00 > som SE tect MINCGSAL) From erp ; Q-WROTO Tota} Solony ol, Crnplayena + SELECT 30m (SAL) From Fonp; Q WALT AV Solory caf Pimployws SELECT AVWISAY rete from Emp; . ol »WPRTD Nb. ak emy yes working in dypine- Lo ae pediecs rete CE) 3 SELECT GoUNT DEPT No) ROM EMP OR FROM EMP WHERE DEPT Noe ley WHERE PEPE Ke= ~ @ WALTH No of employes , Mas, So] , #MINSe) , elo SMe we BUG SAL of Aly cmploges Who om Working an Any depivo me Bo SELECT MAK (SAY , Mm MIN CsAL) , SLMUBAL) ) COONT( x) oe Av (SAL) s From Emp » SOHERE — DEPCND= 303 ~» a => We Canndl a2 ony othse column ° SELECT ENAme, mMAxisnL) xX ~ Fisstqnmenz ON MREC) PS 4. WAR TO Numb a ery Getting Salary hess than ooo Ty 5 ws DEP LO — SELECT COUNTLE) | > From Emp = DHERE — BAL £200 AND DEPAVO=I %5 = } 3 ME ROTO total Slory haecso) 40 pay emp working as clk. SELECT Sum (AL) —-) FRom) Emp = WHERE — ToB='CLERK! “DER VACTD AVERANE Solesty uid] Jo Pay all employees . - SELecT Av (SAL) . FRom, Emp $ woe X HERE : : : Sersherw Numaxs oh RP Hawing 1! od “Troi Fist J Ononauty, ‘ S SevecT (ONT) 5 From EMP VOHERE NAME LIKE Vast! GS WARTD numa oh 2MP uring Baas CLERK OR MANAUR SELECT eons XK) From Ame WHERE eB TN ICL RK, Imantanreel) AeA mm — V6 WAETO dota Salosy wsdid soPOY emp shud th FRB SELECT gum gat) FRoM me WHERE Hswonte LiKe 'le FRB %e! 4 Qt WAGTO Hubs o lng 40 19339 (MUR) homp — xepwrting SELECT CQUNTOR) FRO EMP WHERE MUR= 483g 5 oe oe gig comm 4n D€PrAo be SEuecT Count) FRM EMP WHERE — COMM TS NOT NOLL AND DFPTNO= 393 VI WARTO Pwh SAL , total SAL J NUMBER ohempds and Pend. ULM Sa Ghd 4, Pmplpyees wnrteing od Pasioun- “o SELECT PvE (SAL) , SUENISALY , CounT Le) > Maxcsn UL) Fee Emp 1 WHERE Toe = 'PRESTOENT! » BA MPETH numb} ol emp Hoxing, SELECT counTLx) FRom emMe WHERE TENDMe LIKE \elAele! 2 QU MRRTO Numbo, ol emp. Ramng AND dol sok rusdad, 48 Pay ty emp . who hore 2 won stusctive 4 gry Jrsiy Noms - SELECT COUNTUY) , SUM bSAL) From emp ; WHERE ENPME LIKE ‘eb ole! 5 QA2 WACTH numbst of doPorckrunts prereny try emp " getecr ounT DISTINCT LD pr an) ) from EMP > wager De 19! andhey moms Quy QAd we QS VoReTD Numorr of EMP Howling chonactot! 2! ih thin : Nom, é SELECT Coun Uy) . FRO ENP 3 WHERE ENAme LE $°[62*/o! ¢ > S84 WALID Nose Shemp loulng 5g! jn kuin Nemo. 3 ELECT ne > Fee fee 3 a 3 o LUCE Velo $b! Eg cA PEI > SELECT COUNTLY J > FRom Eme > WHERE ENAME LUKE 'bsth! 5 > GAS long-To uetol soll gv de emmP working ay clock Ln Oepkee: a SELECT som SAL) > From Ewe : => WHERE JoB= CLERK! AND DEPTNI=30) F QLe WA@TD Monttmteny colony gun dodthy emp workiry B =] anol - aS SRuECT MAXLSAL) S FROM Emp => UME RE Toe= ANALYST! 5 | =p OF WNETD No. of disstind salesies pwtent Ln enpdoble a SELECT Count (OT STINET @SALD) id For) emp » = NWELE = Bs (ong aka cer ithe J emp rable Ly SELECT COUNT (Distinct e)) vl Fann, emp. T ww a oS P19) wae Bal ged to.ahe lode SElect Avu(sav) From Emp WHERE oR =' CLERK! 5 Q29 we minimnuny Aolary sfventothe emp wha xk An depts AS MMangger oa WK - SELECT qn (say be From Eme SAGAS SKSF i WRKERE * DEPTNY=10 AND Tea iv CInBNRUER’, CLrRe} « @Q usd. 0 quvsy to ATspiay aU dha dts prusenp dp dtopt Jobe SELECT FRI DEPT 5 : Q-WARTD ho ch employes , maximum salosiy , AVE sal, dolal SAL af Ae emplayeas uho oo Ew, voorking as Zeletran , managut, anolysl, sn the duping lo, 20, 30 and gutting Sal mexethan jooo Ond Lear thay & Yooo ANd employee Mans Uonslh af | S charactys SELECT MAK(sAL) | COW TLE) minisnyy J AVI(SAY _ 6a a , mu | FROM Emp 7 1 SAL) LOHERE Jo IN CSALESmaN! PEPr No cIN ( 10,26 BAL Row-BY-Row | neu (agave S Row-By-Row PUUUUUTTLUTaTa | SELECT any clause ofan group dur Nese UBM by oneutd 05 Croup BY tists *GTOUP BY claw» executes Ober he execution el facm Corre l Pe * Group By claws eeutsS Sow boy sou) — @ Group By couse is ted ao SProup the sucarcts - | 5 © Abko thy execution of gpoup lay Clore we wall get . athe gy : : : + Prey douse erecta, ohtur ats exertion of grouplyebus y WW exouutah group we a9 Exomplei- *Y ane | => ep Scone > Meal erp ‘wrrking in each OFPT | => e| SiC [Premoy — 22 ae GEWECT counr(x) fame a4 too | 2a FROM Em mel eames (Popey PEM} | 3\ 4 200 | 20 RESOLT | 5 4ee | lo count OV) [PEP TNO AG 360 | a Se iaia | a\ 4 480 | 30 2 pre 2 —H 30 GLO nd-ahamp . masSAL ,whaart Workteny 4p each Aupaxtmont SFLECT County) , DEPrND, MAXCCAL) From Emp @ Rove BY DEPT NO 5 | | Q. wWRETD Ne-sh emp voho osu opting gal meretAhan 2000 SEteeT COUNTLW , pEpTNTO | From Emp WHERE SALLY 2000 Rov BY pep ND} Q WAKO ho. of emp warsieing in eath ‘FoR SELECT COONTLE) , TOR From = Emp Group BY JoRs i Q. WERTD Nv ol emp 2 Max SAL, who Ons Getting Saf en each oR SELECT = COUNTLXJ _MAX(SAY , TH | Fram emp WHERE SAL Ts NoT NULL (Rove By JoB } Fissignment Quussions oh ogilp BY twoupey QL UROD No. oh amp Looveing in caah dapt SELECT Cott OX) s DEPT No FRom Emp WHERE To@® ¥% NOTIN PRES1 HFM! GrRovr BY peer No 5 Qr- WALTO Totolsot rasded 4 Pay ol the emp. in Coch 508 SELECT 80IM (say) ‘ Toe, Rom Emp SKC} pserdilenf Rap BY es e 6 6 6 o @ ¢ e ¢ oe e oe ef ~ in exh = a Salat “~ -S tee an or - a = aI~ a Is - 1 3B = sit. als e x) QB WARTO ne-akemp WRN OC Manager “av cosh OFT SELECT corr) DEPT NO & FROM) Emp WHERE oR ROP BY PEPTND § ='MANAMER! * GH WAT AVH sal nuded 4o PaYoU she employers in cach department excluding the emp- ob OFPIH20. SELECT AVin (SA , DEPTNO Fron, Emp WHERE DEPT NOTIN 'DEPtNO 20! GROUP BY DEPT? Bs WROTH Numba of emp. Howiny Choxaus tA)! rin they Named in ach IK SELECT COUNT(X) ,TOB From EMP WHERE — ENAME LIKE !%s A eo! (ROP BY TBS FE WAQTO No-akemp ond AY) BAL nudsd do poy the OmPloyes ahax al 8 Geode) than 2000 Th eath DEPT SELECT COUNT CH) » AV CsALy y PRPTNO FRay EMP i WHERE SAL > 2000 CRou BY DePCNO, GF WACTO dotal SAL raid poy and no-af Saleen Jn each dept - . SFEECT Sum(sAt) y CONT) | DePr No FROM AMP HERE JoB = lenLesmn~n! WHR GROUP BY DEPT Nos a QS WAT H-roleme earth Led} Monti salaretes 9 each Fo SELECT COUNTLA) , MAR(SAL) , TOR From EMP \ GROVP BY ToR yi . opt AS WACTO MAG Sol given ato an emp Lowkiny “en each Aft» SELECT omANISAL) , PRET ND FRM. Emp MRP BY REPT NO 3 eX® LOARTO No: ak Rimes Aha gol prarinddijemp table SFLEeT Go ONT (RY) Le) jy Sau PRom Emp 9 ROP BY SAL 4 Q WAQTD No: ol, employees working in each dopackment and the employes OL env 28 salkiman', manager , ANALYST, iin 10,20, 30. Ong thd mplayer names consis | of S chastactan and who we gutting Soloxy Mere Bhan Loo s ond hidud oft 193). SELECT Count Us) , DEPIND FRom Emp WHERE : ‘ mo 4 HERE FoR” INC'SALESmAN 1 MRNRER' RNaLYSt') AND DePTNO TIN C101 28) 30) BvD ENAMmE Uriee ! ' ANE sAU GROUP BY DE ErKD + Deo AND HIRS DATE > ay '34-Dec-ai'; # Q- woAeTO he-of eMP working Jin each du pode: nb ond the Gtbokk Joe emp in each dupautmrunt. th howe SELECT Cou tx) , OEPTNO FRem Emp ‘PPPPOPPPerAITAVATHAHy | OPP PPP??? 4 7s v DURARUETE SELLE ge vu SHE pvinen cinuse. 2 + ay 3s Leas 40 tbo tha goroups SYNTAX 8 SELECT GROUP FUNCT TON | GROUP BY Exp FROM Tolle Nouns [WHeRe - < Pilar ~ Cordstion >| ner BY Gol- Nom f Exp HAwine) < Group ~ FrerER - emdttian’> 3 ORdsy ob execution t- Rom ([Wonere — Rew -Fy-Row'] GROP BY — Rew-By Row Hagens (Roup_ By (xROOP SELECT GRUP. BY_WRwp © Hawing Clouse ec0eucts often ths excretion of, Qrcup by cloure + © Holiny Uoubt extuuks gyoup by Soups — © Housing chou Y Ashe dO fila “Are groups a © Without using grouphy Clouse UX Cann} tg. hows TOS. - © In hasing Clause we can Abs Mruathisyow functions Foompls.- vsots A@TO 0 of, EMP Usk ng LD each cpt ad dears 2 ernplaryesd in eash dap + and ghee hot rn AE RET 2 & ES SECT CLounTex) Eme ROP By DEPTNS 2) . [ | 2 : Sem J {PVIN LOONTL YX) > 2° N \ OMpUck URMPBY COUNT) 2-2 — K aA v Q- WAY TD No- ef, emp working in each JOB and thew how AL dyash Semp in each Jog > SELECT CONT LY) 5 308 GAFROM — Emp BUCA (Ro BY JoR HAVING count Of 235 DOAMD NO-ch emp , miin(sAL) and max Ba) Of tho emp whe xa, BMRING in Ah partment Ondcthoer prey coup ms ae than ooo S COUNTUR), MIN (SAY) , man (SAL) DEPT No ie ie GB DEPT No ia) MAX (SAL) >Yooe 5 : DP WOAOTO calories cohidy OW Supuactad | SELECT gay FRom Emp Roop BY SAL WAVING! CoonTEAYS = 2: Count (SAL) > zy YWAGTD Houde Whi ove 900 a SELECT HIRE DATE Emp ree BY baReRH ae HAVIN Cy NORE DATE) D 2 + Yor Count( x) 225 reer Resignment Question eof Mamng clone ob ewoorking in cath dapt 4D no: of Le ’ Same eral aA ae SELECT Count (xX), OFPT NO From Emp CIRO! BY DEErAD WHERE TOB='CLERK'* HAVING CoONT Ge) = : wy Oeouy Yemp +2ech kept trop py DEPmo ; Ne HAVING COWNT a> Y : VS MARIO Nb. of caren 4al more than 1200 Jn earh JB anol ae diotol sa] Nuded to Pay emp Gf rach FoR must renew CXKCees BHO SELECT count Ue) Jog 9 S8MSAL) FROM Emp @HERE sALY\200 MRO BY Jog HOW TAY Somespey > 3800 + LA. peep D-m ond No-el ame LOoFRING Oly Ah hoe oe % emp UB*RING Sn each DEPT ov Manage, Seecy COONTEH), DEPLIWO From Emp WERE TO8='mManngee! CROW AY DEPT HAvine ONT Ere); —~ QS WAQTO FoR and Moar sp ahem fin eath 5B ‘Maths ae Max Sef eXtds 2628 an SELECT mAR(SAL), JOB = Fem Emp ad (nROLp BY Tes, = HAVENH Max (SAY) > 2600" mS 6 WAOTO Ah SAL whith ow ~ SELECT SAL LC ) From Emp 7 4 URouP BY SAL = HAVIN d 7 % COUNTY) = 2 t > OF. Wrerw the ed . le — Wisedote ohich guig Aipricocteg} 4b emp > Secect HW TREDATE “ FRor) Emp i Roop py HLRebATE mor Pv AG CONTE) & 9 » ~ TD An or | = es SA of och ppp 4 Pa sAL & Laraton ; SFuect ANG Gav DEPT No 3 1 emp! s an BY DEPT NO ‘ = 99 it PSPS & 8080 ; Seeet oFptne HOA MHVogiei tT Bemp in each dip HERE ENnene {ROW BY DEorNG Qo wont in OTHE,» TED And muro) O £ath goto dh mu 7 PRTSO! y JY Honsooo Mt Saf iy mare Hon 1000 ong SEC Ror emp AH IMAL) HB “ROUP BY “Jon, HAVING, MENISAL) 51009 AND moxtgaty < S000 ; TkE 01, A o/.! ORENDME Lape Lem segt Gy op @ 2 2 e IE ENA arama eee ci = * oe © Ditjsenw blo whoa claus and Hsing, lott - WHERE ; 2) Whee clause Ja estate filo, Ahe 4) Mowing clougs ja atsectito filoy gee Seca, the group - oc DF Whow claus emeets ong fsfoxs the 9) Hewing claus. oxrunts oft e FREUCH ch group hy clause AG exeeutton of, groupby cleure: 3) Whore clause eoeccbus Mewby How 3) Heating claus executes Poup by group. e ‘DD canneos AKER multixero -funttion 4) Tr coun accept Prusltiniouy flarsdien qa gq 2. WRETD Howat EMP, miN'SAy maxtsal) Aolay Say ay Pt SEch Employes Chow hud ofloy igo And the emplyas CF Gstthing Salary mau than qo - Re more then gm \5 thon sooo = Qnal Ate avg (sat) Shaul» Ly thon so And 4he emp r= WhO axe u vomking g 'Selesman', Wmanege,' analy in bre B dspt no {0,20 , 30 Sect CONTE) PP MINA, MarcsaL i + DEPrNg » SOM SAL) Renee ec oe ae '31-D&c- 50! : WHERE LIREDATE Stage AND SALA>IO BND toR Ty CSALES many! » MANAG? Pert No IN UW 20, 30) bRoup py BWAME DEPr No Hevea, MOMLSAL) 915 ' CANAL ST!) AND AND MAX (SAL) < Som AND Ava (SAL) HERE Ce LireR conortrons = KO BY tol.ntamy IExe S RENO CoRove exten GONDT Ten) ne CRPER By CoLNEme: » GROER of CR Peuebypy = = Feom \OvERe a Roupay HEVIMG a Sleepy u EROER BY eee en sie elie ele WRETD Nomad af emp iy astending orde4 SELECT EWame From emp SROPR BY ENAME; PARED Sal at emp sn asording orden SFUECT SAL FRM Eme RORR By SAL P GORET Namol tha emp in daxcanding orden Seuect ENAME FRon Emp CRER BY BSE ENAME Desc 3 Q- WRETD Gol ak the emp in dasunding ode SELECT SAL F emp O-BY. sAL PESC; Q- WRET allah chiaty of mp SELECT ye fFRom EMP; a @~ WAT EMP name , soley a thy Emp who are voorking 25 Salyman, manages, ANA the scrrds shoud diaplay ain disunding ovdut based en goloy Column SELECT ENAME, SAL FRom = Emp WHEE = SoB IN C'gALESMaW’, MANAUER! ) OROFRBY spl Pesce? P WACO diets of dhe emp sho ave galing 2c] moretign 2900 SEvecT From Eme WHERE SAL D200 4 Bac PPPPPPPPPPOFeHhAeaegeaseas Q.wAeToD cutall of Ahy eimp toh 4 galling Aolosy 405 thay, LU aco + SELECT & = From Eme = WHERE SALCUDvE | PO x GWAR atolls a} Ere emp who co getting Saloxy more thay ~» “ALLEN SFLECT FROM emp SUBQUERY g— A Quy sa woxb ton Snside angthon ous B Rnown @ Sub Quisy. Q. Working PHowds of, Aubpuniy . L- Toner Rewer esecutes for produe thu output . 2 ears que «sl oe given od Shout doen, ° Ret hen CHP Qpwey coi erutuchs ancl produer thy = = gS Q. Dhay oF wt ba J do we J CASE 4 Senay. © Whonayes, wehove Unf oN ARON : 40480 thy WARHOL Kx ae Ne ae Quy aa Gpuston TIVUUI mmm ens TRI BNONTINELFANMemMen Cis a. Se Whonewey We have dato dolor selettid ond AU candltdy to fae exceed OF OF piukent Gy the shown dole thin we dbs oe Suey oe i - ° Whaneve} ue have. @ .unenecon tard fn hs Doangy or 9 qpreation oe Aird that “untonoan poner Subg oe “a g. ae Pier) dhe e woh Wu ny 404 mors sate oP aed Acton | 2. cece x Se “| yy oC emp \coo ‘ole inna, ote. obi ip a Gwnece SALY Cseect spn Mee > SHLD Leo} oro emp m Luan GQMHERE FNAME ="ALLEN! ); i Q OALTO Nome and sh © dhs emp tess whe axe! olen Gatshont tegen 0G geting Soleny SELECT ENAME, SAL From Emp WHERE saL < (setecT sac FRom eme WHERE ENAme ='Scort! 35 &. WAOTD Name ond HTREPATE oh dha emp choy Who" hid Ober \Qet SEvuecT ENAme, HIRROTKE From Emp WAERE WIREPATE > '3q-pec Q-WAOTD Name and Hyuclads oh, b ENAMe, WieEpAce Fe eme O. Wieroare y C® HtIREpAte Fr me WW FNAME = Same) d5 ‘ “ihe emp sho hhud afte; JAMES @-LRETO Noms ond apse Tron Ny al, eI Wh WU Uy Saree dipkits 0d jean iil sing fh the B® ENAME | DEPINO F me W FPIND = (2 DRPrND c Emp oe c es e: e. |. & ; ©. “A981! ¢ ® ¢. ® ® ® © ® « € WW ENAME = "kin )’ e 8 CLEvEL sLELELETLUIUTESL b no J VuUugos Wl j " woe CVV Q- LORETO Nowe anf Comm of the em eoho au galting Comm mow anan QUE % ENAMF fF Eme comm w comm 5 (£ Comm 4a than 2000 S& ENAME , F Emp F EMP 1 ENAME = 'ALLEN’) 5 Q.WAOTD Nome and Sey Sh the emp who eure geting Sex and getny sal mie chon ‘searq! SAL W SAL <2000 AWO SALD (A She Assignmuny OD SUBQVERY erage 4 FWA Nome of the ’W SALYC & Fe (© ENAME = | DAIS? SAL emp 2 WRT nom and sak Oh th 5 ENome , eau a cp 'JoNRS!)

You might also like