#1
  1. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,969
    Rep Power
    374

    Target criteria -


    I have a questions table

    questions (q_id,.......)
    ( 11,........)
    Now i want to give admin options to target specific people, i.e. Males, 18-25 and London.

    target (q_id, target_type_id, criteria)
    (11,1,'Male'),
    (11,2,'London'),

    target_type (target_type_id, type)
    1, Gender
    2, Location

    I am not sure on how to go about the age? should i have another table with pre-defined age limits i.e. 18-25, 25-40 etc..

    or i was thinking of just putting target_age, target_gender, target_location at the end of questions table?
    Last edited by paulh1983; July 24th, 2013 at 07:53 AM.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    10
    Rep Power
    0

    REF Table or Attribute


    This depends on what you are trying to accomplish. If you are simply wanting to record the target's age, a person can only have one age so that one to one relationship would make it an attribute in your existing table.

    However, if you want to have pre-determined bands of ages to make demographics you are creating a dimension as a ref table. The join conditions may be tricky here for the below reason.

    The thing I'm most concerned about here is maintaining this data in a controlled way. Age is something that changes and people will change bands as they get older which requires a maintenance script or ETL process to run regularly to make sure every target is accurate.

    For this reason I would recommend that you add a Date_Of_Birth attribute to your existing table. You can then create a view that does some date logic on the DOB field to make an age range column.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,969
    Rep Power
    374
    yep i will be doing that but this topic is about QUESTION table not users table. i want to be able to show the question if user is say above 18 - 25 etc etc..
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    10
    Rep Power
    0

    When to ask the question


    In that case, the way I would approach the problem is like this:

    T_Age_Group(age_group_key, age_group_name, age_low, age_high)

    T_Target(target_key,......,DOB)

    T_Question(question_key,demographic_key,.......)

    V_Demographic(demographic_key,....., gender_key, age_group_key)
    includes join on DOB logic which produces the age field between age_low and age_high

    I like joining on surrogate keys i.e. the age_group_key so that your age group high/low values are allowed to change for whatever business reasons you may have in the future.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,969
    Rep Power
    374
    cheers for that.

    T_question = question table
    T_target = USER?

IMN logo majestic logo threadwatch logo seochat tools logo