Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:26:33+00:00 2026-06-06T13:26:33+00:00

I’m struggling with how I would set up a database for a situation where

  • 0

I’m struggling with how I would set up a database for a situation where you have people (non anonymously) filling out questionnaires. The relationship between people and questionnaires is many-to-many–a person completes multiple questionnaires, and a questionnaire is completed by multiple people. So, I have a PERSON table, a QUESTIONNAIRE table, and a join table (PERSON-QUESTIONNAIRE).

But where do I put the info appearing in the questionnaires themselves? Questionnaire items have two parts (two fields), one with a question or statement people will respond to (ITEM) and one with space for the response (RESPONSE). Assuming all this goes in a separate table, what does this table join with? (The QUESTIONNAIRE table … a QUESTIONNAIRE can have multiple QUESTIONNAIRE-ITEMS?)

And, if I’m correct about that last point, I can’t for the life of me figure out how to set up a DB grid (in Delphi) that would display the ITEM and RESPONSE fields for a selected questionnaire and selected person. (I know how to code master/detail relationships with db-aware components, but this is like a detail with two masters.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:26:34+00:00Added an answer on June 6, 2026 at 1:26 pm

    You will have a table QUESTIONNAIRE-ITEMS (the questions) and a separate table QUESTIONNAIRE-RESPONSES (the answers), because there will be multiple answers for a single question, those from multiple persons. The former gets a foreign key to QUESTIONNAIRE, while the latter gets foreign keys to both QUESTIONNAIRE-ITEMS and PERSON.

    In fact, the PERSON-QUESTIONNAIRE table could be omitted, since that information could be queried from the other tables. So for the design I suggest:

    • Surveys: ID (PK), Description, etc…
    • Users: ID (PK), Name, etc…
    • Questions: ID (PK), SurveyID (FK), Question, etc…
    • Answers: ID (PK), QuestionID (FK), UserID (FK), Answer, etc…

    The view for the DBGrid will be based on a query like:

    SELECT 
      Question, 
      Answer,
      ...
    FROM 
      Questions INNER JOIN Answers ON Questions.ID = Answers.QuestionID
    WHERE
      Questions.SurveyID = :SurveyID AND Answers.UserID = :UserID
    

    In another part of you GUI, you select the SurveyID and UserID parameters.

    And as a bonus: the query to acquire surveys and users, as an alternative to your separate join table, will look like :

    SELECT
      Surveys.ID,
      Users.ID
    FROM
      Users INNER JOIN (
        Answers INNER JOIN (
          Questions INNER JOIN (
            Surveys
          ) ON Questions.SurveyID = Surveys.ID
        ) ON Answers.QuestionID = Questions.ID
      ) ON Users.ID = Answers.UserID
    GROUP BY
      Surveys.ID,
      Users.ID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.