Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 155 Table Relationship

Similar presentations


Presentation on theme: "CIS 155 Table Relationship"— Presentation transcript:

1 CIS 155 Table Relationship

2 Examining Access Objects
The seven Access objects. Database Queries Based on tables Forms Reports Pages Forms, Reports, and Pages are based on tables or queries Macros Modules

3 Examining Access Objects (cont.)

4 Examining Relationships
An Access database is a relational database because more than one table can share information or “relate.” Minimizes redundant information The process of designing a relational database is called normalization, which involves determining appropriate fields, tables, and table relationships

5 Examining Relationships (cont.)
Enforce Referential Integrity. Means that you cannot enter values in the foreign key field unless you first enter them in the primary key field Also means that you cannot delete records in the “one” table if the “many” table has corresponding related records Cascade Update Related Fields. Automatically updates the data in the foreign key field when the matching primary key field is changed

6 Examining Relationships (cont.)
Cascade Delete Related Fields. Automatically deletes all records in the “many” table if the record with the matching field in the “one” table is deleted

7 Examining Relationships (cont.)
Foreign key field Data number type

8 Examining Relationships (cont.)
“many” table “one” table Linking field Relationship type

9 Examining Relationships (cont.)
One-to-many link with referential integrity “One” symbol Primary key field in the “one” table Foreign key field in the “many” table “Many” symbol

10 Examining Relationships (cont.)
Relationship types

11 Relational Databases (cont.)
Tables in the same database should be related, or linked, through a common field in a one-to-many relationship The primary key field in one of the tables creates the “one” side of the relationship and the foreign key field in the other table creates the “many” side of the relationship The foreign key field contains the same value “many” times to create a one-to-many relationship between the tables

12 Examining Relational Databases (cont.)
A single table with duplicate information

13 Relational Databases (cont.)
One-to-many relationships

14 Relational Databases (cont.)
Many-to-many relationships. To join two tables that have a many-to-many relationship, you must establish a third table, called a junction table A junction table creates separate one-to-many relationships with the two original tables

15 Planning Related Tables and Lookups
A well designed database minimizes redundant data. Related tables planning guidelines. List all of the fields of data that need to be tracked Group fields together in subject matter tables Identify primary key fields that exist in tables Link the tables with a one-to-many relationship via a common field

16 Planning Related Tables and Lookups (cont.)
Related tables planning guidelines (cont.) Create lookups Lookups are reference tables or lists that are used to populate the values of a field Lookups are established by adding properties to the field for which you want to lookup behavior to occur Fields that contain lookup properties are called lookup fields

17 Planning Related Tables and Lookups (cont.)
One-to-many relationship Linking SSN field Linking CourseID field

18 Planning Related Tables and Lookups (cont.)
Lookup fields

19 Planning Related Tables and Lookups (cont.)
Identifying key field combinations. Identifying a single primary key field may be difficult in some tables When individual fields can’t serve as a valid key field, combine fields together to make a key field combination

20 Creating Related Tables
All characteristics of a table are defined in the Table Design View. Field names, data types. Field descriptions, primary key field A key symbol indicates that a field is defined as the primary key field

21 Creating Related Tables (cont.)
Primary Key button

22 Creating Related Tables (cont.)
Comparing linked to imported tables. The data in a linked table is stored in a file that is separate from the open database An Excel workbook can be linked to Access An imported table is a copy of data from an external file. Works the same as a table created in Access

23 Creating One-to-Many Relationships
Once the initial database design and table design is completed, you need to link the tables together. Use a one-to-many relationship Create queries, reports, and forms with fields from multiple tables

24 Creating One-to-Many Relationships (cont.)
“Many” side of the one-to-many relationship Bold identifies a primary key field “One” side of the one-to-many relationship

25 Creating One-to-Many Relationships (cont.)
Enforcing referential integrity. Referential integrity is a set of rules that help ensure that no orphan are entered or created in the database An orphan record is a record in the “many” table that doesn’t have a matching entry in the linking field of the “one” table Prevents a user from deleting a record from the “one” table if a matching entry exists in the linking field of the “many” table


Download ppt "CIS 155 Table Relationship"

Similar presentations


Ads by Google