Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Home > TechHelp > Directory > Access > Cascading Without VBA > Avoiding Redundant Foreign Keys by Thomas Gonder >
Back to Cascading Without VBA    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |
Avoiding Redundant Foreign Keys
Thomas Gonder 
       
3 days ago
If we have the city, why are we storing the state and country in the CustomerT record?

Even deeper, if we have zip code (or a postal code) why have city & state at all? Country is still needed in this case.

We are aware that if you want the actual city where a customer is found, that the postal city is often where the post office is (at least in the USA), not necessarily the city where the customer is?
Richard Rost  @Reply  
          
3 days ago
You're absolutely right in a perfectly relational sense. If City is dependent on State and State is dependent on Country, then there's no need to store StateID or CountryID in CustomerT once you have CityID. You can derive them through the relationships.

ZIP codes aren't always a perfect relationship, though. A ZIP code can span multiple cities, and a city can have multiple ZIP codes. I built a database for one of the TechHelp lessons where you enter a ZIP code and it returns the possible cities for that ZIP code.

This was just a quick, simple example for the class. A more natural real-world example might be Department, then Category, then Product. Once you store ProductID, you don't need to also store the DepartmentID and CategoryID because those can be derived from the product relationship.
Richard Rost  @Reply  
          
3 days ago
Of course. In a fully normalized design, you would normally store only the lowest-level foreign key and derive the higher-level values through the relationships.

There are cases where you might intentionally store those additional foreign keys, though, particularly if you have a very large table and frequently run reports grouped or filtered by something like Country. Keeping CountryID in the record can avoid extra joins and make those reports simpler or faster. That's called denormalizing the database.

It's not something you need to do very often, and it does mean you have to make sure the redundant values stay consistent. But it's a valid practical tradeoff when the performance or reporting benefit justifies it.
Thomas Gonder OP  @Reply  
       
3 days ago
Ha ha, don't get me started for when the client says, "But we keep that screwdriver in the hardware and automotive departments." And I ask, "How am I supposed to know which department the customer took the screwdriver from when it's at the checkout register?"
Richard Rost  @Reply  
          
3 days ago
Exactly. The database knows where the inventory is assigned or stocked, but unless you track the specific bin, department, or fulfillment location as part of the sale, you can't magically know which physical screwdriver the customer grabbed at checkout.

That's where real-world business rules start complicating an otherwise nice, clean relational model.
Add a Reply Upload an Image
Next Unseen

 
 
What's This?

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 10/5/2026 4:10:34 PM. PLT: 0s