Lecture 1 of Advanced Databases Basic Concepts Instructor: Mr.Ahmed Al Astal
Page 2 Basic Concepts Introduction and basic definitions ER Modeling. ER-Relational Schema Mapping Database Languages. FDs and Normalization. Agenda
Page 3 Basic Concepts Database : A set of related data. Database management Systems (DBMS): software package/ system to facilitate the creation and maintenance of a computerized database. Database System: The DBMS software together with the data itself. Sometimes, the applications are also included. Introduction and basic definitions
Page 4 Basic Concepts Database Administrator (DBA). Database Designer. End Users Application Programmers. Database Users
Page 5 Basic Concepts ER Model: is a logical model that used for describing Entities and the relationships between these entities. ER Symbols: ER Modeling Meaning ENTITY TYPE WEAK ENTITY TYPE RELATIONSHIP TYPE IDENTIFYING RELATIONSHIP TYPE ATTRIBUTE Symbol Meaning KEY ATTRIBUTE MULTIVALUED ATTRIBUTE COMPOSITE ATTRIBUTE DERIVED ATTRIBUTE Symbol
Page 6 Basic Concepts
Page 7 Basic Concepts Mapping of Regular Entity Types Mapping of Weak Entity Types Mapping of Binary 1:1 Relation Types Mapping of Binary 1:N Relationship Types. Mapping of Binary M:N Relationship Types. Mapping of Multi-valued attributes. Mapping of N-ary Relationship Types ER to Relational Mapping
Page 8 Basic Concepts Procedural Languages: Relational Algebra, Relational Calculus, Cobol,…. Non Procedural Languages: SQL DDL: Create, Alter Table, Drop Table DML: Select, Update, Delete Database Languages
Page 9 Basic Concepts Functional dependencies (FDs) are used to specify formal measures of the "goodness" of relational designs. FDs are constraints that are derived from the meaning and interrelationships of the data attributes. SSN ENAME Level, Experience_Years Salary FDs & Normalization
Page 10 Basic Concepts IR1. (Reflexive) If Y ⊇ X, then X -> Y IR2. (Augmentation) If X Y, then XZ YZ (Notation: XZ stands for X U Z) IR3. (Transitive) If X Y and Y Z, then X -> Z Inference Rules for FDs
Page 11 Basic Concepts Some additional inference rules that are useful: (Decomposition) If X YZ, then X Y and X Z (Union) If X Y and X Z, then X YZ (Pseudo transitivity) If X Y and WY Z, then WX Z Inference Rules for FDs
Page 12 Basic Concepts Normalization: The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations First Normal Form. Second Normal Form. Third Normal Form. BCNF Normalization
Page 13 Basic Concepts Disallows -composite attributes -Multi-valued attributes -nested relations; attributes whose values for an individual tuple are non-atomic First Normal Form
Page 14 Basic Concepts Given a relation R and a set of FDs F hold on R, R is in BCNF (i.e. R is a good relation) iff for each FD in the form α -> β in F : α must be a super key If any FD fails then we divide the relation into tow relation R1(α, β), R2(R- β). BCNF (Boyce-Coded Normal Form)
Page 15 Basic Concepts Given a relation R and a set of FDs F hold on R, R is in 3NF iff for each FD in the form α β in F at least one of the following conditions satisfies: -α must be a key for R OR -Each attribute in β is Prime attribute If any FD fails then we divide the relation into tow relations: R1(α, Non Prime Attributes in β ), R2(R- Non Prime Attributes in β ). Third Normal Form 3NF
Page 16 Basic Concepts Given a relation R and a set of FDs F hold on R, R is in 3NF iff for each FD in the form α β in F at least one of the following conditions satisfies: -α must be a key for R OR -Each attribute in β is Prime attribute -α is not a subset of any key If any FD fails then we divide the relation into tow relations: R1(α, Non Prime Attributes in β ), R2(R- Non Prime Attributes in β ). Third Normal Form 2NF