0% found this document useful (0 votes)
8 views23 pages

SQL

The document discusses SQL commands related to database management, including DELETE, TRUNCATE, and CREATE TABLE operations. It outlines how to manage constraints such as PRIMARY KEY and FOREIGN KEY, as well as the use of CHECK constraints to enforce data integrity. Additionally, it covers the importance of rollback operations and the structure of SQL statements for creating and modifying tables.
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)
8 views23 pages

SQL

The document discusses SQL commands related to database management, including DELETE, TRUNCATE, and CREATE TABLE operations. It outlines how to manage constraints such as PRIMARY KEY and FOREIGN KEY, as well as the use of CHECK constraints to enforce data integrity. Additionally, it covers the importance of rollback operations and the structure of SQL statements for creating and modifying tables.
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
——=_) 7 Dif ferouce Gra .DOL aud Om Al J Emp oF —- Delete command ir used to _renrove cous from cu._table ote: _A alesse slasste cau be woek to outy Tt Si nal abate zandib‘on - ka 2 specified, ODL pioeas _ taut: f nemoved - _ oo a & ei Afton peafarmaing DELETE 9 ening AS — > feu maid ta comnuit 0% Rotiback He : ____ trosoach' beni rt ? lo Ri Coast Ce) — > Ie : 5 X * = Sau> Devete FRom e LoHeRe i 7 “4 +t rvs of o —t | ile Coonvyr Cr) lo. > ses Delete from emo: (0 y0u2s deleted Ps =D. SCL > Rotinoek; = & - Rot beck cormpoeteal. |_chnesan uch. Frasate os fain oud Be rete O10 C Aghete Lhe. SCL > TROWCATE TAGLE erp; “Table trumcated © O Autos tobles’ ews, jondaxces bunch Pig | Loti aloo be mnemoved-—______-— =a 2 Wo Ome triggers colt be. —_—_ _ Note: Jie opeaotion. foaumat hel erat back. Soeeeeeny ci! “> Daop Taave emp; = - OO ——Tabte Ona Sa —______ Sau 2-SELecT # Enorn emp; — a _ = eGo ak_Ume 4 a > =o0 ORA-00%48 : 4able or 5 - len ~ 149 does rot enuiit: s Peal Note: ): > Dao aud truncate one_pp1 > ar Laaads, wilerrag ae Comm and: ce te th +++ ot | pol — Reg a sata Cet i a J Create 2 used to dxine oe0 obj ects Aer ‘Waed to omosify Hos. day iushion. of eurting I aa os rem ove_ seeokong. eutites 0. toble witout fogging tas —tnadividuuol— Dew __ deletion: _ — x ~ rn b= Dot onauspudoiion Louguafe ee Statements ened to _sotrieve Duo eat, Update, encore. _ Sasol ye dato twit. Gr Bo bjects. - ~ te $e! if = Se Lect_-_uretriewes ane or omare_sovns f wa OToble Gr. : ee Dest: Ganest ous ox mort sous “fromm Q Table or Lien. = Gate chasis enintong data a Toble 0+ vied. os —Oetete | nowsouel one or mere seras fom a Toblegr ———- Oieed = Gutk iment Laoports a. data fle tata a. datohoos Tob be oy View 10 0_ttea Shecified F-62209 at Starat SQL conmrarmts ae od es | protecets cic a table: vuartrict a column of domain integetty) MOALLLEY; = Check Comstrein a poste conf orc ecmneat 3 SCL. Create Crmbrcun bs: S- Ls) alert SS) Consiveints cau be Specified color “Thee table ets Crrated wit the —Crente 1 agle Alateneut ease en TT tyre eRe 50 ter Hae table eda casted Coit. -Hae ALTER TAGE (Attctern euk= . Constraints ae woect to Linct Hoe type of dato that Ccau_go cto a table wpe TS TS 0 ike emacs ta : —l—aat ee le sabtobecry of Te —<4 _ Phe fottow’: : Y f Sg i asin see eeneip we —_ SEE UEEEESEDETeRE nT? TT 7 my : Lun te NO —__JVet_ Neu coruévaints enforces a_col ao ~Aceepr IVE Vales — 2-9 create race Persons ( ID int Wor wut, | LastName ¢ anchan(2ss) WoT VUOLL, FirstName canclian Cus) oT MOLL, —— Age int ) a — — — SS ~ a SOL VOT WULL on ALTER TAG LE- Swe Ofo create @ for rou. Constraint on Her _ SQL UM@ve Constraints. a O dba oucque constraints ensured rot OSL VOleds ta Qcoluumn Que diff ereret - © Gott. +e creegyat s primary Key comstraints pronicte Cc gquanamiee Or obgpsrnons for a ‘Column or Atte 2 Columns. Ken ~conateratnts > Cutormatico Cty Lua __Y conitonint- — © Hoeven, lou Com low etna, Unt 106 onstrain) <2 _ per toble but” omy one Primary" Key Constraints per

2 w oe ‘Lo crop 2 ONIROE constraint vine sae fbn Code: —PLTER TABLE Persons 4 —— gene. ———— \ —— —PRoe Twoey Uc- Pewon; a cone ____1|% 8a. Reawen | Orne]. ms Access: - —1- ALTER TASLE_Pesrons 2 - \ @—______DRoP_cowsTR aint _UC~ Person; ——} “a = t = 2 ay _ —OFy Me —pormaaaat Ie Kees lth each resmd _ tua _toble oO] Fig ec ten Cannot . SOL ; CREATE TALE fersms | (sec teacws forae fons Ms Acces a - just NORFATE eaate Pen !D int NoTMuU, . C ae Lost rvame anclaanlassy !0 int 4 NOT vou PRimAed ney, OT | B, peat one Lanter Coss) Nor Wu, Wat None. Vonckan Os), a} ia | 4h) | (8 ois (oO allio a Oo] G. Jovan Key Cooulocuits a Qual fer cle fleicey & PRIMARA KEY Comstocunts oO i wl i o Vouclipce cdluma coe [o« neni Ayrntan & —-MmysoL/s@t Server | oracte/ ms Access. 6- — ——___— —--—_ —— CREATE TAGE Power Co c : _ IDimt Wot Now vk: Gr — Last name varchar (ass) ver wuLe ne Finst tame cranclar (ass), _ - Ags _int,_ 2 a —cbovergamr ~R fevon [Link] — _ _F~ . C10, Last Varn) &- 7 DF @ 7 a ote* a H C0 ple Cbove _ reas yO slp a Core [PRimaery ey) > PK Pemon S __ Heweven, Hoe odaat_ of fie hai mscay yUs = Mace _tsp of Two coluning (low adam i —,— O-10_cirate a Paimary key constraint on tHe ID” column Who His toble ots Already Create — & use Cocke 3s ______ ALTER TAGLE_Pereons_ © _ ADO Pama RY key (ID); aK ‘ ees IC Page Defin = De mot PRIMARY Key comstacunt On musttipte colors {ve Cocke, \ ALTER TAGLE Pensons Ao ComstRaimr PK ferson PRIMARY. KEY C10, Last nin) Cele 8] You Use He Alter TAGLE Statement a : Lo acl a Eee mca Key column wu) Mri Akica 1 hoe: prima jit _+to fot _Comtoin NWoct vats Coben Hh tebte wos fois t_cr0ated). a —©_Drep a patie Key ‘cowhaint. © Code : Avg SL . cf “ALTER TABLE Persons oT an Peat Ney J © Cocke : Ssitio/ omcte] Ms Acces. __ ALTER TABLE oer oo ________DRop ConstRAatiT. — Pen aon; ee ee —— SS 5 Cai Key Contain) SS ae a Oy Foxeton Kay o_O wis wed to Link fuse __ tedbtes togettetn, - ® =A fansigon Key tina fie Cor. coLtection of fields) : Inout table _ a aa 1 He PRIMARY” Key fn & : —Anotunr table. foxesgn vey Hoy ia _ alt be ee tite table. Ree ren cad Hee a fae he or poset J te at Oia ; pe ed = ewon table > _— - A fe) . easonrD. : Ere = ~ U4Ugag | 2S _[aa4se 24 529 ©. Forveran Key coustoount) ds usecl to prev eu achons Hal? wo ute dleatooy dinks afro. tables. SU Fosrve gu Kee On Carnie TOBE Cocte: 5 ( d py yt SCL server / Orerete / ms Acer: CReare tABIE, Orcors ( a ———=}, : Ordeal Lat Mor AULL pAImAR) KEY, — Oreten Mamber duct Mot vor ———— Peron ID int FoReIQn Key REFERENCES a Persona (Person d)- a a di di I DL dt) LY) I Fo = iG ie eK Caw trem. Os eu_dypius 0. CHECK Conatroink onc Air a moe Jo st _Atluowss_ouly erntasie valints Pox 4 tw column: ~ ee - (gi eat on CRE Are Tent) 7 foliassing 904 craater a CHECK constraint om Hee "6" U column Plo Hee —Perrens” tobe ci = Page — Cocte : Jey sor [gar server [oracte) MS Access CREATE TABLE Persons ( - ID imt wor MOLL, — Lost Verne “[Link]€ 25S) FYOT eu — Poston Vauchan ( O55), — a at, = — ea Vanchan. Coss) a Ge, WSTRALT CHK Pexgor_< cHEeck. CAge>= > rs; a - pa o-City =" “Pines 5 oot ca ig ; es A S@L CHech_on Arrea _ Ge SS ye TAGE oo . oo. O_my S01] $04 sesute] Orcote) pas Access: ot © Aurea rane Perron . 7 Tr fon cucck Cage >=18); oF Zo cae Ss PROP a CHEeR at 4 =a Coustran @ =< 7 wo a Coste 804 Seania] Orracte | ts areca — el ot ALTER TAGLE Peroms DRop Cons rRAINT CHK Peasinn Age. Cote My Ses 3S eee rae BLE feasens pee « 2 ebetcts Lisa fantom Ages 7 $y =— eX ______l > ALD: — = yo < +> ———~.. Retoctvonet operctors *) - a Rae eA eee ° jietabiomal pee. 0-o. cunt feat — 9 Kacl. “cherator 4okes_oru_or two vulotions as uts imbue Orch pooduce a med wHelotion 2 Be uth —— Tein --cfsotse — a dna — O_ seetochariat 0} © Restrict . © Povject - © Prsduck- 7 © _Urion. - 2 © Tntenaseck. - cs OOF rence ©_Join_ : _ © Divide _ 1 “pwlohim Sased on a Condition. [Reties] Studrome] Age. 0901 | oust | 0%or At (Cad rove | tos The condition us to @oalreck thre tuples rom ey Ha STUDENT table Of oly tose Arudeuts oY Whose Ae more “Hamat as, Roku Srudwoms, an oy — = — _ wry C Pri ect.) ) 2 ct Jo De Te fae — erety rat af Attributes orc caluamm pom ro Gere 2e atien. =] Pattee caste foject ct —opesator if You qT Crete a age cf O41 Aro eae | & a —_Reauttouk out. -Grety 1 04o) Qo. 0402, a3 oun | AF aor | 26 Ogos TTPteetvains ope CSE. we | oy Prodan) (PA re ae, — = ed Ode product operator join two sutations Ww Auch that tues tuple of tH ut yutation va - : Matchad wit even tuple of Atcond relation yo - - _ —_ a Wote:) Jo be pooduct Compatiable, Hw +20 tables — — — = —_—____ - ad Le Tw Mest howe Common attyibutes c SR Rp —Coturmamn 35 Cmte) = © _ f eRe ee ; - a etna tile hat Bo it 4} i 7 J\ 5 =) Me on ¥ Guin >) ein.) ar ae : a 1 © Ta matternectcat Lerma yucou us chefrrreol - ~ —-Ga_ common Clout uv poo setebon 28" e t a _ ee on o ~ SOS oN, 6 6 ay 7 — Z et a _ _ = — or Pep p ps a | EB) et i t mt Ae of Columns naudh be ame. nee —BDetmaniaiof every | Column Onuust be Lamia & ao =x Tg FIO Tiara bag SI “ acs) ; fe mf A 3 Ao i Dt. rl A poe py ft ds | ae) <3 © Sle intersect oberator burtds a 2rhodion | ~ Comnisting Of Auples Meat abpean cu boll. Har statins NS “9 P=Ct,9,34,54 pe B= 2 9,4,6,84 aAng- tart. a a ww ables tobles , A curd B- a $$ a = a OO Is _ [ xo — | we B. 7 a - - OF Rove | Monee 4 : : oOsse Surat ie t Leste | amar. - To fi iutemechion Gfuo_t20 sulation ao 2 3 _lobles A_and Set aifons aifferace. ae) ea om (4-8) 7. P but mot B-— ang! Oj Su Aa-L1,9,¢8} Be ts, aie —~— 4 (oes Ston “fection (ee. So clerived © Division Operation ce» cxteo Jaron 04 Oforations, Tew © denoted Aleph mattumetics a “y bat fords bd tuple U we coun cuvsoe XK, —, Wy : _ —Orbso _ Siena = ret ~ NAS Caaael . ee — a AM Coa a 5 s a ic Ci _ a Sa [Cad | cid - SO [se md So [Ca | Ca that “ibe fa > Hudtue. of Hihohion B - a: ECSia, cia)/CCciay = = @)_ = Now _to_f Sid_of “shidecas | wai Gan itn pean 5. 2 Cross product -forenudo _ (Tia Cemotted)) {rea Ccoue) ae oe Sr Cc; Sa Xx a a 83 CQ "Table formation after Coss. predict —— - Sid & |Studli }Cial =e g Cul a - _ Si fee os _ f sn cr | Sa. _| Cu _mot_ Gan = prow ‘total Stuolouts (Sid) — a = = (enrolted) } — : = Sid | Tears Bid gi Se patted] S - Comotted 82 {7} 53

You might also like