Welcome to my Access Blog
Access Developer Tools
FMS Developer Tools are arguably the most comprehensive set of tools for Access, SQL Server, and .NET developers.
Access Sites and Pages
My Blog List
-
Singing (and Dancing) With Access4 years ago
-
-
-
Over Worked?7 years ago
-
Stay connected wherever work takes you8 years ago
-
-
-
-
-
Access Support Sites
Blog Archive
About Me
Let's Build Some Tables
In the last article we looked at the relationships that exist between the various products we will be using to create ice cream sundaes. These 'real world' relationships dictate the relationships we will need to establish between the tables of the database.
In this article we are going to look at what information we should be including in each table. Before doing that however, there is at least one more table that we should include in the database, flavors. Since each flavor can apply to many ice creams and some ice creams have multiple flavors, the relationship between ingredients and flavors is many to many. It is possible that some other ingredients may be multi-flavored as well but one multi-flavored ingredient is enough to make the relationship many to many.
It's important to define the relationships before finalizing table design because one to many and many to many relationships require different table structures. For a one to many relationship, you include one field in the 'many' table to identify the 'one' table record to which each 'many' record belongs. Many to many relationship require this information to be stored in an separate table with one field for each of the partner tables.
Guess what!! We have just have just identified the need for several additional tables in our 'simple' ice cream sundae database. We will need one table for each of the many to many relationships. One reason for doing detailed planning and design before actually beginning to build the actual database is to try to uncover and resolve any possible data management problems and to ensure that all the database will include all information necessary to fulfill the database's stated purpose.
In Know Your Data (Part 3) we defined the purpose of our ice cream sundae database:
This database stores information about the quantity of contents used to make ice cream sundaes. It assists with the design of new sundaes and provides reports of the ingredients required to make each type of sundae.
We have also defined a list of tables that we will need to manage the data:
- ingredients
- dishes (containers)
- sizes
- sundaes
- flavors
Now it is time to decide what data needs to be included in each table. Before we do that we should review some terms and principles required for good relational table design.
- Each table should contain information about only one topic or subject (formally known as an entity.
- All examples of a topic should be included in one table (if you have are dealing with people and occupations, you would have one people table, not separate tables for each occupational group, for example.)
- Each table has one or more fields that describe the subjects or topics stored in the table.
- Each table should have a primary key that uniquely identifies each record in the table. (I am going to leave for another time the discussion of the alternative types of primary keys.)
- A record is the collection of fields that describe one of the topics of the table.
- Data should be stored only once.
There is a set of rules known as the forms of normalization that are the guiding principles for relational database design. If you a new to database design, your initial efforts will most likely run afoul of normalization so don't be surprised when the response to questions you may ask an experienced developer about designing forms or reports refers you back to normalization issues in your basic database design.
In case you haven't noticed, we have yet to do anything with Access itself. That is because knowing how to use Access is only part of the story in building a successful database for personal or small enterprise use. We will be using Access to build and run the database but we can't build it until we have a solid design.
In the next article we will (finally) design our the tables that we will have Access manage for us.
0 comments:
Post a Comment