+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16

Thread: Database Design

  1. #1
    dtz
    dtz is offline
    Barn Regular dtz is an unknown quantity at this point dtz's Avatar
    Join Date
    Feb 2009
    Posts
    96
    Rep Power
    3

    Database Design

    Hi,
    i am bit stuck for database design, basically i have 3 entity,

    Manager
    Level
    Form


    There are three levels of managers
    There are three types of forms for each levels of manager
    Each level manager fills one type of form only.

    for instance

    All senior managers fill form 1 only

    All line manager fill form 2 only

    All middle manager fill form 3 only

    The three forms have different questions

    I am havin trouble to normalised it.

    I was thinking of manager table which is linked to the form table but it does not look like it is normalised

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Show us what you have so far. I think I understand what you mean, but not completely.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    dtz
    dtz is offline
    Barn Regular dtz is an unknown quantity at this point dtz's Avatar
    Join Date
    Feb 2009
    Posts
    96
    Rep Power
    3

    Quote Originally Posted by jmurrayhead View Post
    Show us what you have so far. I think I understand what you mean, but not completely.
    Hi,
    at the moment i have 2 tables and it is in access,
    my member table has:
    Memberid PK;
    Password;


    This is linked to the three types of form

    Form table

    Formid PK:
    Memberid FK;
    Form Type;(This will be form Type1, form Type 2,form Type 3)
    Level of management;
    Q1;
    Q2;
    Q3;
    Q4;
    Q5;
    Q6:
    Q7;
    .
    .
    .
    But it does not look like it is normalise:
    as form Type 1 has 5 questions for senior level
    form Type 2 has 10 questions for middle level
    form Type 3 has 20 questions for line managers

    it is repeating in the table that i have

  4. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Okay, so here's how I would do it:

    Members
    MemberID - AutoNumber PK
    LevelID - Number (from ManagementLevels table)
    Password - Text

    ManagementLevels
    LevelID - AutoNumber PK
    Description - Text

    Forms
    FormID - AutoNumber PK
    LevelID - Number (from ManagementLevels table)
    FormType - Number (from FormTypes table)

    FormTypes
    FormTypeID - AutoNumber PK
    Description - Text

    FormQuestions
    QuestionID - AutoNumber PK
    Question - Text
    FormID - Number (From Forms table)
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  5. #5
    dtz
    dtz is offline
    Barn Regular dtz is an unknown quantity at this point dtz's Avatar
    Join Date
    Feb 2009
    Posts
    96
    Rep Power
    3

    Hi,
    i am having bit of a problem with an sql query, based on the above db design how do i identify a member who have filled in a specific form? I have tried this query:

    Code:
     SELECT Member.MemberID, ManagementLevels.Description, Form.FormType
    FROM (ManagementLevels INNER JOIN Member ON ManagementLevels.LevelID = Member.LevelID) INNER JOIN Form ON ManagementLevels.LevelID = Form.LevelID
    WHERE (((Member.MemberID)=1));
    
    But the problem is, that it relates every single member to a management level, and according to the query it says that member 1 has filled in a form. And this is not true.






  6. #6
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Elaborate on "identify a member who have filled in a specific form". Do you mean you want to check if MemberID 1 has completed a particular form?
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  7. #7
    dtz
    dtz is offline
    Barn Regular dtz is an unknown quantity at this point dtz's Avatar
    Join Date
    Feb 2009
    Posts
    96
    Rep Power
    3

    Hi,
    yes thats what i mean because i need to find out which member has filled in a form.

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    We'll need one more table, and this will be the table that has the responses of the members.

    QuestionAnswers
    AnswerID - AutoNumber PK
    MemberID - Number (from Members table)
    QuestionID - Number (from FormQuestions table)
    Answer - Text

    Then, query using the MemberID and the FormID:
    Code:
    SELECT 
        Members.MemberID, 
        ManagementLevels.Description, 
        Forms.FormType
    FROM Members INNER JOIN ManagementLevels ON Members.LevelID = ManagementLevels.MemberID
    INNER JOIN QuestionAnswers ON Members.MemberID = QuestionAnswers.MemberID
    INNER JOIN FormQuestions ON QuestionAnswers.QuestionID = FormQuestions.QuestionID
    INNER JOIN Forms ON FormQuestions.FormID = Forms.FormID
    INNER JOIN FormTypes ON Forms.FormType = FormTypes.FormTypeID
    WHERE Members.MemberID = 1 AND Forms.FormID = 3
    
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  9. #9
    dtz
    dtz is offline
    Barn Regular dtz is an unknown quantity at this point dtz's Avatar
    Join Date
    Feb 2009
    Posts
    96
    Rep Power
    3

    Hi,
    i have created the table but when i run the sql i get this error message:


  10. #10
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Is it possible to ZIP and attach the database? It'll be easier for me to create a working query.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. help with form design
    By Ziggy in forum Microsoft Access
    Replies: 12
    Last Post: February 16th, 2009, 02:00 PM
  2. Database table design
    By Ziggy in forum Database Design Help
    Replies: 17
    Last Post: February 16th, 2009, 01:55 PM

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

SEO by vBSEO