Distributed Database Management System Lecture 05
Virtual University of Pakistan Data Model A set of tools/ constructs used to model a database Record/Semantic Virtual University of Pakistan
Virtual University of Pakistan Legacy Data Models Hierarchical Network Relational Virtual University of Pakistan
Virtual University of Pakistan Relational Data Model Two major Strengths Three Components Relational databases based on relational Data Model Virtual University of Pakistan
Virtual University of Pakistan A relation R defined over domains D1, D2, …., Dn is a set of n-tuples, <d1, d2, …, dn> such that <d1 D1……, dnDn Virtual University of Pakistan
Virtual University of Pakistan Schemes in RDB EMP(eNo, eName, eTitle, eSal, pNo, eResp, pDur) PROJ(pNo, pName, bud) Virtual University of Pakistan
Virtual University of Pakistan Each of the attribute in these two relations has a domain, like… Domains need not to be distinct Virtual University of Pakistan
Keys
Virtual University of Pakistan Primary Key Minimum nonempty subset of a relation whose values uniquely identify each tuple in relation Virtual University of Pakistan
Virtual University of Pakistan The superset of the key is super key, like… We also have candidate, alternate, secondary, foreign Virtual University of Pakistan
Table
Virtual University of Pakistan Relation represented in a two dimensional form eDur eResp pNo eSal eTitle eName eNo EMP pBud pName pNo PROJ Virtual University of Pakistan
Virtual University of Pakistan eDur eResp pNo eSal eTitle eName eNo E01 E03 E05 E06 E07 E08 Naeem Rahila Narjis Aslam Hafeez Liaqat Supr Desin Prog Eng Anlyst 500 700 850 900 P1 P2 P3 Work Mangr Cons 12 7 15 10 Virtual University of Pakistan
Virtual University of Pakistan After defining a relation’s scheme, it is populated Tuples are rows and attributes are cols Virtual University of Pakistan
Virtual University of Pakistan Attributes get values from same domain Can have NULL value, but…. Virtual University of Pakistan
Virtual University of Pakistan Normalization Step-by-step reversible process to produce anomalies free smarter tables Virtual University of Pakistan
Virtual University of Pakistan Anomalies Types…. Major step is decomposition Universal Relation approach Virtual University of Pakistan
Virtual University of Pakistan Three Normal Forms BCNF Lossless decomposition Dependency preservation Virtual University of Pakistan
Virtual University of Pakistan Dependency Structure Norm. based on dependencies Up to BCNF on FDs MVD and P-JD Virtual University of Pakistan
Virtual University of Pakistan Dependencies A relation R defined on attributes A(A1, A2, …., An), if XA, YA, if for each value of X Virtual University of Pakistan
Virtual University of Pakistan there is a unique value in Y, then X functionally determines Y, X Y Virtual University of Pakistan
Virtual University of Pakistan If X Y and there is a ZX and ZY, then X partially determines Y or Y is partially dependent on X Virtual University of Pakistan
Virtual University of Pakistan A relation R defined on attributes A(A1, A2, …., An), if XA, YA, ZA, if for each value of X, there is Virtual University of Pakistan
Virtual University of Pakistan there is unique value of (Y,Z) pair and Z depends only on X then X multidetermines Z, X Z Virtual University of Pakistan
Virtual University of Pakistan P-J Dependency A relation R defined on attributes A(A1, A2, …., An), if XA, YA, ZA, if R is equal to join of X, Y and Z then (X, Y, Z) constitute project-join dependency for R Virtual University of Pakistan
Virtual University of Pakistan 1NF, attributes have only atomic values 2NF, there are no partial dependencies 3NF, for each XY where Y is not in X, either X is a superkey of R or Y is prime attribute Virtual University of Pakistan