Download as pdf
Download as pdf
You are on page 1of 59
[ os &N GINEERIN, | “> X% % RN) o a p. oS ; © & a) ne 7 < Certificate This is to certify that this is Bonafide record of the Practical Work Done by Mr/Ms.__K. Abhixrann Jor the Subject__D BMS of AV _{[__ Semester of B.Tech / M.Tech. / MBA/MCA bearing Roll Number _}\ 67) A792 19 during the year 2022-2023 na S aie ay Ne Y INDEX PAGE Querying a Dato NAME OF THE EXPERIMENT Pago No, | Marks Grade] Sign! “ Assigned Remarks lo] liolo2 | Fxpeviment- 1 1-5 D< . F-R Model ey 2.} aplioles. | Fxpesiment ~IL oT ax? Concepl desiqn with é-R model 4 ‘ AS 3,Joul nis. Experiment - mL 3-4 Relatrnal model be . ~ WY 4. | t5]ulo9- Bxpesment - lv o-12 (xX Novmalisation ANY 5.| o2ftlloo | Experiment B-3) oF Installation of Mys@L. practising DDL and DML commands: b Me 6-} aq|ulae- Experiment — Vi oped Iw —~\ INDEX PAGE 7 | 13 | nJo Ex pestment — c J ¥ Queries and aggregate Se funchone- Xs I Na ¢.oolijor | Experiment - Vu) 26 on creating toll - xt Experiment - & 34-43 oye 4} 07 [po]o0 Queryin ¢ | 43 Ax > o tolorjoilo3. | Experiment -% ete Y 4 D Name of the Experiment: Date: Page No: _I Afro 6 Analyse the problem carefully and comeup with entities _ jn it fdentify what data has to be persisted in He database. Th_contain the enbibes ,altvibutes sete a Procedure * _ T analysed the roadway travels in this. Zhaxe kaken thee enbittes a 4) Bus 2) Tickets )) Posseng-s pe The _athibutes In the above entities are eS BUS 2 on ne Bus nos nunnesic. a eee (py noaay ke ) Source + youthow Destination + vaxchax ster 7 Avvival time —t— _time Departwe tine: as _ - __tfme. es Pass S _ a _ —_— ___Phv_no_s numero Cprainnasy. Fe) @@ $$$ Phone 2 VOrthoy Age 5 erie _ _ 7 - $e eT _eegeeeacee ee —— vaxthaw address 3 ag TT ____varthow seatno» intega, at 4 IBIET sal Name of the Experiment: 2 Date: Page No: Ticket ¢ Ticker no + numeric Journey dala: date Age + Numeric Bus pos humesic Clovelgn key) No-of seak + numeric a D oe 3 Name of the Experiment: Bxpeximent —4 pate: I¢]1O]92- __page No: Tdantihiy He primary key for all the entities» Identify the other ergs link candidate leys 1 pastial bays "any. Definitions + Entities s The object in the €-R model sepresents fs an entity which Is thing in the xeal world wilh an Independeol existence. E-R Model + Descvibes dala as entities ,velationships and altsibutis The €-R mode! &s important peelimfnary fo is wle In database design. CR Model f usually shown pictors alli. using entily xelatiord diagram. - - _ - a Athibute + the paopeaties. thal characterise. an enlity set ax called i _athibubs, An abbibuly fs veferved toby the tevms data items , data element data field item. i xs attsibubes for bus enlth and. ticker entiby, somawlios Candidate bey PE ce be defined 03 Minimal supes bey on ineedueibu super tey . Tn offus- word, an_abtai but. or combinatton | of abhibutes that identifier the record uniquely but non of its proper subsets coun iduohify. the records | Bus no, service no---- ---> candidat buy. Panimasy bey ndidat. buy thot usec! by the database design. unique identifi ‘ each mw Ip_a table is Hnown 28 primary buy. A pelmasy Euy consists of one ov move attyibulés of | the table. _ cleptime | vetime | bustire | notica . ‘| [Susro Service ro | source | destination Sample. data fox bus entity: Busno Sesviceno: | Soucsce dena epi, wetime 3 |!'bustype || Ab555 aeeq | Seb | Hyd — | 4:00:00 ias-o0 | AC 3 Ap5O| 3eq) Sopt Hyd to:00I5 }201t5;00 | AC 36 I 5 dot hid actte AP4H4 | 360) Hyd. | Seb [04:00:00 | 14:30:00. | non ac) || 52 Less Te: phan’ | apsar | 25655) ] Hyd |. Sxpt> |or:80:20 |20:40:09}nomiAe | 5) 1 afl i APt530. | 3239 Hyd Vip | 404700700 3000!) nobaci | 45 Name of the Experiment: Date: Page No: _H Poatial key + A weak type entily type novmally has a. paxtial key which is the set of altaibuty that can uniquely identify weal, entity that ane velated to the sane owner entity. The entities in the *Roadwouy travels" is D Bus 2) Ticked 3) Parsenges- Bus entity + Atteibutes for the bus enkity axe Busno ,sexvieeno, souxn , destination, deptime, vetime, bustype ,no-of seous- Bus schema $ Busno Seavicenos Source destination deptime retime _bustype no-of seats» Bus no, sexvice no, source —- ==> Supers bug — F Bus no, servia no.,_bustype == ="> Super buy —___ | Bus no, sevwite.no----==---> candidat buy _ Busno, sexviu no-—— =>—peimaay kip — -_ Ticked? entity « Ss... nb sets oe Mbibutes forthe ticket entity axe ticker no. Joudab, yputime source, Destinatipn, sea amount, catcoad. Ticket no, source» destination_- —-—> super key _ Ticket no, source.» seabno == - -- > super by —— Ticket no, destination isecdino = == += > super key. | Ticket no_-------> candidote key = ———-| Ticketno - -----> primary kegs - ----— JBIET Sample data for He ket entity i Ticketno | Jou-dati | Jou-time Souree isttiabiond seatena| Amount | Catcorg | HEL) fro10-6-5 }24:00:00| sapt Hyd 5 46 No | 2222 |o010-8-5 } 10:00:15 | Supt Hyd lo ee Yes | | 3323 pol0-€-I5 foq:00:00 Hyd Supt In 8@ Yai | 4444 | 2010-8-1$'] 09:30: 00 | Hyd Stpt 20 46 no | | 5555 |2010-¢-6. |o:o0700| Hyd Vij Is 172 Yes | Sample clata for passang uv entiby : i ' pnrno | Phame age’ |sex | tickndno addsess' |Phno éal-no loo) Subbu | 3) M wit loo2 =| Achaiin | a2 | M 1003, Padma 25, F 3333 4:1 jooy Ravi 23 4M Juuuy., wos | Satyam 42 |r | 5555 4 hae 47046135) 4 ails hyd [9649 3594), 5-4,Srpt | 4492506202), cate i fy HAS P4dil |.ANMI@sosuO]) | 4 pba pwiy. 1170%O54050 | cack 5772. Passengey schema 3) 4 ¢ wildy uy [Prono Pname \[age\} sex | ficketno! Til iiaddvess!'| phno + y Name of the Experiment: ___tm_ ate: Page No:_5 Passengas entity © sex, ticket no, address > ph:ho, catno- Passenger schema & Prod, pnam —--~-> super f Pano, ticket no-- - > Super ex key phono, ph-ho ----> Super bug 4 —> Candidot bea. > orn a - Mivibutes fow the passenga entiky axe pn no, jetianm nage Entity di fe tity cliag crm fox pascnga ¢ oe NN A - Ga ———— ra ee / Genevalisafion + Course) Ticker ”~S OO Name of the fxperiment:__Pxperimenb-<9.__bate:_ah|i0129 _pagenios 6 Concept design with E-R model ¢ Relat the entities approximatily apply cardinalities fox each welationship- Tdenlify slyong entities and work entities cif Tdicate the type of selettonship (total | partial) to incooperat: generalisation , aggeegaton, specialisatnon , etc- wheae as vequired Definition + ‘The casdi nality vatiot fov a binary relattonship specifies. the the maximum no- of velabtonships that an entity can paaticipats jp J _Relotionship- bk defined aa an_ossectatton among hwo ox move_entities: ___. cipal Faangapeh— = ac LT - [Pas een gen So a a SEU | Tickets Passenger} ——_ — _-< “ae == =| Tickets oot a ——— ~e a Naqscqainon ; i Gusnd) Ge) Ga i eget Bak ade | \ aN 1 [Bus -—— —-5_] ticker 1 SF" ' ' \ afd Lo eS == | Name of the Experiment: Weak and strong entity 5 An entity set may nol have sufficient atbibutes to foarn a paimony key» Such an entity sel & teamed a weat ent set. An cali pescthas has paimany kay f Jexireil ny 58 staong entity sel. Date: Page to: Pi i Tables : Resesves ; Pox no Tou-date | No-ofseals 2010-€ - 5 2010-6 -15 1002 2010-6 -5 \o03 2010-815 1004 2010-8 -15 loos «(2010-65 | 1006 |>2le-8-6 Adds ess Contuctno 10 5 5-y,sept | 949250626>° 5-4,S9pF | 4442506262 | 6-€) Hyd 4944060540 bir viy 410405 4050 ea hyd 910461315 4 a-lbbyd | Weus354a44 a4 | ya | 14s 254446, ne Name of the Experiment Expeximent— Date: oul til22- Page no:_& Relational model Repent all entities Cstoong, aks tabula» fashion . Repuesent *elabionships in a tabular fashion. Theve ave different ways bf xepresenling as lables based on the caxclinality Represent attribules os columns in the labs ov as tabla based on requirement. Different lypes of afinbuls ( omposiy, multivalued and desived). Deftnittons + Composite attibutes : Com be divided into smalles sub peevts which vepresenk move bare abtaule with independent meanin Muttivalued attsibutis: for_ev eo the atfibute can in th Bus enity bus by pecan have_different types of loses according that the Bus type _attibul contains the values os Gamda., luceny, Express, and_Ovid inom This typeof alfmibubeis.called multivalaed abhituli and may have. numbex of valurs ed fos. each individual entity. Dewived at: Th some_cases., hoo.ox move abtribul: values oxe velated: With the help of one attnbuts we get te valu of | anol attriouts.- Age-and_poB_abbnibutis With tke Dob we get the age of the person the current eats. li Entity sets to tables ¢ - Relational schema-for Bus relation + Bus (Busnos numeric, serviceno s numeric, suc § vaacharo) | destination s varchar (10), depk hme « time, vetime + times—— | budty ie >voachar. io), noof seas + int’) —— and. Upperx_bounds to constsauin the Canals ; Joudat. | No of seals] Aadisess ~~ | Contact-no Status 2010-€ -5 5 5-u, Sept quq25o6282 | Yes | | 60540} NO | r010-6-5 | > ge, hyd | AA4A ORNS | 2010-6-15 bla, Vij q704054050 | YCS 2010-§-1¢ ea, hyd a7046l3!5), | YES | 210-6. ais bya aeye ad Ws Buss Busno |Seaviceno| Source |destiratixy cp-tinne, | vetime [eet "aa nesses | 384 | Supt || Hyd ‘| 420'00 Iqsvon | ae 7 | ag Liha Abg | Ap5o} scar | ‘Supt Hyd 'fYo:0:15 |) 20:16:00 | Ac i Apaey | 3601 | llyd | Supt | 4:00:007| 19:30:00 |non Ac 152. ‘ Y t we apea) | 3555 | Hyd Supe 20:30:00 |NONAC | br re ‘ > o4lgan Apsez0 [3234 | Hyd | Viy salyoroo | melee. ie Wie DY ypho stl EOS :’“S Oh Name of the Experiment Relattynal schemafor Tickebwlations Ticket CTickelnosnumenic, joudate :dab., joultme stime, source: vaxchar(10), céstinatton s vaxchas (10) _,secttno sinE(4), amount + decimal (10,3) »catcard + char(3))- Relatronal scheme. for pasicnges velouion ¢ Passenger CPbrnosnumerte.. phame * vax char (15) 09 + ity), Date: Page No: 1 sex. chax(3), Hicketno 2 numeric, addvess + varchaz (50), pbnos numeric lio), catne + varchar (10)) | Relotenship sets totablat | Relatrnod_sets_schema fox veserve. relation + —Reseaves Cpnenos numeric, fouciat. 2 date.no-ofseats $ tnt(u), address s varchas-(50):s contack-ne + numeric (10), stabus ; chas (3) | Relattnal schemafox cancels relatron + ze, Canculs (_ppxn6 Dumen'c, joudal + dati, noofseats + int (4), addvess:} Yorchax(50)»contach.nos numeric.Cl0), skatus s.chas (3) JBIET / ind Nickel : 7 a ap Ticket no Joudat. | Toutime | soure Destination} seatno [arco bed - Vag alas | ries 2010-6-5 | 1-00:00 | S«pl tly 5 46 | No | 2222 |ro1-¢-5 | to00:15 | Sept Hyd | 1 | se |Yes | } 3333 2010-§.15 | 4;00:00 | Ilyd ’ St pt | 6 | SE | Yes 4444 — |2010-8:1¢ [4:30:00 | Hyd Supt 30, 4%, [No 5655 = |r0l0-g-6. | 41:00:00 Hydl Vij qa {(72 He | | | od { po} Passenger: |Pnz-no | Pname age | sex. | ticketno) |, address.) phno [entre 100); | Subbu | 31 | M (uh) 5-y sSapk }quq2sp62¢2| cap sir | ager Lote go) ab sa 1002 Achailh |} ar | 4 202% bg, hyd 9444 osdo40! capeao o Wel © oat 1003 Fedme jag | F 3333 | blq, Vij letouossoso \oaps772 1 looy Rovi [26 | HM | 4444 | ¢-qyhyq jarousials® ‘cop y joos =| Satyorr | a> | F te H4-Wbyel rn i | wan sl ale ee Ste Name ofthe Experiment:_ Ek periment = 4 — Date: 151 ]92% page no: _t The nowmalfcation forms ave & 4. Pfast Nosmal Form * ANF vequives that the valursin each column of a fable ave alomie . By alomic we mean that these ate no sels of valucs wilhin a column 2 Second Nowmal Form + wheve the NI deals witb atomicity of data , the ONP deals with velatwnsbips belwecn composi key colurnns. To achieve. 2NF the labks should be in tN. The NE any pon ~ colunng must depend on the entire primany key : Tn case of a composi prim aay kus this means than non- ke colurn_cant depend on only. part of the composit key. 3. Ihfed_Nownal Fowr_+_3NE_vequixes. that_all_coluumns depend divectly on_the Primosy. key. fables _violaki the thivd novmal form when one_column depends an_anotix. columns which in turn _depends.on the patioany. key. Caansitive depen dencyy)..One way fo Identify Pransitive dependeney is bo look at your labus and sce it any CO << = Pascenges : te " —— eT ee Pheno pha | Ty... = : C | ime }aqe | sex tickel no | address phno Cokno, L. a el TT OT ool - subbu } 31 EM | qiny js -uisypk [4442006287 CoP 22. toor ‘chai { agqer sear! | “| Achailb | 22 (M | 2272 | b-B» by | agyesustas | (003 5. | : Podrna |} 16} Fi | 3333 bli viy 4704054050 \cepera> q7o4eiais! \Cap 572 | wooy | Ravi | 23! fim) aaggi | eqchga 1005" |Satyars | 42' | F 5bb5 | getivshyel | | ! “ qguessqir |Caperez! preno | pname jage | sex | ticketno address, ; | phno cote 5. u jSeph || 4492506282 | cap 52 1001 subbu} 3) | Mo {uu 5 y Sept Tasueeusags| Capsil> 100} subbu] 3) fim’ } WEL ft yy ol _ (002r N it Ly | (2229 iF chai | 22) | M31 220% sf 6 Fubyeds (18 4g6 USES) 1003 | Padma | 25 '| F yaaa) phlinuiy 7 | | pad 3393) POMP \)aIoHos 405d, cépist3> jooy | Roi ‘| "laq0 970461315) | APSTie aus ssual | Capers | 1005 Sody a.m qr | I EEE SESS Name of the Experiment: Dats PageNo: 5 Lets nowmalize our entities Nowmolfzation of Passenga entity ¢ Tn the passcngss enliby theve exists a parsergey wilh boo phone numbeas, bul alomic values Should be there So we novmalize Ihe yelalfon as follows: The above velativn is nowin ANF and the selaton Is ONE as there ave no partiol functional dependncies and the xelation is also ip _2NF_as there_ave_no toungitive dependencies. Noxmalfsaton of Bus en Tn_this velation the values in each colunon ove atomée go ftfs alveady. In INF te Th the Bus_enbt by. Buanot se semviceno fs the rey kup. There exists following partial dependencies» Noo seals itd |_The_above velation. fs_aNF. And all columns directly dipendl_— —2b- primony key, So there. #.no. beansibive clependiney and the telaton fs 3Np. 3 Bus - Butho AP 55S APD | APADA APES) APSE30 SOUVE | Lestinatton| S>pk ttyd tye} de ptime 4/0000 10:00:15 4:00.00 non Ac 4.40/00 nonhc 4.00:00 met Date: Page No:_|2- Name of the Experiment: Nosmaltzation of Ticket entity $ fh_this velatton the values in each column are atomic so ft soit fs alveady fn_ INF. Tp the above velation theve ave.no paxtiol functional dependencies so the relation Is in 2NF- Ihe ticket entity might face the. following bransitive dependency Ticket no-—~ cotcond. Catcard --— amount. So the xelation ts in SNP Put the cakcasd and amount atbsibutioh foa a. seposa table. Then the elation showld kein 3NPe | __ The above xelatmn aNEas we bave elfmfnalid the transitive nn Normalisation of ticket entity i ee + ; Source |Pestinalion) scatno Amounh.| cat 2010-¢-5 | q:00:00| Sspt | Hyd 5 % No c q ye | bo10-§-5 |to:00:15 | Spt Hyd 10 bid | $8 Yes 2010-6-15 | 00:00 | Myd | Sept 5 5 6 No 2010-6-18 | 4:30:00 | Hyd Supt aA i | 556m j2010--6 [4:00.00 | Hyd vif 18 Wr tes | Jt be a i Joudate i ‘ +] Caf | | LitkeIno, Toudat | Joutirne Amoun: {11} jpolo-6-5 }4:00.00 a6 No | }, 239% 2ojo-g-5 | 10:00:15 a¢; Yes | 2232 [2010-¢-15 | 4:00:00 $$ val | yay loo-g-16 |4*30:00 46 No | "2 Yes 4:00:00 | [= /2010-6-6 a 46 oe 4 6 % "72 Name of the Experiment: Tos Date: I2)I199 page no: $3 Tnctallation of Mysql and Prachicing DDL cornmands ana DML cornmands How to Install MySQL sexver5.! on windows. This ailicle poovides step-by-step installation quide fox MysaLsu1 Cox higher.) on Windows as a devolopment machtne . Other seleais of Mys@u should have sirnflay fnslallabrn procs Step #4 Povonload Mys@l 5.1 for Windows. You can download versivn 5+1 from this page Download Mysab 5.1 ov download the latest Mys@l version heve - For_oxthives of vasious My SQL veasions click here, Step #2 3. a Double dick the MSI tnstallextostask fostalling My SQL = You will go through. stup whard_so. iPs_fotoly simple - Jeust follow the | fnstallaton_Instauctions_shep by step. 1) Welcome. to the Setup Wixasd fox MyS@L Servi 5.1.Clict NexE f0_continucs | 2) Select aseti pe- Typreal complete , Custom - a Sele pcal ond click Newb. The default installation clivectony will be C+ \ Program files \ MyS@L\ MySQL Server 5.0\ 3) Ready to Install MysaL Mbs_veview lhe settings , click Inslall- Hf qou want to. change. —any.setbings , click [Back] button. JBIET Name of the Experiment: Date: Page No: _WY 0: 4)Installation_ to progsurs —_ 5) More _informatwn about Mys@L Enterprise Subscfption.. Ibfs_ step fs just an in foxmattnel step fos Mys@L Entexpsise Subscaiption.» Click the [¥love...] button tf you want to know move. Othexwfse.. click [Nexb’] to qo lo newt step, 6) Setup Wizard Corn pleted - Make sure. you have selected “Confique The Miys@l Server now’ checkbox ff you. went: bo_confiquie it after clicking Finish Eutlton. _Whal's _next_ a eee _MySQL5.4 pwovides an eosy-toure wizard to con fique MysaL | server instance. Nexk, were. going to qe- Hough detailed steps about MysS@L seav:fee_confiqusaston » See. How to conftgure MySQL server bel On Windows. ____ How to_confiquse. MyS@L seaver Sxl on Windows _Aftex_installing Mys@t 6.10n. Windows _, we will_necd to configuse it This_caticle provides step-by-step Mys@L sexvex 5-1 confiqusation -quide on Windows 0s a development bor. Lmulbiple versions of Mys@Lon the same box, cea thisCorticle Howto_install two.different versions oF | MySQL On the same. compiles, fav move. info. |_4. Stawt MySQL sexver_Instance Configuration Wizard» PF you have selected the checklaox configquse the Mays L Server now" in the last step when fnstalting My S@L 6.1 the config uration — _witoad should stort automatically when you clict the Finish button. JBIET Name of the Experiment: Date: Page No: _V5_ os Altesnatively youcan launch the wixord from staxt menu - Staat > Progsams > Mysqu MySQL Sevver 5-1 MySQL Seaver Instance Config Wriasd. 2) Select Configuvatron lupe. Select Detailed Confiquaativn beve. Df this 1s the only My SQL server installed on qoux comput » you cap select Standad Confiquraton: 3) Select a. sexver type As this MySQL Sever fs sunning on a developmen! box, sekct -Develepes. Machine as. Ihe senver type- 4) Select the data base. Usage. : : Depends onthe purposeof your development box, you-can select | etther_Multffunctonal Database ox Transactional Database onl Hexe_we selected Transachtnal Database only» 5) Set Inno PB table spate settings. 4 TnpodB table type is the stowage engine for_a Pansactial databast | Use the default settings. heave» piers | 6) Set the antaan sogies aren ent connechons option » d-Online Hewe we ieee Toansachor Prveessing (OLTP)as (his te most 60 use of My SQL sevver co BE “a SQL sexver.on yeurclevelopmunt machine is ued fox decicion suppor such as dala warre bots cng ov deda mining, __selecl the fest option: JBIET Name of the Experiment, Date: Hage Noy 1. Set networking ophions « By clefault » nvake your selection Ihe same ad scree nghol below. Tf port 3306 has been wed by anolher fnslane of My scpl Seve, gow can select port 8307 ov wclifferent port. This will allow lwo Instances of MyS@L server lo be cecessed via diffesent ports on fie sane boN » 8) Select the defaull chasacler scl. default, tie Slandasd Characier sel ts selected s bul eu tra Wani to select dhe second ophvn~ Bes} suyapor! foo mull ngqualian This_allows or database Jo store tewl fn many differen) larquoge 4) Install My SQL sexes. as 0 Window service. Below Is Ihe _vecommended way fo aun MySQL serves on windows Making the | sevice name_as My SOL 5-4. cleanly iclenlifres Ihe Sed Vites cus a Es MySQL_sev vey _versivn 6.) database engine bacause you might | fostall_otles versions of MySQL. server on Ihe scume machine . You might also want to check. Include Bin Divecloay In Winclows PATH, if you want to_opaaty MySQL from command Une 9) Set the aol poss worel | Seka new password to Ihe wot account. Enter the same password fo all4fethy ee boxes, See below. Dont select te eveat an anonymous Aceounk checkbox. This caw _Jead_fo_an insecure system JBIET Name of the Experiments Date: _ _page No: Vl I) Ready to execete Me configquaalton . Now ¢ very Ihing Ww veady lo execute . Click [Execute] bullon. Bie Config wradnon successfully compleleds ‘Ihe confiquaativn file has been created successfully. Click [Tinish’} to close Ihc wizard. Happy Config wing | a AO y jouer Name of the Experiment Date: Page No: _ 8 (sean of databases : mysql » show clalabeucs s teoo2----------4+ | Database | to----- ---- -- -4 | informatyn schema | | mysql | | best | 3 xs Inset Co: 04sec) mysql zcveal database gsoupa;— Quay Ok, ww affected (o.olsec,) mysql> use qsoup a5. a Datahoox.. changed, a Creation of _babluys—_____ mysql 2cveak. table upamem (wll n0_numeric (10)> name varchall JBIET Name of the Experiment: Date: Page No: _l4 tomar tH------ to--+--4+---=4+--4+ | Fietd | Type { Nall | Keg | Default | Extra | | tolloo | decimal Cio.0) | Yes | | wow | | [name | voachas (5) | ves | | mow | | { phone | decimal (io,o9! yes | | maw | | | branch | Yarchax Coy | yes | | now | | 4o----t-- ----- +--+ --4+--- t- oF 4 mows In set (0.03 sec) Nlextog-the table ae mysql 7ofter table. groupamen add a. gendes cha (3: —Quiry- OK,.0 rows affected.Co.36 sec) | Records +O Dupltcatio +s O.Wornings +0 male gpoocapamenn $ Trea “i Type a [Nua | Key | Default eviva | | [retire | deeirmalcooyl yess | oT wou TO | Name — | varchas Ch yes | / | No | | F | phone fame | [uu ll | |__| Beanch eros) | yes | | so | | _| Gender | chaaca) | Yes | J now | | a } JeIET Name of the Experiment: Date: Page No: _20 Deopping the table : mysql> cxeal table dd Cname varchar (10)) + Quay OK, Ovows affected Co.09 ¢ec) mysql > show tables j __2 wows in set COco0see) — mysql 7 daop tabi dds Query ok, O-rws affected Co-06seed Dropping the databaxe to | mysql zcreal. database_dbl_s tl Quay _OK..4 vows -affected co.0lsec) ) lipformatwn_ schema | | dbl | Jl qeura | | mysql I | test | JBIET Name of the Experiment Date: Page No: 21 Govws I sel (O-olsec) mysql 7 davp delabase dbl + Quay OK, O avws affecled Cocosecd mysql 7 show databases $ p—--= =~ | | Dalabase | fe ne _ of | infoomalron. scherna | | groupe | | mysq) } | lest | em nips smragrennenin ate 5 avs in sel Co-00sce). Rename the labls < mysql ysename lable grouypamenn lo gas Quay Ok, 0 vous affected (o-03sec)- my sqly show lables 3 f= thsert into ga values (INL, ‘vam’, 4¢65321456,mbbs’, J Quay OK, tw affected Co-o6sec) - mysql> select * from gas +o -—t--+4--—--- po $----F+ | wllno | name | phone | branch | I gendes | TU Tram | qee53aiase [ mbbs | m | pose 4S 5 S5= +a Safa t 41 wow in set (o.0lsec)- mysql > Fruncak lable go. s Query OK, Lave affected Lo-04sec) mysql_z Sle og - Empty-stl O sce). JBIET Name of the Experiment: Date: Page No: 33 _ Cxeakion of table for Roadway Travels : Bus ¢ mysql> cveats labu bus 555 (bus no vax chax (lo 1 busty pe. varchas (10), Primany key (bus no))s Ourry OK, Owws affected Coui7secy Tfcket + mysql > cveaty tab Hicker 555 Ctfe—no numberie (10), joudate dat. ,souvce vaxchar-Clo) , dest varchax Cio) ,deptimme time » veallime time, busnumbu_vaxchox Cio), Pamang key (hero) } Dury Ok, Orns affected lo.0¢sec) mysql> olbery tablu tickel-565_add constraint tick foreign key Cus. numb) references bus 555 (busno) 5 Quer. OK» Orvis affected. Co-lesec) Records +0 Duplicatis +0 Wasnings + Pt Pastenger 2 mysql > cveabe table. passenger Cprrcno_numeric (0), henuumbe. numeri c.C0), phame vorcbarCi5).. age ink C4), texchas (io), |ppno_vaschas( 16), prt -key Cpnvned) 5 Quy Ok, ws affected Se mgs) alex tabi. pos sengoreclel constraint pas.ik foreign key (Hie purnber) before veferenus ticket 555 (hic_ne) + Quy Ok, O was affected Cool s6ec) Recovds:0 Duplicals :0 Warnings +0 L JBIET Name of the Experiment: Date: Page No: 244 Resewve mysql 7 crea table veseave Cpnenumbes numeric Cio)» noofseats int(@), addyess vowchow (50) , phno numeric C10), status chowl 3); Quy OK» 0 wows affected Co.lbsec) mysq) z alter table veserve edd constvaint res_tk foveignkuy Cpnvnumbe) vefewences pasicnger (primo) + Quay Ok, Ovows affected CO-ITsec) * Recowdls +0. Duplicalis :0 Wasnings 10 Cancel mysql 2ortatly table cancel Up number numeric Cio), noofseats _int(s), addvess veurchax (50)_,phno numeric Go), stabs chas()) pang OK,_0 wows _affected.Co.06 see.) JBIET CE EEEEEEEEES'S'S*S a Name of the Experiment: Date: Page No:_96 Practicing DML commands ¢ DML commands ave uscel for mance schema objects. Use of dnsext command ¢ Inseating Valuss into Bus lable s niysql 7 Insert into bus 555 vellues (‘aps5s’,'ac’)s Quy Ok, 1 ww affected co.03sec) mysql > insevt into bus 555 Values C'opips’, ac): Quay Ok, Lrow affected (0.03 sec) 479 data within the mysql > inset into bus 555 Values (‘ap 4¢44?,tnonac’); Ounry OK, A vow affected C-08se¢.) ‘ mysql2 Insert Info. bus 555 values Capsqu’.“nonac’); | Quiry OK, 4 veo affected! Co-03sec) sa -mnysq)-7 fnsexb_into bus.556_valurs (‘aps630’,‘meto'): Quay OK, Ar0w affected (0-036er) inserting. valtues fnto_ Ticket table + nugsql 7 ipseat into bcket 555 values (1u1,‘2010-0§-05?, spt’, ‘hyd’, £09400 105’,' 19:15:00", 'aps55”) 5 Z Qury OK. 41. mw affected L mysql> insert tnlo_Veket555 Values (2222, 2010-09-05", ‘sv pl”, ‘hyd’, § 10003057, '20;15 :00', ‘apsol’) ; Quay ok, Frow affected Cooasec) mysql> insert into bickel556 values (3333, 2010-08-15’, ‘bye’, “sypt’, ‘04! 60305”, ‘20715:007, ‘ap444’) ; Se.) JBIET Name of the Experiment: Date: Page No: _26 OK, LW affected (0.03sec) mysqly insest into lickets55 values (4444 ‘2010-08-18’, yet _'sypt?, 04 .430:05’,'20315 +00’, ‘aps4l”) 5 Quy Ok, Low affected (0-035ec) mysql insert toto. Hicket 596 valu (5555,'2010-08-8" ‘hyd, ‘vif’, ‘04510505’, ‘22.315 700", ‘apse3o’)s Gury Ok» 1 vow affected Co-03sec). Thseating. values Into Passenguc table ¢ sql>_Inseak nto passcnge. valuus (1001 ,11L))'Subbu a1 S, ‘ppsee “Quayok, 1010 affected (o-05sec)_ _ mysql» fnsert into. passenger. val Juxs (1002,929, achaith’, 22, ‘ro, pperac}; OK, 1 ww affected Co-ossec) mnysol> insert fnto. passenger. ‘yolues(io03, 2393," ‘padma’, 25, °F. ps2) _Quisy Ok, 170 affectedl_Co-055ec) —__ _ mnysq) > inset into posing. veils (1004, +4.44-.covi’, 23, 'm) ‘pptag ) - Quay OK» _tysq.12 insext into pasta nhs 5555, ‘nicerals 42,'F ppbee)s —Ousy-0 k,tvow afferted (o-o3sec), Shserting-valoes Into_wesexve table @ mysql zinsexk agate values (001,"10,‘hn036-4.Stpb nig’, 44425062825 yon) 5 Fees - — Quny OK, 4-rw affected Co-o5sec.) . mysql> Insert inbo resevve values (1001, 5, ‘bnos 5-4.sept, me = 1442506287... "Yes’)s 7 JBIET Name of the Experiment: Date: Page No: 21 Quiny Ok, 4 v0 affected Co.08sec) nuysq! 7 Insert into veserve valucs (1002, 5, “bno < 15-4 slbngy, hyd’, 441653714 ,“yos?) QuayOk, 1 ww affected (oolsec) mysql> insert into reserve values (1003, 6,"bno + ISI 4,dsn7, hyd’, 4404613141, “yes?)s Quay Ok, Lavw affected (0-035¢e) mysql 7 Insert Info sesesvevalurs (loo4, @,‘bno : 1I-4, dsny,hyd OMG I3IIi 5 yes’) 5 Quay OK, 4-ww_ affected (9-0r5ec)- mysql 7insext into resexved values (1005, &, ‘hnos 41-4 dsr, hyd, 99245031, ‘no!)5 _ Gury OK, 4 vw affected (.0-03sec): mysql. 2 Insewt into -vesesve values (1005 151 hos 41-4", ds hydl, 198 950311. tyr )s pant _ —Quy-0k, tow affected ( 0-02s00)- 7 mysql > insert into reseove values (1002 ,5,*hno: 15-4 slbrgs sbycl’ -_949.1653714., “yes? Quay Ok, tavwaffect mysq) y ie esem ralusa fonds f,‘booall-pudenabyd, A046 13151, yoo") 5. — Quasy Of , 1-ww affected (0-038ec)- — mysql 7 insest into reserve values (1004, g1‘hno «ll-4.dsrrs hyd), AIO GIBINI > “Yyes')s JBIET Name of the Experiment: : Date: Page No: _2@_ QuuyOk, Ievw affected Co-07sec) mysql > Insert Into -veseave values (1005, %, ‘hho + 41-4... dsr, bya 4464503111 , no’) s Quuyok, tw affected Co-o3sec) mysql 7 Insext into vesexve values (1005,5,‘hno: 41-4, dsny, hyd’, 9989503111 , ‘ges’ Quiay OK, Leow affected Co.asec}. Tnseating values fnto_cancel table s roxysqyl zInsert into cancel values (tool ,5, ‘ho: 5 ~4,St pb, nig’, 4499506282. ayes) 5 - Quay OK, Aw affected Co.ossec). —mysql2_insext. fpto_cancd Values (1001, 2,{hno+ 5=4..S7pb, nla’, PK —44-92506989., yes") 5 ee Oury ok, 1 sow affected Co.casec). mysql 2 insext into cancel values (1002,2,'hn0 15=4.lbngs hyd’, 4491653714. Sho), Quy ok, 41 vow affected (0-05 see) = _ mysql > insext info cancel values (10032, ‘hnos Isl-4 dsm bya’, - 9704613151, *4es') cted (o.01Sec)- Qussy- 0 — mysql 7 insésb inko_cancl vile (loo4.,5,‘hno + Il-4.,.dsm, bya’, AIOLGIBILI »' yoo’) Qusry Ok, t20w affected Coo3sec) JBIET Name of the Experiment: Date: Page No: 24 mysql 7 Inset into cancel values (1005, 4,"pn0s 41-4.,dsnx hyd’ 4484503111 , “ycs') 5 Quoy Ok 1 mw affected (O-03sec). Use of select command + mysql> Select * favrn bus 555 ; J ap444 | nonac | ( || apes | ac I — |_| ap 8630 | meto | a | apsa! | bonac | — - muy sql 2 -select * from_ticket 555 ¢ $o--}+- --= —+= -4+—- -+— — + — —+-- [tic_no | joudat. | sowsce | dest | deptime | vealtine | busnu +——_+- ++ ae - 1 - 1A 1006-08-05 | 2222 | 2010: 13333, | 2010<¢ | 4444-[2010-08-18 | hyd | sept [04:30:05 |20s15+00 | apsal | 5555 | 2010-08-08 | hyd | vey Joasii05 [22:15:00 | apss30_ | tt JBIET Name of the Experiment: Date: PageNo:_30_ 5 wows_in_set Co-00sec.) seb Co-04sec) mysql 7 select * From passenger 5 \ | 31 | m | ppsss | !002 | 2292 | achaith | 22 | m Ippss20] I | 3333 | padmal 25 | f /pp2a3l | 4444 | vari | 23 | m Ippate| 1005 5 pisma| 42 | F |ppsss.| oss_| phima| oF lee} 5 yous _in sek (0-03sec)- _ mysql» celect ® From weserve 3 _ | prenumber |noof seats] address. | phno | stectus | $$ +} lor | ~ [nos 5 4 ‘sph praoscees [ye | | !oo1 | 5 [boos 5-4, eephmlg [etenasoceal ys | (00> | 5 5 _|mo:t5-4, Teg hye [vu [ys | | 1903 | 6 __ [host Is vary frroaisa ia - re a a 4, dsonbyd leass0a | ro| | 1005 - 5 |hros a, demeshyel HSA | ys] ‘Tmws_in set Co.02sec). JoIET Date:__Page No:_BI__ Name of the Experiment: mysql >_select_*from cancels - tee Sh se reer shy ol meen soreness a shes ore prraumber | _noof seats | address | phno | status | —— pt | 100) T 5 4, pling [auarsoe2sr| ys | | tool loo 4, sep nlg [auqrsoesr| ye | { wor | 2 | hnos -4, longs, hyd | 1441653714 | | | !003 loo | bno: 151-4, ding, hyd [4704613151 | yo | | ou | 5 [hno: Ue dsnvshyd |Atoge13ii | yor | | loos 4 hho + 4i-4. dsrre, hy | 99eq503r11 | yoo fa tn Sh eg eT | 6 wus In seé(o.o0sec) = _ Use of updaf command mysql update passenger set ppno> * ppess’whexe porno: [00] 5_ — Quy Ok, Lwow affected Coeo3sec) —__ Rows matched: 4 we changed + A warknings :0. =| Useof Delete commands nysqlz delet. froro cancel where status =‘no’s —Quiny OK, tw offected (0-09sec) musa 2 select * frorn_cancel_s + ~ [ho Ansxpbnlg | Faugnsoe3s> | ye _ | bro: esaLstpbinig [44 [auas0s259. | yes n bt L | 10 loo I | 1003 Foo sn hyd | A7oy6i315) | yo | | so04 | os [bro : li-4, deny, vbyd laro4eian | yes | | tos [| 4 bnosai-p,clenhyal aasasesin | ys | | toos Lt [moi atadendyalaacasosin | yee | 6 wvws IT Sel (0-006er ) yout name othe Eerment:_EXpeafment=—6. owe: AQLtI}2- a 4: Display mysql> sel [pmo lO” | 1002 | too I jooy lioos | —4-— + 5 mows Tn a. Dipl mysql> se 4o---+ tort | eoo-t | pname Quesying Th this week. Yyou ave going to pracher the queries Calong with subqueries) using ANY, ALL, IN, EXISTS , NOT EXISTS, UNION, INTERSECT, Constaainis etc. Practice the following queries & unique PNR_no of all passengess. ect distinct pnano fxm passenger j set (o.01sec) 7 all thenames of male passengers.» ect phame- from passenger whee sex = ‘m', 32 w0WS in set Co-o0sec). Page No: _82- oer Hane ft Cypermene Date; paep os 2 2, Display Lickel murnbens and names of all the passengers. taysgl7 selec tie. no, prarne Feorn lickeL596L, pamengur p where lie-no + p. Licnutobe, 3 I ' I | Lieno | pnosme | liiit | subbu. | achoith | padtno, | rovi | | 5555 | horn apenas 5 rows fn sel (0-005¢C). 4o Find the Hickel number eF passengas whose name staat with "Rand ends with ‘H', taysql 7 select tic-no Foor ticket 555 whewe tic_no = any (select {fe_numbexr frorn poveenges wheve pnarne like ‘rxh'); + + ed ae 5. Vind the name of patengads whose. age Is between 3oand 45 roysql select pname favin passenger where age belween3oard 45 your Name of the Experiment: Date: Page No: _34Y, f---—- 20ws In set Co-oosec) 6. Display al the passcngess ncumes beginning with ‘n’, mysql> select all_ pname from passenger where pname like ‘ays | pname | | subbu | lachattn | +. > sous Inset (o.00see). = 1. Display the. conted et: of passeogss. name, select _pname From. passenger onder by pname + eoee==t aces etencnecceasnmteam fpnarie | == tsubbu 1 achaith | _ - __| nitma et é.. a | —— _ Kx Po ce J ee Aw Ss 5 wows th set (o-02sec). yorer iE EY Nome the experiment: _EXpeximenb- 7 vate: 18 |p2}29- page No: 35 z You aure-qoing-to practie the queries using Aggregate functions CCOONT, SOM, AVG, MAX and MIN), Qxoup BY, HAVING AND Creation of Views. £. Wrifba query to dfsplay the information present in the Paxsengoy and Cancelledton tables. mysql x select pnrno from pouscengey union select pnsnumbes from Cand ¢ tee

You might also like