Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
14 views
18 pages
DBMS 3
Gggy
Uploaded by
ttap44832
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
Download now
Download
Save DBMS 3 For Later
Download
Save
Save DBMS 3 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
14 views
18 pages
DBMS 3
Gggy
Uploaded by
ttap44832
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
Download now
Download
Save DBMS 3 For Later
Carousel Previous
Carousel Next
Download
Save
Save DBMS 3 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 18
Search
Fullscreen
Key in DBMS: Tf vroematigation Is a fight , then fun clonal hefindency hag to be Con sido as Rifel’ at key Hs considar a “tel? of that wifel’, So, bagic idea is thak Keg is avery Tmmporelarnt took for norenaligation i DBMS. Fo-eheck A table jn the ao Kind of normal form, Key ts why Keg yequtved ? atabase belongs te which veg 2 essen He Tr a table we have Some rade (tuple) oma Colurmrs<(oHritak) Nea mn each table has Column name bul does nod have Yow name . Nod te access Adable We TEPied Lome. ee Ae Wank +o Search those . information Ue, Suppo’ Si Students phe fees inom Im order fy Seach ThE Hames rae eqire dh Gndentfees colttmr . Fer ganple :— Student [Bro] nancy wpe ae ies So, Keg is flak ablbribuke by A Bi Le hich, We Can jlarbifgtye 1a FP Rokire table . pie ee aa ox i is pep] Key i ghak atbrilute by Abich 4 fel tot Com jdetify the vemarning akbrbd - Ky = 4A BC (A) S i é (KetTh can also possible 1, offor Combine 49 + yore. abbinules We can also theif uniquely he tuples . key heft. A key is a set of ableibules Which can veniqueel qdenki | AweD or aduble jn a helofional table . or A tt aS 0 Seb of aUlributes wilh the help of hich yor can Tdentfy he value of ofhOr atheibules. NOIE: Tn aq dadabace, We enay Bove: sasceston.one” a and cach table have 16 toque individucl Allomadekey + Out of all candicode Keys, only one a gett aclected as Pry cat Vemaining Keys Art known as allomose Or Secon: Kes im Camposite key: A key thal consists of more than one attribute to uniqu identify vemos (alco Known aS records or les) tm A table is called Compostte Key. Forelgn key Porcign Keys are the columns of adable ‘that pore to the primary key of anctken table. act aga eross~ refOrencee befween ables.Beamp rect _R(aBcd) A~y BC (A) awe [> is mt tn) (key)t- R So, Ais wot the Req We kr, B oonple 2 ro R(aBep) ABCD ABR ed A BeD (anc)t= aBeD ‘Apt = ABCD > So, ale tiwce ane Kod ) Bed A atone is apf . [At = ABCD Suporked ? Suporkey and Kuy tsoth are Same. sae Suprr Key Mae gob dy eutiates by AKeh ‘Ak can uniqpely z entity “neg eo ov Heples or The ae mati allel bukes « So, ais por BRArpleD , ABE. DB/A All 3 Are SUPOKG « Now, i Candidabe ktq ° valaieeed— OF officten® suporged *S fre can didade KY, Accord ns idade " A is Be candi Key Tr oho word, candidal& Key isthe paintrnel Smporkeg » refs propor Subs fs not Me SHPONA. Aoreple 2,Brom pla R (aged) Boa ACD ACcD>B (BYT= ABED So, Bis Candichale keg (Pevyr= ABED , hore ACD ic alco candiclake key . PeBrebecaute, proper Subsel of ACD — Ac AD abl one not Rey oe c D Prcrnary [Kez Dodahase. adminicheler choose te Primang key genorally ‘i Primady keg isthe, Single abhi bade De, 7 a jt coutd b 7 primang Key ts that candidale Ky Which is selechek by cdalabase o mintghotor as a Primang mean +o identify tuples : According, mets 32, RICA primary Key But cD tan alco be prt Bis rock ee CR ica a For 2xample Suppole we buy Some product online Prrough, go payrrond: bub produch i¢ mldelivord So, We can Comnpladny dirk Fhe CUStorna Corre Peg asked 3% aaa et kbouk tancadin lh (for exetis BY Buk at He man dim WE Cran not able ts Sm oy prey. aad Noone , product detail’, addyest ete. (fur renble AeD),Find nufthe candidofe kegs. R( ABCD) ABC ‘c+ BD Da A Examples: ay". (48) - ABCD wy Pchor ane Super keg ag ack (c)* =aBer as Comdidahe Ky « (r= AD Bes R (ree >) Shorteuk tricks APB (AL ABC R(a ae dD) Bac (Byt= ARE aie ay Find that attribute which (C)t= ABC] doce met fave Ding Mreorning 243e Ov find tart abbr bute Which 45 Jowe rrot-appears on sr aye of Functional Dependency Tr @e this Sable, D, Dig ther Known Aad B66ertiogk CIE med Yall are SUpOKLE as (BD)+ = ARCD— eal AS Candidale ee v / ROE eee CT tO te headin ALB, cb atlare red Superkeg ,Pet p( ABCb) ABCD Fesendink ablioule= & DAA “Rye ABCD (Boyt. wv (Bb)* = ARCD So, AR, BD ane Superneg ag Well 24 Candilate Ky. Ex-7 1 eT py bt R (A BEb EF) ABYC Essential pe els Alte bake Bo AE (BF)*. AEBFCD So, BF ts the candidkoke eq . "SP R(ABED) B)* - ABCD (Q)t=A” (4B)" = AReD eae ur. Bee * (Pelee DOB (cyt = Ac | O Dt = ABeDe (Dt. pp 2 | BO" = ABep~ BD)*= Bp x OcB)t. x (Cd)* = aBene t Gent * So, DB, AD, RC cD arc bda) =» comnUdate Keg, Be)»Ex-9 R (ABEBE) Essential AHribude= B AB> cP (gg) ~ ABCDE DoA += ABCDE BC DE ee ABCDE (BE = BE x So, AB, BC, BD ae candidate key. Ex-1o WETS towxyew =e 2 Wx) RC EY?) (W)t= Wo» : g)tenxyer Z9h (xyt= >” (Wz)"-WZ< Ys xz (yt bere XW>Y (zie « $0, VY, WX XZ are Candidale KY. €y-H ost = ABCPEF R ( RS cE) Essential Alvi bude = B,D es (app)*= ABC DEF ae [Bep)t = ABCDER & (BDEy' = BDEF x BDF)! = BDF x (BREF) = BEF Er) $0, ABD, BCb ant candidake kee . Ex-12- mT == RABE) 8 Essential Attys bute — Cr cE+D D—+7B (CE)* agere Vv cA So, CE ts comdtake KeqaE aote eae ee co ARS Essentint Abeibute= A,B,D Ab> GH Boo EF (ABD Rv Awl So, ABD Ts can didake key. HOT Ey -l4 rt Bt (BEDE) AFB — Essential Alixibute= CD Bese Cepy*- op < DE DA (Acb)t = R (Bevy=R CeDEy LR So, ACD, BEb,
APE Yor te « (BOT = ABCDE w CDp)t= ABCLE — + (ACE. ace « (cEyt= ce x $0, Bo, em Mt candidafe key, Beate m4 tev = R(ABEDEF) (ate nx ABY- Ri PERE!) Be B « Or< AB> (edt = cpBEFA r CoD (D> = peerac ~ GENRE RU DIRE Ore EerAx BEN EOF CF)*= bp w EDF ~ FOA (EDT (AED. AERX So, CD, AB, BE BF are candidode KY -Closure of an Attribute Set- * The set of all those attributes which can be functionally determined from an attribute set is called as a closure of that attribute set. * Closure of attribute set {X} is denoted as {X}*. Steps to Find Closure of an Attribute Set- Following steps are followed to find the closure of an attribute set- Step-01: Add the attributes contained in the attribute set for which closure is being calculated to the result set. Step-02: Recursively add the attributes to the result set which can be functionally determined from the attributes already contained in the result set. Exampli Consider a relation R(A,B,C,D,E,F, G) with the functional dependencies- A=BC BC + DE D—F CF+G Now, let us find the closure of some attributes and attribute sets- Closure of attribute A- AT = {A} ={A,B,C} (Using A > BC) ={A,B,C,D,E} (Using BC — DE) ={A,B,C,D,E,F} (Using D> F) ={A,B,C,D,E,F,G) (UsingcFG) Thus, At={A,B,C,D,E,F,G} Closure of attribute D- DY ={D} ={D,F} (UsingD > F) We cannot determine any other attribute using attributes D and F contained in the result set. Thus, D*={D,F} Prepared by SKS, CSE Page 1 of 10Closure of attribute set {B, C}. {B,C}=(B,C} ={B,C,D,E} (Using BC > DE) ={B,C,D,E,F)} (Using D> F) ={B,C,D,E,F,G)} (UsingCF+G) Thus, {B,C}*={B,C,D,E,F,G} Finding the Keys Using Closure- Super Key- * If the closure result of an attribute set contains all the attributes of the relation, then that attribute set is called as a super key of that relation. * Thus, we can say- “The closure of a super key is the entire relation schema.” Example- In the above example, + The closure of attribute A is the entire relation schema. + Thus, attribute A is a super key for that relation. Candidate Key- * If there exists no subset of an attribute set whose closure contains all the attributes of the relation, then that attribute set is called as a candidate key of that relation. Example- In the above example, + No subset of attribute A contains all the attributes of the relation. + Thus, attribute A is also a candidate key for that relation. PRACTICE PROBLEM BASED ON FINDING CLOSURE OF AN ATTRIBUTE SET- Proble: Consider the given functional dependencies- AB CD AFD DE—F c-G FOE GoA Prepared by SKS, CSE Page 2 of 10Which of the following options is false? (A)(CF}*={A,C,D,E,F,G} (B){BG}=(A,B,C,D,G} (C){AF}={A,C,D,E,F,G} (D) {AB} ={A,C,D,F,G} Solution- Let us check each option one by one- (Using C > G) =({C,E,F,G} (Using F + E) ={A,C,E,E,F} (Using G > A) ={A,C,D,E,F,G} (UsingAF+D) Since, our obtained result set is same as the given result set, so, it means it is correctly given, Option-(B): {BG} ={B,G} ={A,B,G} (Using GA) ={A,B,C,D,G} ( Using AB > CD ) Since, our obtained result set is same as the given result set, so, it means it is correctly given. Option-(C): {AF} ={A,F} ={A,D,F} (Using AF > D) ={A,D,E,F) (Using FE) Since, our obtained result set is different from the given result set, so,it means it is not correctly given. Option- {AB} ={A,B} ={A,B,C,D} (Using AB > CD) ={A,B,C,D,G} (UsingC>G) Prepared by SKS, CSE Page 3 of 10Since, our obtained result set is different from the given result set, so,it means itis not correctly given. Thus, Option (C) and Option (D) are correct. Different Types Of Keys in DBMS- There are following 10 important keys in DBMS- Secondary Key Alternate Key Different Kinds of Keys Surrogate Key Foriegn Key Composite Key . Super key . Candidate key . Primary key . Alternate key . Foreign key Partial key Composite key . Unique key . Surrogate key . Secondary key Sewmrnansone NOTE- Before proceeding further, Kindly note- + The terms ‘relation’ and ‘table’ are used interchangeably. + The terms ‘tuple’ and ‘record’ are used interchangeably, Prepared by SKS, CSE Page 4 of 10So, don't get confused! 1. Super Key- + A super key is a set of attributes that can identify each tuple uniquely in the given relation. * Asuper key is not restricted to have any specific number of attributes. + Thus, a super key may consist of any number of attributes. Example- Consider the following Student schema- Student (roll, name , sex , age , address , class , section ) Given below are the examples of super keys since each set can uniquely identify each student in the Student table- + (roll, name , sex, age , address , class , section ) * (class , section , roll ) + (class , section , roll, sex) + (name , address ) NOTE- All the attributes in a super key are definitely sufficient to identify each tuple uniquely in the given relation but all of them may not be necessary. 2. Candidate Key- A minimal super key is called as a candidate key. OR A set of minimal attribute(s) that can identify each tuple uniquely in the given relation is called as a candidate key. Example- Consider the following Student schema- Student ( roll , name , sex , age , address , class , section ) Given below are the examples of candidate keys since each set consists of minimal attributes required to identify each student uniquely in the Student table- + (class , section , roll ) + (name , address ) Prepared by SKS, CSE Page 5 of 10NOTEs- All the attributes in a candidate key are sufficient as well as necessary to identify each tuple uniquely. Removing any attribute from the candidate key fails in identifying each tuple uniquely. The value of candidate key must always be unique. The value of candidate key can never be NULL. It is possible to have multiple candidate keys in a relation. Those attributes which appears in some candidate key are called as prime attributes. 3. Primary Key- A primary key is a candidate key that the database designer selects while designing the database. OR Candidate key that the database designer implements are called as a primary key. NOTES. The value of primary key can never be NULL. The value of primary key must always be unique. The values of primary key can never be changed i.e. no Updation is possible. The value of primary key must be assigned when inserting a record. A relation is allowed to have only one primary key. Prepared by SKS, CSE Page 6 of 10Super key Candidate key Alternate Key- Candidate keys that are left unimplemented or unused after implementing the primary key are called as alternate keys. OR Unimplemented candidate keys are called as alternate keys. 5. Foreign Key- © Anattribute ’ is called as a foreign key to some other attribute ‘Y’ when its values are dependent on the values of attribute ‘Y’. The attribute ‘X’ can assume only those values which are assumed by the attribute be 4 «Here, the relation in which attribute ‘'Y’ is present is called as the referenced relation. « The relation in which attribute ‘X’ is present is called as the referencing relation. « The attribute ‘Y’ might be present in the same table or in some other table. Example- Consider the following two schemas- Prepared by SKS, CSE Page 7 of 10Teacher (tno, t_name , t_age, t_dept) Department ( dept no , dept_name ) ( Referencing Relation ) t (Referenced Relation } Foreign Key Here, t_dept can take only those values which are present in dept_no in Department table since only those departments actually exist. NOTES- + Foreign key references the primary key of the table. * Foreign key can take only those values which are present in the primary key of the referenced relation. + Foreign key may have a name other than that of a primary key. * Foreign key can take the NULL value. + There is no restriction on a foreign key to be unique. * In fact, foreign key is not unique most of the time. + Referenced relation may also be called as the master table or primary table. * Referencing relation may also be called as the foreign table. 6. Partial Key- * Partial key is a key using which all the records of the table cannot be identified uniquely. + However, a bunch of related tuples can be selected from the table using the partial key. Prepared by SKS, CSE Page 8 of 10Example- Consider the following schema- Department (Emp_no , Dependent_name , Relation ) Emp_no Dependent_name Relation | El Suman Mother El | Ajay Father | i E2 | Vijay Father | | E2 Ankush Son | (eSB Eee ete ee Here, using partial key Emp_no, we cannot identify a tuple uniquely but we can select a bunch of tuples from the table. 7. Composite Key- A primary key comprising of multiple attributes and not just a single attribute is called as a composite key. 8. Unique Key- Unique key is a key with the following properties- + It is unique for all the records of the table. = Once assigned, its value cannot be changed ie. it is non-updatable. It may have a NULL value. Example- ‘The best example of unique key is Adhaar Card Numbers. + The Adhaar Card Number is unique for all the citizens (tuples) of India (table). + If it gets lost and another duplicate copy is issued, then the duplicate copy always has the same number as before. + Thus, it is non-updatable. + Few citizens may not have got their Adhaar cards, so for them its value is NULL. Prepared by SKS, CSE Page 9 of 109. Surrogate Key- Surrogate key is a key with the following properties- + It is unique for all the records of the table. + Itis updatable + It cannot be NULL ie. it must have some value. Example- Mobile Number of students in a class where every student owns a mobile phone. 10. Secondary Key- Secondary key is required for the indexing purpose for better and faster searching Primary Key ~ A primary is a column or set of columns in a table that uniquely identifies tuples (rows) in that table. Super Key - A super key is a set of one of more columns (attributes) to uniquely identify rows in a table. Candidate Key — A super key with no redundant attribute is known as candidate key. Alternate Key ~ Out of all candidate keys, only one gets selected as primary key, remaining keys are known as alternate or secondary keys. Composite Key — A key that consists of more than one attribute to uniquely identify rows (also known as records & tuples} in a table is called composite key. Foreign Key — Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross-reference between tables. Prepared by SKS, CSE Page 10 of 10
You might also like
Functional Dependency Theory
PDF
No ratings yet
Functional Dependency Theory
22 pages
closure properties
PDF
No ratings yet
closure properties
22 pages
Functional Dependency
PDF
No ratings yet
Functional Dependency
52 pages
unit 4 Dbms-1
PDF
No ratings yet
unit 4 Dbms-1
48 pages
DB_KEYS
PDF
No ratings yet
DB_KEYS
13 pages
Closure
PDF
No ratings yet
Closure
4 pages
DBMS
PDF
No ratings yet
DBMS
22 pages
Candidate Key
PDF
No ratings yet
Candidate Key
8 pages
Dbms Unit-4
PDF
No ratings yet
Dbms Unit-4
78 pages
Workbookdocx (1) PDF
PDF
No ratings yet
Workbookdocx (1) PDF
21 pages
16 Relational Design Algorithms 07-06-2023
PDF
No ratings yet
16 Relational Design Algorithms 07-06-2023
4 pages
lecture notes on database normalization
PDF
No ratings yet
lecture notes on database normalization
6 pages
6 Lct 6 CS & DA_ GFG Hinglish_ Minimal Cover & Super keys_compressed
PDF
No ratings yet
6 Lct 6 CS & DA_ GFG Hinglish_ Minimal Cover & Super keys_compressed
76 pages
Finding The Candidate Keys
PDF
No ratings yet
Finding The Candidate Keys
2 pages
Fundamentals of Database Systems: Prepared By: Ms. Roda Flor Andrea B. Teodocio
PDF
No ratings yet
Fundamentals of Database Systems: Prepared By: Ms. Roda Flor Andrea B. Teodocio
30 pages
DBMS It 405
PDF
No ratings yet
DBMS It 405
4 pages
Winter 2020 Paper Solution - Dbms
PDF
No ratings yet
Winter 2020 Paper Solution - Dbms
25 pages
1.7 Armstrong Axioms and Finding Candidate Keys
PDF
No ratings yet
1.7 Armstrong Axioms and Finding Candidate Keys
25 pages
Normalization PPT
PDF
No ratings yet
Normalization PPT
161 pages
Dbms Assignment 22bce9090
PDF
No ratings yet
Dbms Assignment 22bce9090
18 pages
candidate key
PDF
No ratings yet
candidate key
5 pages
DBMS Assignment 2
PDF
No ratings yet
DBMS Assignment 2
8 pages
DBMS Relational Model
PDF
No ratings yet
DBMS Relational Model
11 pages
FD Slide2 09
PDF
No ratings yet
FD Slide2 09
19 pages
Keys in DBMS
PDF
No ratings yet
Keys in DBMS
8 pages
DBMS Unit-2
PDF
No ratings yet
DBMS Unit-2
32 pages
All Keys
PDF
No ratings yet
All Keys
3 pages
Keys Overview
PDF
No ratings yet
Keys Overview
7 pages
Lab Book: F. Y. B. B. A. (C.A.) Semester I
PDF
No ratings yet
Lab Book: F. Y. B. B. A. (C.A.) Semester I
47 pages
Dbms Chapter 4
PDF
No ratings yet
Dbms Chapter 4
76 pages
Unit1 Dbms
PDF
No ratings yet
Unit1 Dbms
11 pages
DBMS Presentation
PDF
No ratings yet
DBMS Presentation
21 pages
Database Systems: Assignment 4
PDF
No ratings yet
Database Systems: Assignment 4
7 pages
Unit 3 DBMS Keys Join Aggregate View Clauses
PDF
No ratings yet
Unit 3 DBMS Keys Join Aggregate View Clauses
23 pages
Database Management System Vivek More Docs
PDF
No ratings yet
Database Management System Vivek More Docs
13 pages
Database Management System Weekly Test 01 Test Paper
PDF
No ratings yet
Database Management System Weekly Test 01 Test Paper
5 pages
Keys in DBMS
PDF
No ratings yet
Keys in DBMS
20 pages
Relational Model & Relational Algebra
PDF
No ratings yet
Relational Model & Relational Algebra
83 pages
DB Part1
PDF
No ratings yet
DB Part1
9 pages
Database Systems DBMS KEYS 7
PDF
No ratings yet
Database Systems DBMS KEYS 7
15 pages
Relational Model
PDF
No ratings yet
Relational Model
16 pages
DBMS Unit-3
PDF
No ratings yet
DBMS Unit-3
66 pages
9-Keys in DBMS-05-08-2024
PDF
No ratings yet
9-Keys in DBMS-05-08-2024
14 pages
Database Design: Wednesday, January 25, 2006
PDF
No ratings yet
Database Design: Wednesday, January 25, 2006
21 pages
Database Design: Wednesday, January 25, 2006
PDF
No ratings yet
Database Design: Wednesday, January 25, 2006
21 pages
Gate Question On Dbms
PDF
No ratings yet
Gate Question On Dbms
5 pages
Keys in Dbms
PDF
No ratings yet
Keys in Dbms
19 pages
Exercise: B CD (C) AB CD (D) C D (E) B A (F) BD AC (G) AD BC (H) D B (I) D C (J) C A
PDF
No ratings yet
Exercise: B CD (C) AB CD (D) C D (E) B A (F) BD AC (G) AD BC (H) D B (I) D C (J) C A
17 pages
7275 Keys
PDF
No ratings yet
7275 Keys
4 pages
3 Relational Keys
PDF
No ratings yet
3 Relational Keys
19 pages
5KS01 DBMS Unit II Relational Algebra SQL
PDF
No ratings yet
5KS01 DBMS Unit II Relational Algebra SQL
92 pages
Keys in DBMS
PDF
No ratings yet
Keys in DBMS
36 pages
Unit-2
PDF
No ratings yet
Unit-2
40 pages
MOI_CT2_RDBMS_MSC2
PDF
No ratings yet
MOI_CT2_RDBMS_MSC2
30 pages
Functional Dependencies
PDF
No ratings yet
Functional Dependencies
18 pages
n13 DBDesign
PDF
No ratings yet
n13 DBDesign
11 pages
Smu CS7330_Howework2
PDF
No ratings yet
Smu CS7330_Howework2
7 pages
Keys
PDF
No ratings yet
Keys
22 pages