Professional Web Applications Themes

Table heirachy and maintaining consistancy - MySQL

Hi - I think this must be a very common problem, and therefore probably has a very common solution... I want to structure my data in a heirachy using a series of tables. This is needed because although at some levels I want to group data together, some of these groupings are so different that all the data can not be displayed in the same table. For example below I want a list of all the orchards, but need seperate tables for each orchard type as the data recorded for each type is different. Table1: Orchards Location Number of trees ...

  1. #1

    Default Table heirachy and maintaining consistancy

    Hi - I think this must be a very common problem, and therefore probably
    has a very common solution...

    I want to structure my data in a heirachy using a series of tables.
    This is needed because although at some levels I want to group data
    together, some of these groupings are so different that all the data
    can not be displayed in the same table.


    For example below I want a list of all the orchards, but need seperate
    tables for each orchard type as the data recorded for each type is
    different.

    Table1: Orchards
    Location Number of trees Orchard Type

    Table2: Details on Pear Orchards
    Location Number of pear trees Owner details Colour
    of pears Yeild

    Table3: Details on Haggis Orchards
    Locvation Age of Haggis Number of legs on haggis


    I would like to link these tables such that if, for example, I deleted
    a record from my list of orchards (top table) this would filter down
    through all the other lower tables - so that in the example above if I
    deleted my haggis orchard from my top list of owned orchards, it would
    be removed from lower tables as well to maintain consistancy...

    I hope this makes some sense?


    Ben

    Ben Guest

  2. #2

    Default Re: Table heirachy and maintaining consistancy

    > I want to structure my data in a heirachy using a series of tables. 

    Check the on delete cascade option of the foreign key.


    Regards
    Dimitre



    Radoulov, Guest

Similar Threads

  1. XP2 / maintaining database connection
    By ukjooles in forum Dreamweaver AppDev
    Replies: 6
    Last Post: July 22nd, 09:35 AM
  2. Is anyone still maintaining XML::SAX::Expat?
    By Dennis Ingram in forum PERL Modules
    Replies: 0
    Last Post: April 5th, 05:26 AM
  3. Maintaining ViewState
    By SA in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: November 7th, 04:23 AM
  4. Replies: 2
    Last Post: August 12th, 07:55 AM
  5. Replies: 1
    Last Post: July 20th, 03:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139