Closed Thread
Results 1 to 6 of 6

Thread: Dynamic Table Creation?

  1. #1
    alias301 is offline Newbie
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Dynamic Table Creation?

    Should I create many tables with an ID in the name or should I put the ID in a column?

    The ID does not have to be escaped.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Dynamic Table Creation?

    It depends on what you're trying to do.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    alias301 is offline Newbie
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Re: Dynamic Table Creation?

    The number of tables that will be created is unknown and could be very high

  5. #4
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: Dynamic Table Creation?

    are you sure you can't store your data in another way and avoid so many tables?
    you can often combine a lot more than you think in a table if it's layouted in the right way...
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  6. #5
    alias301 is offline Newbie
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Re: Dynamic Table Creation?

    The issue is that i have many A and A has many B and B has a C with many D.

    So should i just add an ID to the tables? Is there anything to avoid duplication of this key?

  7. #6
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: Dynamic Table Creation?

    Sounds to me that you have a parent-child-relation there. link them together in the same table with a parentID, and reuse the datafield for all types, add a type field if you want to know if they are a A or B or so from the beginning. Top level posts then has parentid 0

    Example:

    id
    type
    parentid
    datafield


    to avoid duplicates, use the counter/auto_increment (name depending on database) option to the posts.
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Best solution for Dynamic Document Creation?
    By IngoVals in forum General Programming
    Replies: 3
    Last Post: 08-10-2010, 02:27 AM
  2. Replies: 7
    Last Post: 08-27-2008, 07:48 AM
  3. [JSP] Dynamic form table
    By Alhazred in forum Java Help
    Replies: 3
    Last Post: 07-31-2008, 09:30 AM
  4. Game creation
    By rodent14 in forum MarketPlace
    Replies: 0
    Last Post: 03-16-2008, 10:30 AM
  5. .h file creation help
    By jclarke in forum C and C++
    Replies: 5
    Last Post: 02-28-2008, 07:11 PM

Tags for this Thread

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