Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    United States
    Posts
    158
    Thanks
    8
    Thanked 4 Times in 4 Posts

    Table Field Separation Question

    Hello everyone,

    I have a quick question about table field separation (This is for a combat portion of a text based game). Currently I have a table for abilities, attacks, monsters, battles, and battle monsters (which stores the monsters for the specific battle the player is in). Since monsters may be able to have more than one special attack or ability, would it be best to create another table for the monsters in battle abilities (IE: battleID, monster, ability), or just comma separate the abilities they have in the battle monsters table( IE: abilities(1, 2, 3, ...)? I'm guessing best practice is a new table, but for something that may have few values, I wasn't sure if it would be necessary.

    Thanks for your time, and nice to be back on here!
    Adobe Dreamweaver shall be destroyed!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,652
    Thanks
    80
    Thanked 4,638 Times in 4,600 Posts
    Never never never use a delimited list of values in a single field in any database.

    Yes, CLEARLY a separate table!

    Trust me, you will regret it at some point if you don't do it right.

    Just to pick a simple example using your own situation: "Show me all the monsters I can attack with that have ability number 7".
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    If you want more reasons see http://pragprog.com/book/bksqla/sql-antipatterns where chapter 2 deals exclusively with this particular issue.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Regular Coder
    Join Date
    Oct 2009
    Location
    United States
    Posts
    158
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Thank you both very much.
    Adobe Dreamweaver shall be destroyed!


  •  

    Posting Permissions

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