0% found this document useful (0 votes)
47 views

SQL Notes

sql data notes

Uploaded by

Deepak
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)
47 views

SQL Notes

sql data notes

Uploaded by

Deepak
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/ 19
Database |. De fig * FP collection of Arelaked pieces of data - i % Deli ane collacteot omel matin Eouts ef te neue — épeet fe lake -mamag ement” neacls . ¥ Eg: University DB. so oe i Cider, porculy ; cours es, — =, edn Counse nog Bolton 7 emsolln ent, 2. daka.: e ; ot rat collection of Tnkosmattion she a = : dofa A vidual 2B tne collectioo rag te com 2 nex 7! fro a stiuctued 7 egsbston C4 eer - \ singe a ee ye ton e ‘Scanned with CamScanner he coh DB: ) | % Te supports good ata Orcong Because : hoage Votume: of Soe Boied Ww one floce * Muuiple dace 0? aa ond most the dala at’ gore “fine ’ me reread . Sher m com Sortable, 40. Re So: be pond quick ond Sal A Ehtective data. Intqqae flow Gah? cupWeakes & nosmaline “are daka . & Controlling Red umelomey arad) So coneistency = * expect ve rer ony . momagemeot fosk maltos compen , menrry monage ree ~y Se ftandle. Ww DBMS, a object Fred entity jorss place Baough DB schema based on omy attnioute og dats. / deka -prorl &, % Wvebps fro Set tekaToual ¢ data based oom dered. att muteo/ * ACTD - atomicity, consGteney, Tsclati™, | Awrabiliy tp ensue eftident Transaction ert witheuk daka Couuption we ‘Scanned with CamScanner 5. Types of Nekvowk, ed Mamy ~ manny eee ues i> Relational - Relaticrship, “ohoen of Tables. we Object Oxnemted - supports oe oe neu datatypes , Bala > stored » Ro goaro OG ejects. Gap ieee yllmcthey catauctued | Quay hanguage ge Fe let Yod accos ond manipulate & A ee % * cotjection of ables vat Stores a apeditj-c ._ | atnuctiued, data” .. ee We column > Athr‘bukes . ost ae we : > ge. BD seed b Comequmisahe tain % de. Two mai pes o& PB: > seL > Nos@L.,. ‘Scanned with CamScanner Sar wo ee 7 “ t netertionet oth are Noy, ¥ they ore | : “d a. | a A they we SOL 4 | * ct amhemas wy. | wrowe predefined: . | : | Schema ® — \ontcertlyy scalole | * Berane, Gea, * they axe “Table | ® they ane document, Qhash asod . : y . koy -valire oy wide tolumn’ sb, Mysar » x ae WB widely, teed RDBMS | ko G bree. omd pen Bounce’ Rot Bb sdeal far Asotr amall 4 x Some commen RDBMe pak Use SQL ane + = CdAcrehe * Sybase, " Mictesott ser some, : Miaesoyt A oo Scanned with CamScanner Dalaly pes -ANy — Wbegen : . DECIMAL - Floating pomt Numbey , Dovsie - A long doubte- precision -floabing wate - Dake soamak . Yn MM-DD , Time - Thme fpamak HHI MM? SS DATETIME - wety-MM-FP aan MM sss svimestpMp - autermnals dats @ Woe Of oak record.) Emkay geese = yy Fommak cHpR > — — Fiaed length ORO a cheuockens u actors + VBRCHAR OD - Vvosuatle femeiey upto 27 sae hak eo 535 Chacdlos tert - afeng tiple 68, gow - Beary Hfppe | 40% syartaitle dato ENom — Enter (med, greeny Blue) allows enky ony ope Oh Aree 5 colour only ee ‘Scanned with CamScanner Sea. & nok case censitive . wused as Commamnc , Cayton \. CREATE: CREPTE THELE Tabtename C 11 Aalatyrs, Coln | Aattaty pe’) 5 There com be remy /Coturong ~ but, On one coltumn Us _¥e wasedl aa patrny at : a [ > CREATE: TREE eri" C oy ‘ Ya foe patiooay ey, Name — Vasichax ey dob date ; ‘ 5 . ? Scanned with CamScanner SELECT * .Geleck |. From eubtename , wHere conctilton , CRPeR A ese (en . Sdek By, select TA, name, - ee pro Student ; Anitnrvctic® caleutaitten serect Fo, macike foo #8 Total, dob, Cony serect 4, mots foo AS Tet, Anpés, JAR Ee tT ‘Scanned with CamScanner 3. INSERT: tae. Uename (wlt, © col, Wsert INTO alias 4 val’) varves Wat oe > INSERT INTO Student Cid) Name , dot) a ry’ varues (1, abe, ‘ laqo-to- 08 » VALVES (2, Ydeg', > laat-o@ - 12°); Note = WEY MM dp (pace) HHIMM ss +s I910- le- 02 UrAes eg Time | is oe bn reAmak_, he Operations - An, OR, NOT. hese one = teal wo ushere clause | iy WHERE age = BOOAD salou = tooo ; Bot Snold be TROE . iy oR > Atleast one Condilinn shouldbe MH WHERE age 7 So OR Shay K 10604 “necdig = KE condlshes : oge 3 Scanned with CamScanner NOT ° WHERE NoT.,,(age 7 30 oR Salaxy >Iobe) grecuttinn = wat PPeage™ $030 AND galaxy < (990; wrong WY : ‘ OR: WReRe stale - YVA’ oR stots = cin’ OF abate = ‘FL’ ues comect wath . Con) ; pe , > wrere,, Stole sn Cal, en! SPL’) AD > wiere ” alate’ Not: IN CA), SR, Fu) Where stale = ‘VA! oR. GP’ one uk «ann wrorg Avatp . Becatse ot Cucdluc sbuag alene- Scanned with CamScanner 5, Between | WHERE points > (ooo «AND - Ports 4 Soy | | . . | Sn Abe cose of bering vou, x rt tn oh beckweon 2 ‘Hine “Use B Bena, Coramomnd wrere «pons . BETWEEN lore AND Son & We ‘Te means omy number ef charactor, eae de available , (ory Uittcet the i can ke), places! anyute, charoct ers * abso’. St = tT Awe apeciftc chayactors, cee © FROM student | wrere — prove Is NULL . ANS : td phone, \ ULL | 8. ORDER By > Select fd, email, masks FROM gtuctent, ORDER BY Mors Desc _ + oe Aosplaups Yel, ermal), Most ks. But OM eased 69 movie Jt, UU be sorte ay dacondings Orde . Scanned with CamScanner Cn sane el q. EMIT j * there me m namber ef ctstomens mel Sy ee cua tornee 3 , _ necond hon use LMIt Clause & gelect o£, FROM queatomet » . 7 "208 er fees cn. Se e There axe Totatly tb records iE you” BG deg eco a & records wail neod only Ai . are ott te omit add met 38 necpredls : * UMIT \T 6, 3 opm 8, 9 ew unnt clase should He E . ead only lo. PLTER a tn alten a tobte Agou <9 page 3 petits 7” moat 1. &DD ae CHPRIGE : 3. DROP ‘Scanned with CamScanner ee eeeeeeeeeeeeee re eeeeeeeeeeeee eee eeeeee eee EEE ALTER TaBre tablenome ADD — column_name aatalype ; DRep ColuM N Cowurm —none 5 BLTER — cguumMN — Coluron_name Jot i MODIFY cavmN Colemn-name . RENAME COLUMN ddmame Th, MOU IMAmg => BLTER TRBLE Stuctemt . (Co column ate)" ADD namie“ varchar(50); X ALTER TABLE = atudent PD (name varchar C Bo) a “id Tne ); > DROP comumN Masts 5 ] > > ABLTER TREE Student ALTER COLUMN marks fe RET ALL j = Mop Col 7 neg LUM. OQ vi int NuLL> , > => Renome 4.4 CAUMN age te DOB, | 2 PROP TeBLE Tabtename 757 | Scanned with CamScanner UPDATE oppeTe tate ~nane set coun naroe = ‘new value’, Lwrere tondilten ) > Geet * ERoM dtudents ‘ > UPPATE students ect name -Yabe! , Sy ‘salen els WHERE customer Sd y) uppate tuden & Sey vane = \ abe! . ae wi be eek “fe oul la. perere ; Deere PROM table -name were condilive ; > pereTe FROM Studer’ wHere — marke > 7° 5 > DeteTe * FROM staden & 5 Sk delofds a nows Ww atuclent —Talle Scanned with CamScanner ig. “TRONCATE : ’ Truncate taute dabtencme 7 ~eumcatr tate «= Stuctents Neo whae dause G KHeodd oe DELeEere TRONCATE DREN delet remoucs | se Removes Re “| | NEA T, Some a av | aw the sows acy a ROU . | Jo Table | ) | | Fe haaanot Are oh Frezup | Comey " | Up the spoce Me spoce . rolled up | lowe “hay | Vaumeote Wes umeie | ulate Uause chose 33 nek thie) “Falke ‘gull _ ee? ‘Scanned with CamScanner | SOL Commands ) PPL - Data Definition bangquage . ou Data Memniputatenn longue ' DCL [oi pata contaol lomguage . stromemission — tentaol Lamquqe . DDL create, Anop, Rename, Alter , Truncate DML ete, Inert, update, delote Ber: Gaontk, Kovoke . TCL 1 Comme; Rollback, Lowepsiot y a promncctiong DCL GIRBNT.. (=e a employed te gaat a prvilge ve % user. GRANT eee eed aon tf pater opedod Tasks - i" Reveke «at Uithdrar users = Biivileges . opetation wt done epposity de > GRONT . ‘Scanned with CamScanner ex. grant Avserct , +> Ram elect mom actorrmG By above Command User Aary has gronted Sparntssions 7 occouny | AB cbiet Ihe SS te Avaet. ~ Gol, oncound . ex. neuoke Trnert, Select ox acount hrs ® : Permission (ke queiy Oo - Meek & accounSs AB objectD her been semua ach ConIM LT tae Seton Bata "Sait , Ss Bhemener _ Wwe Patton ong on ties, wan ond ke inset ) Actete of update: Mese ) CONSTRAINTS OR MoDIPIERS . Le Not? ULL ws sulsv = | 2- DN) QUE < umstacm ts, . 3. DEFRUOLT 4s PRIMBRY key 5. CHECK 4 &. FOREIGN kEY. ‘Scanned with CamScanner

You might also like