








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









































Slode-
Primany key! A primany^ key^ is^ a^ unique^ identifier
and ean not have NULL^ values.
en:^ Student-into^ (Atudent_id,^ stu-name,
dept-id,^ dept-nomd)
Foreign key A Toneign^ key^ is^ a^ column^ on^ set^ of^ columms that^ erceates^ nelatunship^ between^ two^ tables.^ It^ nefens^ to primany^ key^ of^ anothen^ table.
Customen (cust-id,^ eust-name); Oridens^ (onder^ id,^ onden,^ nome,^ eust-ip)
niqme key
↑ Foreign^ key^ that^ builds
and Urndens^ table.
A unique^ key^ connatrants^ allat^ ensunes^ that^ all^ vaves
in a column are uniue,^ though^ it^ allows^ a^ ningle^ NULL valve, Name VARCHAA (50) UNIQUE ane^ means allowel^ only to^ one having^ now Null valves
Spon keg A supen key Is any^ combination^ of^ columns^ that
ean^ uniquely^ identify^ each^ now^ in^ a^ table. Er^ A^ supen^ can^ have^ extna^ columns^ beyond^ the minimum nequinel to identity a necond.
Candidate key!-
worrds,^ it's^ the^ smallest^ combination^ of^ columns^ that^ can
а пOW.
en:^ Student^ (atu-id,^ name,^ email,^ phone)
Hene,^ possible^ nupenkey^ =^ ntu-id,^ (nhv-id,^ name),
(otusid,^ num, email)^ ete.
candidate^ key=^ stu-id^ on^ emcil^ on^ phone^ if^ all
of
these^ unisuely^ idenhty^ each^ aludent.
wod ot (^) doswollp sno CAAN 1U
Dept} এটাও একটা key হতে পারে, কিন্তু {Name, mark} key হতে^ পারেনা।^ কারণ^ অনেকের^ name,^ mark^ একই^ হতে পারে। Super key: Attribute^ or^ set^ of^ attribute^ that
{Sid}, {Sid,^ name}^ সবাই^ supper^ key^ কারণ^ Sid^ হলো
super key^ হয়ে^ যাবে।^ Total^ super^ key^ possible=^ 2"-
নিচের Table টি দেখেন^ এখানে^ কি^ কি^ super^ key^ সম্ভব? উত্তরঃ
(^1 ) 2 1 7 1 3 1 7 1
5 2 5 1 6 2 5 2
Cloud^ IT^ Online^ Batch এখানে super key = {A}, {AB},{AC} {AD} {ABC} {ACD} {ABD} {ABCD} = 8 super key. কিন্তু identified {BCD} না। =super তাই তাদের key subset হবে না গুলো কারণ super^ তারা key^ niquely হবে না। বাস্তবে super key হলো theoretical concepts. Candidate Key: not a^ Condition super key^ 1:^ Super^ key^ whose^ proper^ subset^ is Proper^ Condition Subset:^ 2: Set^ Minimal A is considered^ Super^ key. to be a proper subset of set B if set B contains at least one element B={12,24,36}, that is A={12,24} not present Here in A set is the A. proper Here subset of B because 36 is not preset in set A. See the following table:
So. [বিঃ sup Pri nul
Candidate key
মন্তব্য second {ABC}^ yes^ No ABC এর proper^ (3NF) subset AB, AC, A, B, C যাতে A নিজেই Super condition key. 1 অনুযায়ী তাই এটা candidate key
introd Codd these depen norma {AC}^ yes^ No^ AC এর proper^ later subset A, C যাতে A নিজেই তাই condition Super key. 1 অনুযায়ী এটা candidate key না।
norma forms
{A}^ yes^ yes A এর proper subset {}._তাই^ condition^2 Candidate^ অনুযায়ী^ এটি key. {BC}^ yes^ yes BC এর proper subset B, C যা super keyCandidate না। তাই key BC
Points to remember:
Any superset of candidate key is a super key. All candidate keys are super keys. All super keys are not candidate keys. For n attributes relations, maximum super key possible: 2 𝑛^ − 1
Functional Dependency (FD): A functional dependency is written as: 𝑋 − −> 𝑌 It means, if two rows have the same value of X, they must have the same value of Y. Here, X is called determinant, and Y is called dependent attribute. Attribute closure: The closure of an attribute set X is written as 𝑋+, means, all attributes that can be determined from X using the given functional dependencies.
Q. Let’s say, R(A, B, C, D, E) and FD’s:
Step 3: Find primary key and alternate key Primary key = {A} Alternate key = {}
Q3: Given R(A, B, C, D, E) And FD’s:
Solution: Step 1: Find the Candidate key In RHS, every attributes are present. Then how we will do this one? Look at the dependency groups. A → B, B → A; means A and B can determine each other. C → D, D → C; means C and D can determine each other. To get all five attributes, we need one attribute from {A, B}, and one attribute from {C, D} So, possible combination: {AC, AD, BC, BD} 𝐴𝐶+^ = {A, C, B, D, E} = R 𝐴𝐷+^ = {A, D, B, C, E} = R 𝐵𝐶+^ = {B, C, A, D, E} = R 𝐵𝐷+^ = {B, D, A, C, E} = R All 4 are superkey. Check minimality by removing A, B, C, D one by one, and check if anyone leads to R. No one is doing so. (You can verify by finding 𝐴+, 𝐵+, … Hence, candidate key = {AC, AD, BC, BD}
Step 2: Find the super key Any super set of candidate key is super key.
N 3NF. Outline
Customen^ (eust-id,^ cust-name,
dob,^ zip,^ stmeet,^ eity,
stute,
Onden-id,^ onden-items,^ onden
amt, contact-no,^ email)
INe:^ (i)^ Ensune^ there^ is^ a^ primang^ key
Leach^ cell^ can^ centain
vilve^ attrubule
let,^ contact-no,,^ wndesitems^ aAe^ be^ m email^ ane^ multivalved^ attributes.
eaunto^ Contaet eust-id contaet-no emal
Customen cust-id,^ eust-name,^ dob,^ zip,^ Atmeet, city^ ,ntate,^ onden-id,^ onden-ilems, Onden-amt
32NF
(1)^ Remove^ Parctial^ T^ dependency.
If^ thene^ is^ a^ composile^ key
(combination^4 tero^ Pk),
nepanate^ erch^ pk^ wilh^ nelevant^ altnibutes.
um
customes^ table^ has^ composite^ krey^ (eust-id,^ ondenid) This^ creates^ pantial^ dependency.
cust_id^ Customen^ Onden cuntact-no
ewst_id^ orden-id Cust-name dob onden-id 2iP stneet city, stale
onden-ilems onden-amt id
3NF (1) Remove^ any^ fransihivel ال^ kependeng a^ non-prime^ attribute^ depends
on anothen^ non^ -prine^ attribute.
Here,^ street,^ cils,^ ntale^ of^ Customen^ table^ depends^ on ZIP unly.
Customer Location Oaden Contaet (^) ust-id cust-id eontact-no email
eust-name dob 2IP Qadesid
Zip ptneet eily Stale PER
Ondenid Onden-items Onden-amt o eust-id estP
Гине^ 24-
to
(i) Supen key (ii) Candidale key (l1)^ Non-prime^ attribule
Is^ the^ table^ in^ 3Ne?
If^ nut,^ make^ the^ table
with 3NF. Suln (i)^ Supen^ key:^ Remp-id,^ (emp-id,
e-zip),
ezir)^ ete
Now
(il)^ Candidate^ key?^ emp-id (111)^ Non-prime^ attribute^ e-name,^ e-zip, e-distinet.^ e^ -^ atale,^ e-uy,
INF:^ Atomicity^ of^ the
table^ is^ I.^ So,the^ table
is^ in^ INf.
2NE:^ No^ partial^ dependeney.
because^ emp-id^ unisuely
can^ identily^ all^ non-prime^ attribute So,^ the^ table^ is^ in^ 2NF.
Non-prime^ atteilbute^ estate,^ e-city,^ e^ district^ dep on^ another^ non-prime^ attreibute^ e-zip^ and
e-zip
depends^ on^ emp-id.^ So,^ let's^ bireah^ the^ tasle^ as^ below
Employee^ Locahion emp-id^ e-2ip e_name^ e-state e-ey e-zip e-distmict
Now,^ the^ table^ is^ in^ 3NF
I?
. Simple^ attrubute
cannot^ be^ funthen
nubdivided
into^ components.
2.^ Composite^ attribute: that^ can^ be^ aplit^ into^ components.
ex:^ name^ (7-rare,^ I_-name)
en:^ age
4.^ Mulli-valued!
Stoned
takes^ mone^ than
a^ ningle^ valve.
en:^ Phone^ (a^ penson
ean^ have^ mulhiple^ phone
no)
S^ doesn't^ neqwire^ any
update^ once^ stoned en DOB
Dertived Can be derrived trum^ othen^ attnibules
en:^ auy^ mants^ of^ Alvdent,
key- uniquely^ identify^ the^ entity en.^ RolLno
Null
an^ entity^ does^ not^ have value. Deseruphive
Stant
Mage
abuut^ the^ relahionship^ net
4
Ar. Complex attibule:
fonmed^ by^ nesting^ of^ composite^ and^ mulhi-valved
en: addness^ contain^ composite^ value^ (omeet,^ 22p^ coe)