Unix Technical Forum

Is this design okay ? only 6 tables

This is a discussion on Is this design okay ? only 6 tables within the MySQL forums, part of the Database Server Software category; --> I am trying to create a db schema for a survey. The survey is used by marketing managers to ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:32 AM
salimk786
 
Posts: n/a
Default Is this design okay ? only 6 tables

I am trying to create a db schema for a survey. The survey is used by
marketing managers to see how well a employee helped the customer. The
survey will have 10 questions.
A customer will type in their transaction number, store number of
where they purchased the product, and answer to the multiple choice
questions. Each question will have the choices:

Rate your satisfaction with the representative who assisted you.
1 2 3 4 5

Rate your satisfaction with the way you were greeted by the
representative.
1 2 3 4 5
.....

So i have the following tables:
Customers
Transactions
Customer_Transactions
Questions
Choices
Question_Choice


Process Flow:
Customer fills out everything and answers it, hits submit.
insert into customers their name, email, phone.
insert into transactions the transaction number.
insert into Customer_has_Transactions lastInsertID of customer,
LastInsertId of transaction
insert into Question_has_Choices, LastTransactionID, questionId,
ChoiceId,

when doing reports
I can pull data by store number and calculate averages for that store.

What do you think ?

here is a diagram:
http://img253.imageshack.us/my.php?image=surveybj0.png

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:32 AM
Jerry Stuckle
 
Posts: n/a
Default Re: Is this design okay ? only 6 tables

salimk786 wrote:
> I am trying to create a db schema for a survey. The survey is used by
> marketing managers to see how well a employee helped the customer. The
> survey will have 10 questions.
> A customer will type in their transaction number, store number of
> where they purchased the product, and answer to the multiple choice
> questions. Each question will have the choices:
>
> Rate your satisfaction with the representative who assisted you.
> 1 2 3 4 5
>
> Rate your satisfaction with the way you were greeted by the
> representative.
> 1 2 3 4 5
> ....
>
> So i have the following tables:
> Customers
> Transactions
> Customer_Transactions
> Questions
> Choices
> Question_Choice
>
>
> Process Flow:
> Customer fills out everything and answers it, hits submit.
> insert into customers their name, email, phone.
> insert into transactions the transaction number.
> insert into Customer_has_Transactions lastInsertID of customer,
> LastInsertId of transaction
> insert into Question_has_Choices, LastTransactionID, questionId,
> ChoiceId,
>
> when doing reports
> I can pull data by store number and calculate averages for that store.
>
> What do you think ?
>
> here is a diagram:
> http://img253.imageshack.us/my.php?image=surveybj0.png
>
> thanks
>


Looks reasonable. I'm not sure what the "key" column is in Choices (bad
choice - don't use reserved words as column names). But you might also
want a sequence column in the Choices so you can display them in the
order you wish.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:32 AM
Evan Keel
 
Posts: n/a
Default Re: Is this design okay ? only 6 tables


"salimk786" <salimk786@gmail.com> wrote in message
news:9e7a7958-d4b2-41d7-921c-d20cd0704d5d@d21g2000prf.googlegroups.com...
> I am trying to create a db schema for a survey. The survey is used by
> marketing managers to see how well a employee helped the customer. The
> survey will have 10 questions.
> A customer will type in their transaction number, store number of
> where they purchased the product, and answer to the multiple choice
> questions. Each question will have the choices:
>
> Rate your satisfaction with the representative who assisted you.
> 1 2 3 4 5
>
> Rate your satisfaction with the way you were greeted by the
> representative.
> 1 2 3 4 5
> ....
>
> So i have the following tables:
> Customers
> Transactions
> Customer_Transactions
> Questions
> Choices
> Question_Choice
>
>
> Process Flow:
> Customer fills out everything and answers it, hits submit.
> insert into customers their name, email, phone.
> insert into transactions the transaction number.
> insert into Customer_has_Transactions lastInsertID of customer,
> LastInsertId of transaction
> insert into Question_has_Choices, LastTransactionID, questionId,
> ChoiceId,
>
> when doing reports
> I can pull data by store number and calculate averages for that store.
>
> What do you think ?
>
> here is a diagram:
> http://img253.imageshack.us/my.php?image=surveybj0.png
>
> thanks


From your diagram it looks like transaction number is unique across all
stores so Customer_has_Transactions needs only one key--Transaction_idTrans
(unless a transaction can be associated with more than one customer.
Likewise, Question_has_Choices requires only two keys--Transaction_idTrans
and Question_idQuestion. Sure hope you come up with better table and column
names..



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 11:32 AM
Evan Keel
 
Posts: n/a
Default Re: Is this design okay ? only 6 tables


"Evan Keel" <evankeel@sbcglobal.net> wrote in message
news:7x1mj.496$R84.39@newssvr25.news.prodigy.net.. .
>
> "salimk786" <salimk786@gmail.com> wrote in message
> news:9e7a7958-d4b2-41d7-921c-d20cd0704d5d@d21g2000prf.googlegroups.com...
> > I am trying to create a db schema for a survey. The survey is used by
> > marketing managers to see how well a employee helped the customer. The
> > survey will have 10 questions.
> > A customer will type in their transaction number, store number of
> > where they purchased the product, and answer to the multiple choice
> > questions. Each question will have the choices:
> >
> > Rate your satisfaction with the representative who assisted you.
> > 1 2 3 4 5
> >
> > Rate your satisfaction with the way you were greeted by the
> > representative.
> > 1 2 3 4 5
> > ....
> >
> > So i have the following tables:
> > Customers
> > Transactions
> > Customer_Transactions
> > Questions
> > Choices
> > Question_Choice
> >
> >
> > Process Flow:
> > Customer fills out everything and answers it, hits submit.
> > insert into customers their name, email, phone.
> > insert into transactions the transaction number.
> > insert into Customer_has_Transactions lastInsertID of customer,
> > LastInsertId of transaction
> > insert into Question_has_Choices, LastTransactionID, questionId,
> > ChoiceId,
> >
> > when doing reports
> > I can pull data by store number and calculate averages for that store.
> >
> > What do you think ?
> >
> > here is a diagram:
> > http://img253.imageshack.us/my.php?image=surveybj0.png
> >
> > thanks

>
> From your diagram it looks like transaction number is unique across all
> stores so Customer_has_Transactions needs only one

key--Transaction_idTrans
> (unless a transaction can be associated with more than one customer.
> Likewise, Question_has_Choices requires only two keys--Transaction_idTrans
> and Question_idQuestion. Sure hope you come up with better table and

column
> names..
>
>
>


Oops, if a transaction belongs to one customer then you don't need the
Customer_has_Transactions table.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:32 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com