1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Database Design -- How can i keep my table from growing?

Discussion in 'Databases' started by guitarbinge, May 27, 2010.

  1. #1
    Hello,

    I'm trying to build a database to track keywords and their rankings in google.
    The problem is that the number of keywords will keep growing (new keywords being tracked will always be added) and the dates on which the ranking is recorded will also keep growing...

    So for example, the table structure (fields) could be:

    Keyword --- Rank on Date1 --- Rank on Date2 ---etc. forever....

    i know this is bad design because the number of date fields would increase forever, but i can't figure out a design which would limit the number of fields...!

    Any help would be much appreciated..
     
    guitarbinge, May 27, 2010 IP
  2. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #2
    I would use this structure:

    Keyword --- RankDate --- Rank

    Then on every new date add a new record to the database so your table looks like this:

    databases --- 2010-01-01 --- 7
    databases --- 2010-01-15 --- 9
    baseball --- 2010-01-15 --- 11
    databases --- 2010-02-01 --- 6
    baseball --- 2010-02-01 --- 11


    Your next question will probably be about getting data out of it. When you ask that be sure to include exactly what you want the data to tell you and how you want to display it, include some example data if possible.
     
    plog, May 27, 2010 IP
  3. miker81

    miker81 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Wrong way.

    Structure should be:

    Table_1
    ID_keyword -- Keyword

    Table_2
    ID_rank -- ID_keyword -- Rank -- Date

    PS ID_rank is just for good database design.
     
    miker81, May 27, 2010 IP
  4. guitarbinge

    guitarbinge Peon

    Messages:
    208
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you both
     
    guitarbinge, May 27, 2010 IP