× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Here is the way I would do it:

Protein File:
ProteinID, Name

Starch File:
StarchID, Name

Vegtable File:
VegtableID, Name

ProteinStarchMap File:
ProteinStarchMapID, ProteinID, StarchID

ProteinVegtableMap File:
ProteinVegtableMapID, ProteinID, VegtableID

Make all the ID columns IDENTITY columns so they get unique ID's.


-----Original Message-----
From: James H. H. Lampert [mailto:jamesl@xxxxxxxxxxxxxxxxx]
Sent: Wednesday, December 10, 2014 11:36 AM
To: Midrange Systems Technical Discussion
Subject: Database design issue: seems really bad, yet I'm having trouble coming up with anything better

Consider this scenario:

We have three sets of items. To avoid discussing the real-world situation, I'll use a food analogy, and call them protein, starch, and vegetable.

We have perhaps as many as 300 distinct protein items (to which others may be added in the future), some 60 starch items (to which others may be added in the future), and some 80 vegetable items (once again, to which others may be added in the future). A complete meal includes a protein, an arbitrary number of starches, and an arbitrary number of vegetables.

We always select the protein first. Each protein has its own subset of compatible starches and vegetables, e.g., if the protein is prime rib,
10 oz cut, then the available starches would include Yorkshire pudding, mashed potatoes, and baked potato, and the available vegetables would include creamed spinach and creamed corn, while if the protein is roast turkey, 8 oz, then the starches might be dressing and mashed potatoes, and the vegetables might be creamed corn, Brussels sprouts, and carrots.

Now, the solution that's been presented to me is for the protein file to have a record for every protein, the starch file to have a record for every valid combination of one protein and one starch, and the vegetable file to have a record for every valid combination of one protein and one vegetable.

Something about this seems wrong. Mainly because it would produce so many starch and vegetable records, repeating any given starch or vegetable for every protein with which it's a valid combination.

Yet I'm having trouble coming up with anything better. Any suggestions?

--
JHHL
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.