![]() |
Access Basics:
|
![]() Did you want: Working with Databases: Access 2007, 2010, 2013, 2016 | ||||
|
![]() |
A single table in a database is a lonely and weak thing. Several related tables can be much more efficient and powerful. By creating multiple tables and establishing relationships between the tables, you can drastically increase the usefulness of the database. It makes it easier to store more information and to answer more complex questions. Examples below are from starwars.mdb. RelationshipsTables are related when they share a field. It reduces confusion to use the same name in both tables. In the illustration below, there are four tables. The shared fields are EpisodeID, CategoryID, and SupplierID, which are the primary key fields in their own tables. These are called foreign keys for the Star Wars Collectibles table.
|
![]() |
Project 2: Access Basics
|
||||||
Why Use Related Tables?Even with just a few related tables, you can save yourself a lot of typing and a lot of confusion. Saves repeating data: Without a table Suppliers, each record in the main table, Star Wars Collectibles, would include all of the supplier's information. So much extra typing! With a related Suppliers table, you only need to enter the supplier's ID number in the record. Avoids typing errors/inconsistencies: Different versions of a value will sort and filter differently. Can you get it right every time? "1 - The Phantom Menace 1999" is not the same as "The Phantom Menace" or, when your fingers get uncooperative, "Teh Phantom Memace"! With a related Episodes table all of that is decided once. Then you just have to get the episode's ID number into the field in the main table. The easiest way is a Lookup list.
The more records you have and the more information that would be duplicated in each one, the more attractive a relational database becomes. Types of RelationshipsThere are three kinds of relationships between tables.
~~ 1 Cor. 10:31 ...whatever you do, do it all for the glory of God. ~~ |