Results 1 to 5 of 5
  1. #1
    Join Date
    May 2009
    Posts
    3

    Unanswered: How do I make my db more relational?

    Hi,

    This is my first post.

    I have a website that has lets say 1000 members, and I have a database that holds membership information in the 'users' table. Each user entry has a unique primary key of id (INT). I need to record click-thru information from users/members, so the way I've done it is to create a new table for each user which contains click info, so user 123 will have an associate 'user_123_clicks' table where click-thru info is stored. This just doesn't feel right to me, I can't join tables as it just isn't relational. What I wanted to avoid is have one enormous 'click' table which would have a foreign key of 'user_id', although this would be more relational I guess?

    Which in the best way in your opinion to achieve what I need to, without an enormous click table, but without the contrived 'user_123_clicks' tables?

    Many thanks for any help/advice...

    Steve.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what you really should have is a single table for the clicks

    a separate table for each user is a potential disaster

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2009
    Posts
    3
    Quote Originally Posted by r937
    what you really should have is a single table for the clicks

    a separate table for each user is a potential disaster

    Many thanks for your reply.

    I though large tables were bad too, not as bad as my approach I'm sure, but bad non the less?

    Thanks.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by esku
    I though large tables were bad too, not as bad as my approach I'm sure, but bad non the less?
    that's not true

    of course, large tables that you don't need are bad, but if you need to save all that data, then a large table is often ~way~ better than a bazillion small ones
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    May 2009
    Posts
    3
    Thank you for your time and advice.

    Looks like a redesign is on the cards....

    Cheers, Steve.

Posting Permissions

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