Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
804
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
18
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Test 2 Review
    CIS-145
  • 2. Relational Databases
    Have more than one table where tables are related to each other
    One to one
    One to many
    Many to many
    A combination of fields may be used for the table’s primary key
  • 3. One to Many Relationships
    Each table contains data about a specific subject (customers, loans)
    Each table on the ‘one’ side has a primary key
    Primary key of the “one” table is a foreign key in the many table
  • 4. Many to Many Relationships
    Two tables are related, but can have many records in each table in common
    One student can attend many courses; one course can be attended by many students
    Implement a many to many relationship by creating a pair of one to many relationships with a third table
    Third table is often referred to as a “join” or “junction” table
    Entries in the join table point to rows in the original tables
  • 5. Foreign Key
    A foreign key points to a record in another table
    Foreign key “looks like” the related primary key
    Same number of fields
    Data types for each field must match
    Field names don’t matter
  • 6. Referential Integrity
    Makes sure that the records in related tables are consistent
    Must have a customer in the customer table for an order assigned to that customer
    Avoids “orphans”
    Cannot delete a record or change the primary key in the one table when associated records are in the many table, unless have cascade delete and cascade update enabled
  • 7. Editing Data
    Making new entries, changing existing entries, and deleting rows are all affected by referential integrity
    A customer can be added at any time
    Must have a customer before a loan can be entered and associated with a customer
    Referential integrity doesn’t require entry into a foreign key
    Can delete a loan at any time, but can only delete a customer if they don’t have any loans (assuming no cascade delete)
  • 8. Cascading Changes
    When referential integrity is enforced can choose to include Cascade Update and/or Cascade Delete
    Cascade update passes changes to the primary key of the “one” table to the related rows in the “many” table
    Cascade delete removes rows from the “many” table when a primary key (row) is deleted from the “one” table
  • 9. Relationships Window
    Where relationships between tables are created and defined
    Related fields must have the same data type
    Autonumber is related to number field with long integer field size
    The one table has a 1 next to it; the many has a  next to it
  • 10. Autolookup Queries
    Use queries to automatically look up data from related tables
    Must contain the foreign key from the many table
    Can add, change or delete data in the source tables