Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Relational Model CIS 218. Entity A Person, Place, Thing or Transaction Something the user wants to track.

Similar presentations


Presentation on theme: "The Relational Model CIS 218. Entity A Person, Place, Thing or Transaction Something the user wants to track."— Presentation transcript:

1 The Relational Model CIS 218

2 Entity A Person, Place, Thing or Transaction Something the user wants to track

3 Attribute A Property that describes an entity Also called a Field Title Author Number of Pages Subject ???

4 Attribute A Property that describes an entity

5 Identifier An attribute that names, or identifies, an entity instance May or may not be unique Ludwig

6 Primary Key A unique identifier

7 Relation A relation is a two-dimensional table that has specific characteristics 2-7

8 Characteristics of a Relation Consists of columns and rows Each row contains data about one entity Each columns contains data about one attribute of the entity All entries in a column are of the same kind Each cell of the table holds a single value Each column has a unique name No two rows may be identical 2-8

9 Is this a Relation? 2-9 EmployeeNumberPhoneLastName 100335-6421 454-9744 Abernathy 101215-7789Cadley 104610-9850Copley 107299-9090Jackson

10 Is this a Relation? 2-10 EmployeeNumberPhoneLastName 100335-6421Abernathy 101215-7789Cadley 104610-9850Copley 100335-6421Abernathy 107299-9090Jackson

11 Is this a Relation? 2-11 Employee Number PhoneName 100335-6421RobinAbernathy 101215-7789JessicaCadley 104610-9850RogerCopley 105222-8873GurpreetKaur 107299-9090JazmyneJackson

12 Is this a Relation? 2-12 Employee Number PhoneNameNumber 100335-6421Robin123 101215-7789Jessica$27.45 104610-9850RogerFourteen 105222-8873Gurpreet37 107299-9090Jazmyne5-06-65

13 Is this a Relation? 2-13 EmployeeNumberFirstNameLastName 100MaryAbernathy 101JerryCadley 104AlexCopley 107MeganJackson

14 A Composite Key A primary key made up of two or more attributes (columns) For a key to be unique, often it must become a composite key – Example: How would I look up a grade? 2-14

15 A Candidate Key A candidate to become the primary key A unique identifier – SID, SSN 2-15

16 A Surrogate Key A unique, numeric value that is added to a relation to serve as the Primary Key Has no meaning to users Usually hidden in forms, queries and reports In Access, uses an AutoNumber 2-16

17 Relationships Associations between entities

18 Relationships Between Tables A table may be related to other tables – An Employee is assigned to a Car – A Student takes a Class To relate tables, create a foreign key – Also called a linking column A foreign key is a primary key from one table placed into another table 2-18

19 Foreign Key Example 2-19 Project ProjID ProjName MgrID Manager MgrID MgrName Foreign Key

20 Foreign Key Example 2-20 Department DeptID DeptName Location Employee EmpID DeptID EmpName Foreign Key

21 Foreign Key Example 2-21 Song SongID SongName Time Artist ArtistID ArtistName Foreign Key ArtistID

22 Referential Integrity Every foreign key value must match a value of an existing primary key Therefore, the primary key value must exist before the foreign key value is entered 2-22

23 2-23

24 Referential Integrity Each value of the Foreign Key OwnerID in PET must exist in The values of the Primary Key OwnerID in OWNER 2-24

25 Foreign Keys in Microsoft Access 2-25


Download ppt "The Relational Model CIS 218. Entity A Person, Place, Thing or Transaction Something the user wants to track."

Similar presentations


Ads by Google