Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relations The Relational Data Model John Sieg, UMass Lowell.

Similar presentations


Presentation on theme: "Relations The Relational Data Model John Sieg, UMass Lowell."— Presentation transcript:

1 Relations The Relational Data Model John Sieg, UMass Lowell

2 A Relation (or Table) attributes (columns) tuples (rows) John Sieg, UMass Lowell

3 Relational Model: Definitions domain - a set of scalar values relation on D1,...,Dk (Codd’s definition): a mathematical relation on D1,...,Dk, i.e., a subset of D1 x...x Dk doesn’t model attribute names John Sieg, UMass Lowell

4 Definitions, cont’d scheme - a set S of objects called attribute names or attributes. Each attribute has a domain, i.e., there is a function dom: S -> {domains} tuple t on scheme S = {A1,..., An} - mapping from S to values that are in the appropriate domains, i.e., t(Ai) is in dom(Ai) John Sieg, UMass Lowell

5 Definitions, cont’d Relation on scheme S - a set of tuples on S cardinality, degree Properties of relations (Date): –There are no duplicate tuples. –Tuples are unordered. –Attributes are unordered. –Attribute values are atomic. A database is a set of named relations. John Sieg, UMass Lowell

6 Candidate Keys candidate key of a relation R - a subset K of R’s scheme having the properties that –(Uniqueness property) No two distinct tuples have the same value(s) for K –No proper subset of K has the uniqueness property. True over all time! Every relation has at least one candidate key. John Sieg, UMass Lowell

7 Primary & Foreign Keys One of a relation’s candidate key’s is designated to be a primary key. A foreign key in a relation refers to the primary key of some relation. John Sieg, UMass Lowell

8 Integrity and Keys (C. J. Date) The entity integrity rule - No component of a primary key is allowed to accept nulls. The referential integrity rule - The database must not contain any unmatched foreign key values. John Sieg, UMass Lowell


Download ppt "Relations The Relational Data Model John Sieg, UMass Lowell."

Similar presentations


Ads by Google