Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review Types of Relationship – there are in general three different types of relationships - One to One – where each record in one table can have not more.

Similar presentations


Presentation on theme: "Review Types of Relationship – there are in general three different types of relationships - One to One – where each record in one table can have not more."— Presentation transcript:

1 Review Types of Relationship – there are in general three different types of relationships - One to One – where each record in one table can have not more than one matching record in the other table. - One to Many – where each record in the first table can have many matching records in the second table, but each record in the second table can have only one matching record in the first table. - Many to Many – each record in the first table can have one or more related records in the second table and the second table can have one or more related record in the first.

2 Review Enforcing Referential Integrity – ensures that the foreign key value always has a matching value in the primary key. Cascade Update Related Fields – If you change the primary key value in the primary table, access automatically changes the value in the related fields. Cascade Delete Related Fields – If you delete the primary key value in the primary table, access automatically deletes the value in the related fields.

3 Further practice of creating relational tables Create the following tables and create a relationship between them

4 Table Design : Joins In this chapter we discuss how to combine information from two tables. When this is done, it is referred to as a join. We will look at four types of joins - Inner Join - Right Outer Join - Left Outer Join - Self Join Definition: Join - The process of combining records from two tables Inner Join: In this case the query returns only records that have matching values in their related fields. It omits unmatched values in both tables. Go ahead and perform an inner join on Members and Loans

5 Table Design : Joins Left Outer Join: This is when a query returns all records from the primary table but only matching records from the related table. When we do the example of members and loans it returns all records from the Members table (primary table) that do not have matching records in the loans table. In these records the fields from the loans table are blank. The query ignores the two records in the loans table that have no matching record in the members table Right Outer Join: is one in which a query returns all records from the related table but only matching records from the primary table. Self Join: is one in which a table is joined to itself. This is a useful example, when you want to find records that have the same values in one or more fields in the same table.

6 Table Design : Joins Self Join: is one in which a table is joined to itself. This is a useful example, when you want to find records that have the same values in one or more fields in the same table. If we run a query on Members it returns a list of all members that reside at the same address. Now run each type of Join on the members and loans tables created in earlier lectures.

7 Table Design : Joins

8 Quick Quiz – Q1 – In a query, which join type returns all records from the primary table but only matching records from the related table? a)Inner Join b)Left Outer Join c)Right Outer Join Q2 – In a query, which join type returns all records form the related table but only matching records from the primary tabel a)Inner Join b)Left Outer Join c)Right Outer Join Q3 – Where do you set the default join type for a relationship? a)In the Join Properties dialog box when creating a query b)In the Edit relationship dialog box when creating a relationship in the relationship window c)In the Join Properties dialog box when creating a relationship in the relationship window

9 Table Design : Joins Quick Quiz – Q4 – True or False – you can join two tables in a query even when no relationship has been created between the tables a)True b)False Q5 – True or false – you can create a permanent relationship between two tables by joining them in a query a)True b)False Q6 – Which of the following must be true in order to join two tables in a query? a)The related fields must have the same name b)The related fields must have the same data type c)The related fields must have the same or compatible data type.


Download ppt "Review Types of Relationship – there are in general three different types of relationships - One to One – where each record in one table can have not more."

Similar presentations


Ads by Google