Results 1 to 10 of 10
  1. #1
    kopbad is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    5

    Singly linked, dynamic array, or both?

    Hello everybody, I have done a lot of thinking and have come up with a few solutions to my problem. As for determining which solution is best, I'm hoping you might help me out. I Pardon the lengthy setup and let me know if this is confusing.
    Using this as an example, say my array of information looks like this:
    Organism Array
    Kingdom Phylum Class Order Family Description
    Animal Any animal
    Animal Chordate Mammal Bestia Sus Pig
    Animal Chordate Mammal Bestia Dasypus Armadillo
    Animal Chordate Mammal Ferae Canis Dog
    Animal Chordate Mammal Ferae Felis Cat
    Animal Chordate Fish Abdomanales Salmo Salmon
    Yes, I know this is not correct, it is just an example. Also keep in mind Animal could Plant, Fungi or whatever.
    Now to make things interesting, any user may own one or more of these species at their location. The end goal is to allow users find other users that own a certain species or a type of species in a given area.

    Following normalization rules I think this array would be split into many different tables. For example, the kingdom table lists kingdoms and links to animal, plant, fungi, .... tables. The animal table links to chordate, .... tables. Plant table links to monocot, .... tables. This continues to breakdown until the last set of order tables. Ultimately this means there are a lot of tables and each search moves through several nodes.

    An example search could be: User 123 is searching for other users within a given radius who own some type of fish AND some type of ferae. First step is to find all users within the radius. Second, out of that list eliminate users who do not own a fish. Third, eliminate users who do not own a ferae. Lastly, Display that list to User 123. Is this correct?

    The ultimate question is this, am I better off having a normalized trove of tables, one table for each category along the line.(Each table would have a description column) One large table which would repeat animal, plant, and others many times. Or would it benefit me to have both? In the large table each listing would have its own id which could be indexed, and the many smaller tables would be used to generate the correct id. Whenever an update was needed it would occur on the corresponding small tables and the large table would be regenerated from the updated small ones. User searches would use the smaller tables to generate an id or range of ids to display which it then grabs from the large table. User accounts who own a species would link to the large table in a many to many relationship I believe.

    Am I correct in my thinking? What is everybody else's thoughts on this conundrum?

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Normalized tables are fundamental to good database design. Without proper normalization, you will create a big mess.


    For example, the kingdom table lists kingdoms and links to animal, plant, fungi, .... tables. The animal table links to chordate, .... tables. Plant table links to monocot, .... tables. This continues to breakdown until the last set of order tables. Ultimately this means there are a lot of tables and each search moves through several nodes.
    However, your interpretation of normalization as described above is incorrect. The kindom table would hold 6 records (animal, plant, fungi, protozoa, bacteria, chromista). Your phylum table would hold all phyla as records. You would have a field that relates the particular phylum back to the particular kingdom to which it belongs.

    tblKindoms
    -pkKindomID primary key, autonumbe
    -txtKindomName

    tblPhyla
    -pkPhylaID primary key, autonumber
    -txtPhylumName
    -fkKingdomID foreign key to tblKingdoms

    tblClass
    -pkClassID primary key, autonumber
    -txtClassName
    -fkPhylumID foreign key to tblPhyla

    The tables will continue to cascade through the remaining taxa down to species. The species table would look like this

    tblSpecies
    -pkSpeciesID primary key, autonumber
    -txtSpeciesName
    -fkGenusID foreign key to tblGenus


    Now if a user owns many species (one-to-many relationship), you would capture it as follows:

    tblUsers
    -pkUserID primary key, autonumber
    -txtFName
    -txtLName

    tblUserSpecies
    -pkUserSpeciesID primary key, autonumber
    -fkUserID foreign key to tblUsers
    -fkSpeciesID foreign key to tblSpecies

  3. #3
    kopbad is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    5
    That is an amazing reply, with this could a user search for all the species that fall within a given phyla? This is more of a question of how the query is setup, correct? Also, would a master table help in terms of speed and resources?
    Last edited by kopbad; 04-27-2012 at 12:24 PM. Reason: added question

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    That is an amazing reply, with this could a user search for all the species that fall within a given phyla? This is more of a question of how the query is setup, correct?
    Exactly

    Also, would a master table help in terms of speed and resources?
    Just the opposite, a normalized table structure with proper indicies would be more efficient. Having a "master" table implies that you repeat information that is already housed in other tables--that violates normalization rules & is inefficient because of the redundancy.

  5. #5
    kopbad is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    5
    So I think the last thing I am concerned about is values that repeat themself. What If two classes with different phyla have the same name? In terms of a universal id for each entity would some thing like this be acceptable:
    Kingdom Phylum Class Order Family Universal ID
    Animal Chordate Mammal Bestia Sus 12345
    10000 02000 00300 00040 00005
    Or is having a universal id completely unnecessary?

    Thank you for your help!

  6. #6
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Would two classes ever have the same name? I would think that it would not be allowed--but I am not an expert on the subject of the taxa. If it is possible, then we would have to look at a different structure.

  7. #7
    kopbad is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    5
    Unfortunately yes, it is possible. Would an easy fix be to use a universal id for each entity?

  8. #8
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Since in the class table you would have the foreign key to the phylum and a unique autonumber for that particular class name, I do not think adding a universal ID is necessary. Do duplicate names occur in the other taxa: i.e. order, family, genus & species? If duplicate names is common then we should probably alter the structure; if it is somewhat rare, then I think you can go with the structure I proposed without any issues--you would just have to do some filtering which you would probably have to do anyway.

  9. #9
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Just to say I agree with jzwp11. If each record in each table has a unique identifier, then a repeat of a Name should not matter.
    If you trace the hierarchy, you will be at the "correct Named "(Class in your example).

    As regards taxonomy, there are references to zoological and botanical hierarchies here
    http://en.wikipedia.org/wiki/Taxonom...oological_taxa

  10. #10
    kopbad is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    5
    I have been going through it and it seems to work just fine. Thank you for your input

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Array problem
    By dbdvl in forum Programming
    Replies: 6
    Last Post: 12-03-2011, 07:34 AM
  2. Dynamic Form, Dynamic labels/ captions?
    By JFo in forum Programming
    Replies: 15
    Last Post: 10-12-2011, 08:33 PM
  3. dynamic array for calendar
    By workindan in forum Programming
    Replies: 7
    Last Post: 11-12-2010, 01:20 PM
  4. can i put the result in array?
    By dada in forum Programming
    Replies: 1
    Last Post: 08-19-2010, 07:17 PM
  5. How to use array? [ solved] Thanks.
    By wasim_sono in forum Programming
    Replies: 0
    Last Post: 10-20-2006, 12:00 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums