Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2005, 03:03 AM
Authorized User
 
Join Date: Jun 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Database Structure

Quick question for the experts.

I have a huge database. There is the company table which has all companies and references to several other tables. I was just asked to create something new called zones.
Let's say Chicago is a zone so then so then I'd like Skokie, Lincolnwood, Des Plaines to all be part of it's zones. This is how I designed the database. Before I go with it I just want to see if it makes sense.
I'll have one table which lists the zones
1 Chicago
2 Brooklyn
3 Milwaukee

etc.

I'll have another table which defines the zones

1 Lincolnwood
1 Skokie
2 Sea Gate

etc.

I will then have the zone ID in the company table.

Does this make sense?
Thanks

 
Old June 21st, 2005, 06:58 AM
Authorized User
 
Join Date: May 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, that approach makes sense, but you could cut down on the number of tables if you simply made the zone NAME be the zone id rather than a number, unless there is some need to have the number instead of the name. In that way, your second table would look like this, and you wouldn't need a table to translate the zone number to it's name:

Lincolnwood Chicago
Skokie Chicago
Des Plaines Chicago
Sea Gate Brooklyn

and so on... basically for every entry there would be an associated zone. This way you could join your company table via the town name and be provided with the proper zone, without having to do a second lookup to get the zone name from the id. This becomes a simple look-up table that provides the zone name directly.



 
Old October 15th, 2005, 01:20 PM
Registered User
 
Join Date: Oct 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to karthik_p Send a message via Yahoo to karthik_p
Default

This makes total sense!!!Ever heard of Normalisation in Databases. It will help a lot.

This is what you are doing on the zone and sub-zone example.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting Structure seananderson SQL Server 2005 2 September 4th, 2007 03:29 AM
File to Structure? TheShadow C++ Programming 3 October 23rd, 2004 05:29 AM
How to hide Access database structure pavel Access 1 September 2nd, 2003 02:54 PM
How to structure query mkaufman SQL Language 6 June 10th, 2003 01:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.