You are on page 1of 46
S8SOee ®w FER CunrreR-2 + MySQL My SQL iw wa DBMS ion sanagentnt Aylin) whch ve Pretty awvailatie and dpenadh dourre-l poporrarr + BASIC texms ; ———— Bata: The paw infetmorbirw slaeal in a dabelrast -. Patebire: Orpanied collection of data in colle! dalatose» Dbns: A coptvare vohuily dat dn thee dando DMS (Relate! Bateau Hanagenent Ayn): A aafionne while managed etal in a database ADVANTAGES: Reduces data redundancy » Mars the data Art the Aate - validate the date + Masictacy cong raaniprclite the data - herile pecurily tthe 4 Aadonlanse- Tyres OF OF bata Mobets: Nerwere D Darr, m Mabel: | dn. Leis tae model, sites Mee whe sepatsd We Oerecr ORientep Dara Mover: dn thin date model, the date WLLL be represented bu the pone abyect Cosricr : ty abject i a Atal barre. arlity, with dumiter, prepests and commen bharteurs ~ Scanned with CamScanner gaecHiAL Dara Monet ; —— 6 ieee dy thcs data model, data wall W he Aeprtsented iw Uh fom af hee ij 0 RELATIONAL Dara Mopec: fy tata DARA mroster abr Reprtecnted iw Ute fours ef : arlatcons - Hinbles ot N ROBMS : basic Teeminecegy? In aoe Ue called notation - fewaTion: A table ew a ue tect ftsare A neeond AoW Or Adlabirnabacp ae dn nell © ArrRiBuTE « Coluawn | Fill - iw o helatren aS i peqeee : No- 4 tolumns inv arctan Caroimacity : No- ive Rey [Cusioate Key «Me Abathales which vill here Pda ton are sonteite vases Baye”: piled will hawt unagues An ettridate- © A table can b ite primary Ke O) frinney Key 3 ie ee sceond pene pain key - © Auresiare ey Tp sna ng see wt ST pin | 0 basi bey Pi teed which oleniires Pre calues Prom | pnlgne? key oh tLe 4 qb fe 4 preter false bo the pawl tolde % pews tuple iv a relator . An abttrilecte On cembyinakion + | a Fret a wougue- values in each Scanned with CamScanner Avery: A qusy it a qu retriene Yatata ov Lhe Git Contes “He fubtoseig Jaile 'SUDENT ' dra anreser, teow on aburclion Be More py dalalase - ithe fottovsing question : | Smasko HING | Adee: no. L i iq fe | an | 18 lor 4nn a 103 | 43 | a0 104 an4 ex * Canbinalitey =4 » & Edertify te filer which me mag ek M0 the a hey ? 5 | St-£D, HINO. , Adnan la- la- 4p dae HMO. ald uh het to Ae Sy promyy Bip Se TD, Adin no: | eet canned with CamScanner © S9ee8°2 S CONSTRAINTS | lmabraeinte are tted to apecify ule or the dake iv fale «dt tan be smecifiid when the Aakle i created ov aftr the Tale Ls treated - TYPES OF ConsTRAINTS | — Nor NULL Darren oe khank pyet 7 NoT NULL 2h Constraint whiels dace met alle mut value tb rust pentouy some value . \ ) \ | Primary Key: An abtrthute tohicl UslL hove Lurigue value in tach Hod» fh table dan howe ory nes tinique key: An attilarte on Comlinalrow & attributes ghee wohl home prune | rate iy tach, how) + fasign AE Am abba wheely derives Hhe values prev unigue per bg atinute of onothen CHECK CousrRaINT : Whiele A Led to dleck the sanctions tut ib ip dhe comaitinn in dre, only then the valac wd be allewed to tener in Scanned with CamScanner _| f# ee oe : DeeweT Rowsrenint | Weed te Ht daft bi | jMyspe Etensens buemenrs: f) Liltrals 4 @ Rata type, (I) | Lireeacs : bn general, Bowl nef we ined. dake valued + are i] boner Big, Ulead ii) Jhactoinad (eras i )ehing rely iu)| Neale Literate ¥) Ante btisate ViJine Uterele i) Numeric Uterals : Malia. | enn bil Mo ei les tts = 50.5 -20 _ bow alt “ole? 1500 ones loo | a i) |Practionsl liberals : Valid = | Pm al 123 (2.3 5-600 so ~< Ign, 00. fa,000 200 a 20-FA Scanned with CamScanner Stuy literals ; Coliectin of charactors enclased volt seigle on doulde. quotes calied wang Litesale- dura Lid quotes N= Vab'el ol on 123 ‘abe’ “abe 7 Vayyi230" Vagina" Nabe" “abe Nut teberals ¢ PoseValk nl - Nutt Mnuee! null “null” bote irale : : 7 4 yy i . ’ ) format Yyyyomm = DDB, Valid LS devil 2014 JoF] 10” 2019 {07/10 ( % japoafaery Hor 09-107 ‘to foo [157 Scanned with CamScanner x Nine eabemvact liberals " HMMs gg or “Hitcmm 6" Valid Macstirg” “irisor se” DATA “Tres: Dada types mre used to fislole Numeric DATA TyPes- ting ot mau int beg at ‘medion tnt ut + | Eeactionac. DATA TY IES: Ploat |pecimat Doulse SaARING DATA Ty Pe char varchar - Cie ie Deporerg a0 leony agit i e ef ae hone * varthas /foed . wehar — A youselse paises a r be a long dwwalid IL: 9:06 S12 .s9:37 He cd ito apa, sa tag te WW) DATE DATA TYPE e4-Ddloj date O date @ tine Adate should be wartter " , “ gram 3D oe aa 37 4 “yet sot! t0" re tine - irtorsta” langtt sib ga charnckers . rn te not Tved . din ae Retautk charl 10) Spoor between ete 165 eharacters + bi. hem crendg a Scanned with CamScanner O| 7 @ Qs oS6E5s8 CHAK. | VARCHAR Fined lec OD Vamotle Le shing type: sowg type . deponing len gle oO befuuing lenght Leal iy orate Sie “(no defo. hae @ Heuser thaw Oph. fx fost “a geder thar 0 ie varchar (100). Rte A Sf the value is shorter gues og | Calg lurgbl, blanks will planks will be oulded - be added - MySet CamMAND S A} 4 on commancle ULecl i - qk provides many Types feommanss it fo sige -E punpeee- Mysau Comets Ar matinby david: Gts 4 byes Doe (Bata Bepinitrer danguage) [- DML (data Uanpalrtion puoge) ee per (Data Control darquoge) Dou_cemmanits © . a dhe DOL commands ane wed bo, depire the datahaw tructunt. of our fawle Thre comments ant CREATE / ALTER, DR or, TRUNCATE RENAME . ©] doe coment « ss bo fom dade monies Lanting; madifying. »Aebaindig Ch date aorad Om % Scanned with CamScanner | thee Commanct are INSERT DELETE, UPD Ay SELECT. TE and @ | 1K commante fycarands Thal allow wt by banter and contref Transaction - bre A Tanaachinns He Lomplale wit sooak, invelring : Compaanald ante tebe pac BACK SAVEPOINT + y | eases DDL_ComManns fename | CREATE command : | Si aa ancl tables - datadonie | ‘Yo Ckeate bevtnehe: ¢ | SYNTAX 2 i CREATE DATABAS| baci? CREATE DATABASE XAT 2019-20 5 e paTacaseXi® 5 Ty SHow DATABASES t Syntax + SHOW DATABASES; To CHANGE pacnsnse- tbo OF Hes Barat) Synrax + USE DATABASENAME 5 LG: Use KIA 2219-20 5 fo CREATE ‘TABLE | lon, CREATE TABLE STUDENT (sca ut (3)_ Perry Req, Sname. varchar (20)NOrNULL, Sctass itz) , Smarb ot () Scanned with CamScanner Ao} date) j Example -2& > Weire A MyS@l TA BLE SPAYMENT voktose Riva. rumor dnlayer fe numbe| vanchor date Paggmend dole, Laps on CkeATE TABLE Pay MENT ule ‘field name. | DATA Tyre] umber varchaal 9), fagreuat date, Niue Wil) any G9 aw) .cae I Jatnique bey jad no varchar (5) nique Key, Comment FoR exeartng & graucTure is GIVEN BELO: ‘Size Constraint 4 Praag key 3 g “an malin GLE Ping Kay Peyrroat Pasprninde ake vateg Waite MYSOL a table ‘STORES where i Lelew- Abucture 4 Cc. Copier ener Profit Create TABLE sTeRes (see yarchar{ loo) Gapitolameunt ‘Pow Fheld name | Date 4ypPt brainl Store — name varchar Primary key Address varchar fiom (42), ar (20) Primary key, Aderess name varch Profit float (5, »)) ; 95 Scanned with camscanner reget {lel name | Dadatyre ~ Conbmunt emp rd varchar Peas Y hey Emp~ hame- | Varela 20 Wot nil ~ des. gata varchar 30 falary ot! é Dob Date Date dej, (29) wot uy vorelor (39), Gotary ilo) » dee date, oloj cate) 5 { White a MySQL Command to create the tale velsele voltl Traale bam tunayee (impr d vacate) Putty Hip fanp-nomee vanckan ; gem conviacrl : Field name Datatype Sige Combraink yes A varthar (10) to, i Prurary by Reyadake, date Owner yarchar (29) 28 Address varchar (40) 40 Creare TABLE VENICE (Bp—no- varchar (10) Pinang Ee, tegedate date, Quoner varchar (10), Address varchar (ue)) 3 Auten Tree Commanio ’ 4h Ga DDL command whe Ge uted to moctify bre bbueluae op a tale lite rg 2 Koln, charge the fiehd mame deletion co folama, modify He datatype sige ef a (field yading hemoning constrar Scanned with CamScanner \al ~ Synita 8 Auter bable atop (ay) fomerangs i tole ——name- add column Column name LoiTH DATATYPE Cwrite Aw SQe QuERy' to #OD A COLUMAL GENDER. : J AND SiZeé cnar(l) ) SYNTAX’ Alter fhille student odd column gender char (1) 5 or any i Weire Mysac Sraement To Koo A Fie Name Apneess4 © With DATATE fino size AS vaecHAR 4d)’ Poe Thee Emevoyee: SynTAX, : payee add column, adolress (rarchar (uo) ; Alter tale ery Ql seeped FREE query TO 90 A QBeb FIELO ATATY PE AN < aide ghudent owAd estaniy Poe Jk + Z write kh MyS named poe ITH P Alter Th dete the column | Syntax: Aller tebe Conte ree Column Column— name 5 A Wire A ys! Speen TO DELETE He Columy AdDRE SS Peon THEFABLE STUDENT Alli ale stad duvp column — adllrers j Ay weire precoky IN EMPLoyee tele: Ain tale trnply e dap Bret Prooeie & mysar To deere THE COLUMN Srvoenr TRELE ! ‘ AMer dade, SFVDENT a Luu. , : op col in dole 5 Scanned with CamScanner Amysan Lmann' to pecere Column tate per C7 Doh = PROm tHE To CHANGE CoLuNN Nane: i Alter table falle name change old nance, ned — Kane, datatype (sige) conibraink 5 fle Wule Sot Command “ta Range dob to a welll ’ datatype dale ty slhidint Wee; ae - Mies tale Student change dob birthday date 5 a a pes omen "bo cates shi thts Us She pt C30) es tae cope Vhnge cngerp DL RLU TIn To Moviey Dee a G Racdatypes auld fle te © Ponte m myiae 408i Wucdent . , eee. (ia) vg Betatgpe | Char (1 A Aident modify Sid ade char (10) 5 rear taller 2s [a Walle a MyS@C pote ange Alge of fs Srame to! 50 bP Shudlent table! Altes tale “shidenb modify Snante vrchor (oy a7 a: Tp add & censtrain€ nok nud! te He fd Smarks 6, of tote Sheet! £3) nek marks tnt (3) he Aller Fe ore ae Srame- Smarts nol 5 , : —— Scanned with CamScanner \a uM aq -To delete a mpbemcteonstraint fied BES from shadent falhe! Alte falle Stadent modify “Std char Ce) 5 5: To delete a pore pladent- talale } Miter ae Shuenk mal'fy bi Yoadd & Contbraint Un unique Reg taule! pips tae, sradene fy La constraul fied sid frm Sid char (10) 5 fidd ‘sid bf Museat 4 Bid edoalio) Unique keg 5 Pie, ek pny ey iL | hi! Alfie (alle. table rome add pritiarg bey (eolinn rene.) a ad pinay hey tthe. fold cod: Tap he pipe tole: AU tole ormplegee Add pews by ~code); Lo daep 0. primacy Rep’ ova it tak diag peenag Hy 5 1] Auee dahl Aesdent rap premauy bey , Alter tele dele—rome bo hap vencqure hey eansbraint + “auap consbainl cowhrectnont “Mtn toble table name — ended. Masigne ky (fu namoy wef “Ace bile atlent dap cider ne by O4; Lo perane He dalle name they tulle tible- rame serame te neo table name; eT yange ce uted oly ei names, While modify has Scanned with CamScanner 7 Mtr bie shedent Aemance Ge td Renae: fl ae a DDL tomman4 Wted lo Atramo the tile ham fre dle wd to Abudenk + Ch Berane Me oUl-name to ' head-ranse); L eumenre Sth mpd Yb wb a DIL Command used of a tale but nek a shuctune » to delete oll the neewde SYNTAX 3, : vywts to delete aclable v with, by Aauctort torte 2MYSAL ‘yh Awe tle Worary 3 Scanned with CamScanner 52 4 RErERENTIAL Tnregeation : [Foreign Key] cs . eve rules that a DBMS uses to rant ne i t pecends iy Aebated ber on ore i a iy fe meter fame 0 phoma tele, a primary sin ms png near iee joe muse obs FS ven serene obey + foment, male” beng the fou Hey we commat odd badd the data , i i WOT taal piy 5 ip that) Ant did rel eal fia wd ef mort tole alles : PRoouer ard custeme Re fo the. * freate the faseuey® ‘ fouawroy Spe 1 ake | datatpe on) | Care| as |< ae yo | thal} baigue ket] motel dawle(S/+) a as, varchar 20) nok nud - Pangan vancher(>4) : ee Solero a Scanned with CamScanner fi chonl Re he 1 De ae () Tore product: 1 reate dacel (Product 1d Oar(s) une Rost doudle (512) pot mua, Create ake potict (Reet en ee tents) O Table customer! \ Create tale canstomen(teode chan(?) prtmrary buy, cannes varchar (20), Pid Uter (3), Foreign Cord ) references product ral) 3 mall ul “DML COMMANDS 2 ae These S@t command used fox sewing, netvigning lelet iy and modifying ata they are: INSERT, SELECT, DV sdlere, and UPoATe * a Insert ComMAND: de uc a DML command ured to odd insert oA dtow svcorde bo the a table - \ SYNTAX = tueceT Puro Taare Name Vaues (Valy, vals, Vals.) 5 | jo |Whute 0» MYSQL query te add foteaing acends te the Jide ‘STUDENT! : a Lot, "Sai", 1, 99/122, “Ato "ore ]o4frc | 9 Irs into Sladent values(tot,"sai' 11,3, 123,"Aa1004 "sasfoype's =| Waite a MYSQL feury te add the feowing pecords te the Loble “fmployee 202," Rega "Computer", 2e-00,"194 JJo4]o2” Scanned with CamScanner \ desert into beaplagee values (*2d2," Palpa Scompuber | brea, “Yago[ 04] 02" )5 faaneriee ; "My — \ ° Jrrt ute dideat values’ (vot,s"wiasee 94,128, “too” orf’) fon," Virwele”, H, 98, 129,"Av0r", “sau fox] 09 ", f03/Shrmate' 11, 96,12,0, I gg09, "200g lor/o9 ) F lou, SShtikant', 11,95; 1g), "103" "ae pir"), Ww Joss) “Shree, 11, 45, 132.,"Alo4!, “z0ps/ot]ia PN Je ig a DML Command wxecl"to hetuuve Ht Me, py tre olatabane A qreny ead te ON ape fl fem te fal “bide Synrax = Lalumn nancy seelname, » ol nome, fume | feluck cobrettr os . bulecname + [nee Siflon Sandor Condit 2 - - - Jloxoer ey Coumn cist) Have geout ey coum’ dist] [Having came’). Empcoyee eaepanimext © Sali yea Computer dave ae Phyace soe i lew A m Ty0- 12-05 Scanned with CamScanner oe * To Setect Au THe Data: - - — Lhe Ainsplat foo of select abies 2 A table. We just need te epocify lalate) Sy the kelected Lis + dy Lo dicplag au te date of emplgue tate: Select we PROM EMPLOYEE j tra~ da dhipleg al the data if tladenk table: SELECT & Reom, STUDENT fu -3- Le dlasplay all the ota of dado bu tester, | tate : | Setecr + FRom TEACHERS 5 a tS | . Sececr In Srectere. Rows: Age kaw selret porbreulan dow a dole bey apy ~og fiitteurg denclictice Ehuuph we whine fhe elect wale i / : ee gs play he once of ott roe AA PROM Em ployee Lohere gerne F's Ourtut : Cname Sar domme a display empl name and delay UL employees whose palrry Ue more than oA Ogres te 40,000. : SELECT thame,esalary from employee cuhere esal >=24,000; Oureut - © Game eaittay- Sai “20,000 \ raving °} 40,000 ry 26,000 Scanned with CamScanner mames of OU the ospligers cabs oly! ne igre te for: form. empleyee where. edofe' "Laisfos lor”, Select ename wy Same anesh frwrod oD tt vf out tha aplrpess Arvample We Jo. bug dae fomputin ov bys « pehee department us Setect enamey esatary from employee Where edepaaments nes! oR Neerroree” department * Compute R fot " Paysics” | Cece % Prom Emeroves vnene Coe mermenr> uo GeNben =H RE edepertment salary dsj jee Qutput + erode g Tepes \sjo-00 7 igsifoj Ml re a tye latcpyfio M er et Prope Jo,o00 |4efinjos Me ORDER By CTRL ZE This clause» waed be amange the data vithon Ff ng crder The abe u feat to aucending ASK astzis “for ascending ten and dene | is for daseantang ender Scanned with CamScanner - Geeeearreeeeeeees eee eees ee eeeeseueteece wiitien, F fit luipleg “tee details i order of thet names. ' Arte Arrek + pom employer, shit by ename, 0505 secode| tname | elipartmeat| asada ete) [Verte, to4 Arrav-tnd Prypcer 90,000 impr Fi fo ee jeoo [Italo | gy ie a house U,oo0 farefujio M los dias Computer | 26,000 Poorforfos | F 101 Awi Computr. | zero [innjafer | F fq e % Hapty names 4 a the cnplagers ty ther dueenleny ode Hed, Kalani Acleet tname from employs, wider by esadeydlese 5 name esalary Aravind ered danni L600 fax acai Genes loro fo U,g0D . Jag -3- To oe ongponame and esalagh alk —_ » [fetek enane, eatery from emplager where porters" Pie etal Bse5 Crane | esabry | “Bopad [rr | \i6er | 4 | Agoura | 100 50,000 5 aD Praguct—name aye F, bpelmyrt agin to dis spect name, prize ph all the ide ie ‘eh Pee Te lax Le a t | botiet popiet nance ptige. from prygoct wth, vahert age SL! On ye* tte PPengert name, ree] tyeted [ e aie ‘ Apt Warning? £..:] Ko ere £t Scanned with CamScanner

You might also like