Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Relational Model J.G. Zheng May 15 th 2008. Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.

Similar presentations


Presentation on theme: "The Relational Model J.G. Zheng May 15 th 2008. Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized."— Presentation transcript:

1 The Relational Model J.G. Zheng May 15 th 2008

2 Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized in relations (tables), which are linked (relationship) by keys

3 Relation A relation is a two-dimensional table that has specific characteristics: The table consist of rows and columns Rows contain data about an entity instances All values in a row describes the same entity instance Columns contain data about attributes of the entity All values in a column are of the same kind

4 Relation (continued) Relations specific characteristics go on: Cells of the table hold a single value Each row is distinct Each column has a unique name The order of the rows is unimportant The order of the columns is unimportant

5 Non-Relation Examples

6 Relation Examples

7 Relation Terminology Contrast TableRowColumn *EntityRecordField Relation[Tuple]Attribute

8 Keys A key is one or more columns of a relation that is used to identify a record Primary key Foreign key

9 Primary Key Primary key The value of this key column uniquely identifies a single record (row) There is only one primary key for a table Composite key A key that contains two or more attributes (columns) Example: FirstName + LastName FirstName + LastName + BirthDate FirstName + LastName + BirthDate + BirthCity …

10 Relationship and Foreign Key Relationship defines how tables (relations) are linked Two tables are linked by a pair of keys The primary key of one table The foreign key in the linked table These two keys are of the same kind

11 Relationship Example Primary Key (PK) Foreign Key

12 Relationship Types One-to-one Example: students and GSU network accounts One-to-many Example: students and diplomas Many-to-many Example: students and professors

13 Referential Integrity Every value of a foreign key must match a value of the primary key For example (Premiere Products database) In Customer table, RepNum is a foreign key (linked to the Rep table where RepNum is the primary key). Then every value of RepNum in the Customer table must exist in the Rep table

14 Summary Understand three important concepts of relational database model Relation Keys Primary key Composite key Foreign key Relationship


Download ppt "The Relational Model J.G. Zheng May 15 th 2008. Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized."

Similar presentations


Ads by Google