Need advice on structuring a database

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Need advice on structuring a database

    Hello,

    I want to build a database with two tables, Characters and Abilities.

    So in the first table I would have:

    # Character Abilities
    0 Fred Resistance, shield, firebreathing
    1 Bob Climbing, swordfighting
    etc...

    and in the second table I would have:

    # Ability Description
    0 Resistance This character can resist things
    1 Swordfighting This character can swordfight
    etc...

    I can program in ASP but I do not understand how to structure things so
    that I can have a list of abilities for each character. I was thinking
    I could have a string like: "Resistance, shield, firebreathing" under a
    column called "Abilities" in the record for Fred, and then parse the
    list and retrieve the descriptions from the second database. But this
    seems like 'not the way someone that knew what they were doing would do
    it'. So, is there a better way?


    Dragonhunter Guest

  2. Similar Questions and Discussions

    1. Need advice on extracting database entries
      I'm not sure how I need to proceed on this and can use a bit of advice. I have a non-profit's web site that wishes to allow their members to fill...
    2. Acsess database design advice?
      Hi. Working on a e-commerce site, using ASP/Acsess/Vbscript. This is prehaps a database organize question. I use an unique ID for each order...
    3. need an advice on running Database
      Hi, I have a small data base ~ 10 tables. each table get insert/update/delete few times a day. postgresql is running for a month. The load will...
    4. Need advice on getting data out of normalized database
      Hello all, Thanks to the advice of Manohar Kamath, Bob Barrows, Curt, Chris and others, I restructured my database for "normalization" where I...
    5. Structuring Data in Perl
      Doh!! Makes me humble every time..... Thanks for your help. -----Original Message----- From: wiggins@danconia.org Sent: Tuesday, August...
  3. #2

    Default Re: Need advice on structuring a database

    I would recommend three tables, as follows:


    AbilityID AbilityName AbilityDesc

    CharacterID CharacterName

    CharacterID AbilityID

    --
    Manohar Kamath
    Editor, .netBooks
    [url]www.dotnetbooks.com[/url]


    "Dragonhunter" <dragonhunter97@yahoo.com> wrote in message
    news:3F5FB47C.58702C07@yahoo.com...
    > Hello,
    >
    > I want to build a database with two tables, Characters and Abilities.
    >
    > So in the first table I would have:
    >
    > # Character Abilities
    > 0 Fred Resistance, shield, firebreathing
    > 1 Bob Climbing, swordfighting
    > etc...
    >
    > and in the second table I would have:
    >
    > # Ability Description
    > 0 Resistance This character can resist things
    > 1 Swordfighting This character can swordfight
    > etc...
    >
    > I can program in ASP but I do not understand how to structure things so
    > that I can have a list of abilities for each character. I was thinking
    > I could have a string like: "Resistance, shield, firebreathing" under a
    > column called "Abilities" in the record for Fred, and then parse the
    > list and retrieve the descriptions from the second database. But this
    > seems like 'not the way someone that knew what they were doing would do
    > it'. So, is there a better way?
    >
    >

    Manohar Kamath [MVP] Guest

  4. #3

    Default Re: Need advice on structuring a database

    To add to Manohar's suggestion, if you plan to use the whole name I would
    split the CharacterName into something like FName, MI, LName. This will make
    searching for data easier, if you need to search on a character's lastname
    or firstname. Middle initial is there to distinguish between to Mary Smith's
    or Joe Blow's; this field can be eliminated if the First Name and Last Name
    doesn't play an important part in the overall data and you have another way
    to distinguish between two Mary Smith's.

    "Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in message
    news:O1uXBJCeDHA.696@TK2MSFTNGP09.phx.gbl...
    > I would recommend three tables, as follows:
    >
    >
    > AbilityID AbilityName AbilityDesc
    >
    > CharacterID CharacterName
    >
    > CharacterID AbilityID
    >
    > --
    > Manohar Kamath
    > Editor, .netBooks
    > [url]www.dotnetbooks.com[/url]
    >
    >
    > "Dragonhunter" <dragonhunter97@yahoo.com> wrote in message
    > news:3F5FB47C.58702C07@yahoo.com...
    > > Hello,
    > >
    > > I want to build a database with two tables, Characters and Abilities.
    > >
    > > So in the first table I would have:
    > >
    > > # Character Abilities
    > > 0 Fred Resistance, shield, firebreathing
    > > 1 Bob Climbing, swordfighting
    > > etc...
    > >
    > > and in the second table I would have:
    > >
    > > # Ability Description
    > > 0 Resistance This character can resist things
    > > 1 Swordfighting This character can swordfight
    > > etc...
    > >
    > > I can program in ASP but I do not understand how to structure things so
    > > that I can have a list of abilities for each character. I was thinking
    > > I could have a string like: "Resistance, shield, firebreathing" under a
    > > column called "Abilities" in the record for Fred, and then parse the
    > > list and retrieve the descriptions from the second database. But this
    > > seems like 'not the way someone that knew what they were doing would do
    > > it'. So, is there a better way?
    > >
    > >
    >
    >

    GVaught Guest

  5. #4

    Default Re: Need advice on structuring a database

    On Wed, 10 Sep 2003 23:32:10 GMT, Dragonhunter
    <dragonhunter97@yahoo.com> wrote:
    >Hello,
    >
    >I want to build a database with two tables, Characters and Abilities.
    >
    >So in the first table I would have:
    >
    ># Character Abilities
    >0 Fred Resistance, shield, firebreathing
    >1 Bob Climbing, swordfighting
    >etc...
    >
    >and in the second table I would have:
    >
    ># Ability Description
    >0 Resistance This character can resist things
    >1 Swordfighting This character can swordfight
    >etc...
    >
    >I can program in ASP but I do not understand how to structure things so
    >that I can have a list of abilities for each character. I was thinking
    >I could have a string like: "Resistance, shield, firebreathing" under a
    >column called "Abilities" in the record for Fred, and then parse the
    >list and retrieve the descriptions from the second database. But this
    >seems like 'not the way someone that knew what they were doing would do
    >it'. So, is there a better way?
    In case you didn't get that (from Manohar) it looks something like
    this:

    Abilities:

    AbilityID AbilityName AbilityDesc
    1 Resistance etc...
    2 shield
    3 firebreathing
    4 Climbing
    5 swordfighting

    Characters:

    CharacterID CharacterName
    1 Fred
    2 Bob

    CharacterAbilities:

    CharacterID AbilityID
    1 1
    1 2
    1 3
    2 4
    2 5

    Note: The ID numbers start at 1 rather than 0 because this is likely
    to be the default value which identity and autonumber values start at.

    The 'key' of CharacterAbilities table is a composite key (using both
    fields).

    mark4asp Guest

  6. #5

    Default Re: Need advice on structuring a database

    Thanks Manohar, GVaught, and Mark4asp for the advice. Just so I understand
    it in completely, could I ask, is the table of IDs only for speed purposes?
    It seems you could create the list of people and abilities without using IDs
    and have only two tables, but I'm sure there is a reason why you guys are
    suggesting to do it with 3 tables and with IDs. If speed is the reason,
    could I get a ballpark multiplier for how much of an effect this has?

    Thanks guys!


    mark4asp wrote:
    > On Wed, 10 Sep 2003 23:32:10 GMT, Dragonhunter
    > <dragonhunter97@yahoo.com> wrote:
    >
    > >Hello,
    > >
    > >I want to build a database with two tables, Characters and Abilities.
    > >
    > >So in the first table I would have:
    > >
    > ># Character Abilities
    > >0 Fred Resistance, shield, firebreathing
    > >1 Bob Climbing, swordfighting
    > >etc...
    > >
    > >and in the second table I would have:
    > >
    > ># Ability Description
    > >0 Resistance This character can resist things
    > >1 Swordfighting This character can swordfight
    > >etc...
    > >
    > >I can program in ASP but I do not understand how to structure things so
    > >that I can have a list of abilities for each character. I was thinking
    > >I could have a string like: "Resistance, shield, firebreathing" under a
    > >column called "Abilities" in the record for Fred, and then parse the
    > >list and retrieve the descriptions from the second database. But this
    > >seems like 'not the way someone that knew what they were doing would do
    > >it'. So, is there a better way?
    >
    > In case you didn't get that (from Manohar) it looks something like
    > this:
    >
    > Abilities:
    >
    > AbilityID AbilityName AbilityDesc
    > 1 Resistance etc...
    > 2 shield
    > 3 firebreathing
    > 4 Climbing
    > 5 swordfighting
    >
    > Characters:
    >
    > CharacterID CharacterName
    > 1 Fred
    > 2 Bob
    >
    > CharacterAbilities:
    >
    > CharacterID AbilityID
    > 1 1
    > 1 2
    > 1 3
    > 2 4
    > 2 5
    >
    > Note: The ID numbers start at 1 rather than 0 because this is likely
    > to be the default value which identity and autonumber values start at.
    >
    > The 'key' of CharacterAbilities table is a composite key (using both
    > fields).
    Dragonhunter Guest

  7. #6

    Default Re: Need advice on structuring a database

    Not as much speed as non-redundancy -- called Normalization.

    --
    Manohar Kamath
    Editor, .netBooks
    [url]www.dotnetbooks.com[/url]


    "Dragonhunter" <dragonhunter97@yahoo.com> wrote in message
    news:3F611D7F.4352BB81@yahoo.com...
    > Thanks Manohar, GVaught, and Mark4asp for the advice. Just so I
    understand
    > it in completely, could I ask, is the table of IDs only for speed
    purposes?
    > It seems you could create the list of people and abilities without using
    IDs
    > and have only two tables, but I'm sure there is a reason why you guys are
    > suggesting to do it with 3 tables and with IDs. If speed is the reason,
    > could I get a ballpark multiplier for how much of an effect this has?
    >
    > Thanks guys!
    >
    >
    > mark4asp wrote:
    >
    > > On Wed, 10 Sep 2003 23:32:10 GMT, Dragonhunter
    > > <dragonhunter97@yahoo.com> wrote:
    > >
    > > >Hello,
    > > >
    > > >I want to build a database with two tables, Characters and Abilities.
    > > >
    > > >So in the first table I would have:
    > > >
    > > ># Character Abilities
    > > >0 Fred Resistance, shield, firebreathing
    > > >1 Bob Climbing, swordfighting
    > > >etc...
    > > >
    > > >and in the second table I would have:
    > > >
    > > ># Ability Description
    > > >0 Resistance This character can resist things
    > > >1 Swordfighting This character can swordfight
    > > >etc...
    > > >
    > > >I can program in ASP but I do not understand how to structure things so
    > > >that I can have a list of abilities for each character. I was thinking
    > > >I could have a string like: "Resistance, shield, firebreathing" under a
    > > >column called "Abilities" in the record for Fred, and then parse the
    > > >list and retrieve the descriptions from the second database. But this
    > > >seems like 'not the way someone that knew what they were doing would do
    > > >it'. So, is there a better way?
    > >
    > > In case you didn't get that (from Manohar) it looks something like
    > > this:
    > >
    > > Abilities:
    > >
    > > AbilityID AbilityName AbilityDesc
    > > 1 Resistance etc...
    > > 2 shield
    > > 3 firebreathing
    > > 4 Climbing
    > > 5 swordfighting
    > >
    > > Characters:
    > >
    > > CharacterID CharacterName
    > > 1 Fred
    > > 2 Bob
    > >
    > > CharacterAbilities:
    > >
    > > CharacterID AbilityID
    > > 1 1
    > > 1 2
    > > 1 3
    > > 2 4
    > > 2 5
    > >
    > > Note: The ID numbers start at 1 rather than 0 because this is likely
    > > to be the default value which identity and autonumber values start at.
    > >
    > > The 'key' of CharacterAbilities table is a composite key (using both
    > > fields).
    >

    Manohar Kamath [MVP] Guest

  8. #7

    Default Re: Need advice on structuring a database

    On Thu, 11 Sep 2003 23:02:40 -0500, "Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote:
    >Not as much speed as non-redundancy -- called Normalization.

    You could have only 2 tables if there were a finite number of abilities 1 character could have;you could then have:

    Person_table

    Person_Id
    Ability_1_id
    Ability_2_id
    Ability_3_id
    Person_name
    etc...


    Ability_table:

    Ability_Id
    Ability_name
    etc..

    The advantage to the multiple table setup is the ability to modify the characteristics or attributes of an Ability
    without having to recode every character that has that ability -

    For the type of application you are constructing, understanding normalization will save you much time and frustation.

    Have fun...

    Turkbear Guest

  9. #8

    Default Re: Need advice on structuring a database

    ....and use checkboxes for the abilities.


    --

    Phillip Windell [CCNA, MVP, MCP]
    [email]pwindell@wandtv.com[/email]
    WAND-TV (ABC Affiliate)
    [url]www.wandtv.com[/url]

    "GVaught" <glvaught@hotmail.com> wrote in message
    news:eoaGPaJeDHA.2268@TK2MSFTNGP10.phx.gbl...
    > To add to Manohar's suggestion, if you plan to use the whole name I
    would
    > split the CharacterName into something like FName, MI, LName. This
    will make
    > searching for data easier, if you need to search on a character's
    lastname
    > or firstname. Middle initial is there to distinguish between to Mary
    Smith's
    > or Joe Blow's; this field can be eliminated if the First Name and
    Last Name
    > doesn't play an important part in the overall data and you have
    another way
    > to distinguish between two Mary Smith's.
    >
    > "Manohar Kamath [MVP]" <mkamath@TAKETHISOUTkamath.com> wrote in
    message
    > news:O1uXBJCeDHA.696@TK2MSFTNGP09.phx.gbl...
    > > I would recommend three tables, as follows:
    > >
    > >
    > > AbilityID AbilityName AbilityDesc
    > >
    > > CharacterID CharacterName
    > >
    > > CharacterID AbilityID
    > >
    > > --
    > > Manohar Kamath
    > > Editor, .netBooks
    > > [url]www.dotnetbooks.com[/url]
    > >
    > >
    > > "Dragonhunter" <dragonhunter97@yahoo.com> wrote in message
    > > news:3F5FB47C.58702C07@yahoo.com...
    > > > Hello,
    > > >
    > > > I want to build a database with two tables, Characters and
    Abilities.
    > > >
    > > > So in the first table I would have:
    > > >
    > > > # Character Abilities
    > > > 0 Fred Resistance, shield, firebreathing
    > > > 1 Bob Climbing, swordfighting
    > > > etc...
    > > >
    > > > and in the second table I would have:
    > > >
    > > > # Ability Description
    > > > 0 Resistance This character can resist things
    > > > 1 Swordfighting This character can swordfight
    > > > etc...
    > > >
    > > > I can program in ASP but I do not understand how to structure
    things so
    > > > that I can have a list of abilities for each character. I was
    thinking
    > > > I could have a string like: "Resistance, shield, firebreathing"
    under a
    > > > column called "Abilities" in the record for Fred, and then parse
    the
    > > > list and retrieve the descriptions from the second database.
    But this
    > > > seems like 'not the way someone that knew what they were doing
    would do
    > > > it'. So, is there a better way?
    > > >
    > > >
    > >
    > >
    >
    >

    Phillip Windell Guest

Posting Permissions

  • You may not post new threads
  • You may 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