Download presentation
Presentation is loading. Please wait.
Published byVictoria Gray Modified over 9 years ago
1
Copyright, Harris Corporation & Ophir Frieder, 19981 Relational Definitions
2
Copyright, Harris Corporation & Ophir Frieder, 19982 Objectives To define basic relation terms including entity, attribute, domain, relation, relational scheme, and functional dependency.
3
Copyright, Harris Corporation & Ophir Frieder, 19983 Relational Terminology A domain is a set of scalar values, all of the same type. Examples: US city names- {San Diego, Miami, etc} The names of US States- {Texas, New York, etc} City populations- {1,2,3,...} (positive integers)
4
Copyright, Harris Corporation & Ophir Frieder, 19984 Relational Terminology, Cont. A relation is a subset of the Cartesian product of one or more domains. Example: {(San Diego,California,2655463), (Miami,Florida,3514403), (Syracuse,New York,745691)}
5
Copyright, Harris Corporation & Ophir Frieder, 19985 Relational Terminology, Cont. A tuple is one member of a relation. Example: (Miami,Florida,3514403)
6
Copyright, Harris Corporation & Ophir Frieder, 19986 Relational Terminology, Cont. It is helpful to view a relation as a table, where each row is one tuple and each column is one attribute. Note that the relation may not actually correspond to one table in the final design - for the purposes of performance it may be combined with other tables, or broken into multiple tables. A relational scheme is the set of attributes associated with a relation.
7
Copyright, Harris Corporation & Ophir Frieder, 19987 Example - Relations
8
Copyright, Harris Corporation & Ophir Frieder, 19988 Functional Dependencies Depending on the meaning of the attributes some subsets of the Cartesian product are not valid relations.
9
Copyright, Harris Corporation & Ophir Frieder, 19989 Functional Dependencies, Cont. Let R be a relational scheme with attributes A 1, A 2,..., A n. Let X and Y be subsets of {A 1, A 2,..., A n }. We say that Y is functionally dependent on X in R, denoted X=>Y, if it is not possible for two distinct tuples in R to have the same value for the attributes in X, and different values for the attributes in Y. Alternatively, we say X functionally determines Y. Informally, if you know the left-hand-side, then you know the right- hand-side.
10
Copyright, Harris Corporation & Ophir Frieder, 199810 Functional Dependencies, Cont. SS# => NAME SS# => DATE-OF-BIRTH
11
Copyright, Harris Corporation & Ophir Frieder, 199811 Functional Dependencies, Cont. Note that the two functional dependencies: SS# => NAME SS# => DATE-OF-BIRTH Could be represented by the single functional dependency: SS# => NAME, DATE-OF-BIRTH Both representations have advantages, and will be used as appropriate.
12
Copyright, Harris Corporation & Ophir Frieder, 199812 Functional Dependencies, Cont. What are all of the possible functional dependencies for the relational scheme R=(SS#,NAME,DATE-OF-BIRTH)? Which of these hold “in the real world?”
13
Copyright, Harris Corporation & Ophir Frieder, 199813 Functional Dependencies, Cont. Functional dependencies are a result of what the attributes mean. A functional dependency is a statement about a relational scheme (i.e., all possible relations), and cannot be deduced from a particular relation. A functional dependency is said to be trivial if. Some functional dependencies can be enforced by a DataBase Management System (DBMS).
14
Copyright, Harris Corporation & Ophir Frieder, 199814 Candidate Key An Informal Definition Let R be a relational scheme. A candidate key for R is a subset of the set of attributes of R, say K, such that –Uniqueness property: No two distinct tuples of R have the same value for K. –Irreducibility property: No proper subset of K has the uniqueness property.
15
Copyright, Harris Corporation & Ophir Frieder, 199815 Candidate Key, Cont. SS# is a candidate key for the following. SS# => NAME SS# => DATE-OF-BIRTH
16
Copyright, Harris Corporation & Ophir Frieder, 199816 Candidate Key, Cont. Which of the following would be candidate keys? SS# NAME DATE-OF-BIRTH SS#, NAME SS#, DATE-OF-BIRTH NAME, DATE-OF-BIRTH
17
Copyright, Harris Corporation & Ophir Frieder, 199817 Candidate Key A More Formal Definition Let R be a relational scheme with attributes A 1, A 2,..., A n and functional dependencies F. In addition, let X be a subset of A 1, A 2,..., A n. Then X is a candidate key for R if –X => A 1, A 2,..., A n is in F +, and –for no proper subset Y of X is it the case that Y => A 1, A 2,..., A n is in F +.
18
Copyright, Harris Corporation & Ophir Frieder, 199818 Closure Of A Set Of Dependencies Question:What is F + ? Answer:F + is the closure of F - the set of all dependencies derivable from F. Equivalently, F + is the set of all dependencies that follow from F by Armstrong’s axioms.
19
Copyright, Harris Corporation & Ophir Frieder, 199819 Armstrong’s Axioms Tangent! Let R be a relational scheme with attributes U and functional dependencies F. Reflexivity - If Y is a subset of X, then X=>Y. Augmentation - If X=>Y, and Z is a subset of U, then XZ=>YZ. Transitivity - If X=>Y and Y=>Z, then X=>Z.
20
Copyright, Harris Corporation & Ophir Frieder, 199820 Keys - Additional Terminology Often times a relation will have more than one candidate key. In such cases one is sometimes designated as the primary key. Any superset of a candidate key is often times referred to as a superkey. Some authors will refer to any candidate key as simply a key, while others will use this to refer to a primary key. Throughout this course, the term key will be used synonymously with the phrase candidate key.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.