Different User types, same search results ????

Discussion in 'Databases' started by StuartC, Jun 29, 2010.

  1. #1
    Hey Guys,

    Wondering if anyone can help me with this little chesnut?? :)

    I am developing an app that has two different user types, lets say, student and teacher.

    A teacher or a student can both create "a group" and a regular user can then search through all of these groups together. So there is no real difference between the two as far as a regular user can see.

    Is it best practise to separate this into two tables so I would have a student_group table and a teacher_group table?

    My question is how do you group the two together so the two can be displayed in search results?

    Cheers

    Stuart
     
    StuartC, Jun 29, 2010 IP
  2. SportsBettingScholars

    SportsBettingScholars Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Create a table called group_owner ( or person or staff or group_users or something ),
    then make the function, teacher or student, an attribute of the person.

    So you get at least a field with "Function",
    let's say you have: name, function, groupname, etc...

    Later you can select based on the attribute like:
    SELECT groupname FROM group_owner WHERE function = "Teacher";
     
    SportsBettingScholars, Jun 30, 2010 IP
  3. SportsBettingScholars

    SportsBettingScholars Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    or not:
    SELECT groupname FROM group_owner;

    or just student owners:
    SELECT groupname FROM group_owner WHERE function = "Student";

    Note the field "Function" in this case could also be a boolean as there are only 2 options,
    so you could have true = teacher and false = student
    alternatively use an ENUM if there are possibly more roles.
     
    SportsBettingScholars, Jun 30, 2010 IP
  4. m2hmonique

    m2hmonique Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hello,

    Thanks, I will try :)
     
    m2hmonique, Jul 5, 2010 IP