Re: Mixed up with Relationships..help!

From: KrazyRed (KrazyRed_at_discussions.microsoft.com)
Date: 01/25/05


Date: Tue, 25 Jan 2005 00:19:04 -0800

This looks amazing, but i am going to demonstrate how thick I am.

The Structure of the database has 1 questionnaire which has gone to 10
different schools. So 10 schools have had all the same questions. Also, the
sudents themselves are not identified, so the studentID will only be the
unique key to 1 questionnaire. there are about 150 questionnaires completed
for each school.

So I don't think we need a sponsors table, and i am slighlty puzzled by
reference to CONSTRAINT - what is this?

Am i right in thinking that there should be a table for questions which hold
all the questions for the questionnaire.

and then a table for answers which has the questionID as a foreign key; what
does REFERENCES mean?

Then we have a table for questionaires, which i think i understand, and a
table for questionnaire questions which has me more puzzled. I thought we had
questions already, are these different questions?

And then we have questionnaire answers which i thought we already had answers.

Are you suggesting that i have a separate table for Questions
and Answers, and questionnaire questions and answers. I would like to try
and keep this as simple as possible. If u don't mind bearing with me, and
explaining the terms u have used I would really appreciate it.

You can see why I am confused I hope.
"Chris2" wrote:

>
> "KrazyRed" <KrazyRed@discussions.microsoft.com> wrote in message
> news:95DA600E-7DE2-4FF7-8CA2-5286EB91B609@microsoft.com...
> > Ok, I have managed to get myself completely confused.
> >
> > I have a table, called tblstudent, which has a series of questions
> in it, as
> > in data entry for a questionnaire.
>
> The name tblstudent implies that the table is about students, not
> about questions.
>
> That table sounds like it should be called QuestionaireAnswers.
>
> >
> > I have read some books about relationships and the trouble i have is
> that
> > several of the questions have the same choice of answer, for
> example,
> > tblagreetype. ie. strongly agree, slighly agree, slighlty disagree
> etc. When
> > i try to create the lookup table to link to this table, the
> relationships
> > window looks all over the place.
>
> The Tables would go like this:
>
> CREATE TABLE Students
> (StudentID AUTOINCREMENT
> ,NameFirst TEXT(72)
> ,NameMiddle TEXT(72)
> ,NameLast TEXT(72)
> ,CONSTRAINT pk_StudentID PRIMARY KEY (StudentID)
> )
>
> CREATE TABLE Faculty
> (FacultyID AUTOINCREMENT
> ,NameFirst TEXT(72)
> ,NameMiddle TEXT(72)
> ,NameLast TEXT(72)
> ,CONSTRAINT pk_Faculty PRIMARY KEY (StudentID)
> )
>
> CREATE TABLE Questions
> (QuestionID AUTOINCREMENT
> ,Question TEXT(255) NOT NULL
> ,CONSTRAINT pk_Questions PRIMARY KEY (QuestionID)
> )
>
> CREATE TABLE Answers
> (AnswerID AUTOINCREMENT
> ,QuestionID LONG NOT NULL
> ,Answer TEXT(255) NOT NULL
> ,CONSTRAINT pk_Answers PRIMARY KEY (AnswerID)
> ,CONSTRAINT fk_Answers_Questions FOREIGN KEY (QuestionID)
> REFERENCES Questions (QuestionID)
> )
>
> CREATE TABLE Questionaires
> (QuestionaireID AUTOINCREMENT
> ,QuestionaireName TEXT(72) NOT NULL
> ,CONSTRAINT pk_Questionaires PRIMARY KEY (QuestionaireID)
> )
>
> CREATE TABLE QuestionaireSponsors
> (QuestionaireSponsorID AUTOINCREMENT
> ,QuestionaireID LONG NOT NULL
> ,FacultyID LONG NOT NULL
> ,CONSTRAINT pk_QuestionaireSponsors PRIMARY KEY (StudentID)
> ,CONSTRAINT fk_QuestionaireSponsors_QuestionaireID FOREIGN KEY
> (QuestionaireID)
> REFERENCES Faculty
> (QuestionaireID)
> )
>
> CREATE TABLE QuestionaireQuestions
> (QuestionaireQuestionsID AUTOINCREMENT
> ,QuestionaireID LONG NOT NULL
> ,QuestionID LONG NOT NULL
> ,CONSTRAINT pk_QuestionaireQuestions PRIMARY KEY (QuestionaireID)
> ,CONSTRAINT fk_QuestionaireQuestions_Questionaires FOREIGN KEY
> (QuestionaireID)
> REFERENCES
> Questionaires (QuestionaireID)
> ,CONSTRAINT fk_QuestionaireQuestions_Questions FOREIGN KEY
> (QuestionID)
> REFERENCES Questions
> (QuestionID)
> )
>
> CREATE TABLE QuestionaireAnswers
> (QuestionaireAnswersID AUTOINCREMENT
> ,StudentID LONG NOT NULL
> ,QuestionaireQuestionsID LONG NOT NULL
> ,StudentsAnswer TEXT(255) NOT NULL
> ,CONSTRAINT pk_QuestionaireAnswers PRIMARY KEY (QuestionaireID)
> ,CONSTRAINT fk_QuestionaireAnswers_Students FOREIGN KEY (StudentID)
> REFERENCES Students
> (StudentID)
> ,CONSTRAINT fk_QuestionaireAnswers_QuestionaireQuestionsID FOREIGN
> KEY (QuestionaireQuestionsID)
> REFERENCES
> QuestionaireQuestions (QuestionaireQuestionsID)
> )
>
>
> There, that looks right (bear in mind I wrote that in about 30
> minutes).
>
>
>
>



Relevant Pages

  • Re: The New White Flight
    ... > as Asian students move in. ... > High, in nearby San Jose, are among the nation's top public high schools. ... > about its academics, says Principal Michael Doran. ...
    (soc.culture.thai)
  • Re: Publik Skools (was Re: Bitter Boy Jeb Doesnt Get Dream After All
    ... >> when it comes to education. ... My point stands, Mark. ... >> where it belongs to educated our students to compete with the Chinese. ... they're already doing a "bang up" job in raising kids attending inner city schools... ...
    (soc.men)
  • American brains are Canadas gain
    ... financial aid, the annual $25,000 difference in cost made up her ... League-quality schools and they are just a lot less expensive." ... government and more interest by Canadian schools, drawn to the American ... and so is the number of students saying yes to offers. ...
    (rec.sport.pro-wrestling)
  • Re: Top 10 skills that schools should teach
    ... Let me do a Pietro and share a wonderful article on skills which should be ... I suggest schools should consider teaching the following skills: ... pace needs to be taught, together with the most appropriate posture, ... All students need to be taught to read body language, to sense mood, to ...
    (soc.culture.filipino)
  • Re: Top 10 skills that schools should teach
    ... Let me do a Pietro and share a wonderful article on skills which should be ... I suggest schools should consider teaching the following skills: ... pace needs to be taught, together with the most appropriate posture, ... All students need to be taught to read body language, to sense mood, to ...
    (soc.culture.filipino)