Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 10th, 2012, 04:01 PM
paulh1983 paulh1983 is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Posts: 2,234 paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 10 h 45 m 54 sec
Reputation Power: 201
Database design questions

I have few questions that i would like to ask:

1. If i am creating a system whereby there is a hierarchy of users (i.e. students, teachers, manager). should I store this in one table or three? avoids having to self join again and again to get relevant info?

2. if i need a system whereby I can set some questions and answers, or questions with multi-choice answers. How best should I store them?

Class_id, question_id,question,answer (for Q&A)

class_id,question_id,question,answer (for multiple choice Questions)
question_id,choice

Reply With Quote
  #2  
Old December 10th, 2012, 04:51 PM
aeternus's Avatar
aeternus aeternus is offline
For POny!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Amsterdam
Posts: 416 aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 4 h 56 m 43 sec
Reputation Power: 114
Iwould do the following:
#1 For question1:
Store them in the same table but with a usergroup,
Code:
id name groupID etc
33 John 3          xxx

Make a second table to store user groups
Code:
GroupID description
1          students
2          teachers
3          alumni


*this allows you to add and alter groups or names and sort them by number


#2 For your second question.
I would make 2 tables (questions and answers)
and interlink them with their corresponding id's

The reason why you want 2 different tables is because you would otherwise duplicate data, which is unnecesary.
table questions:
Code:
QID  question                      type
22    What do gorilla's eat?    multiple

table answers:
Code:
AID  QID   answer                     
1      22    banana's
2      22    Soup
3      22    Lemons
Comments on this post
paulh1983 agrees: sorry for taking so long to say thanks
__________________
PHP Tutorial

Last edited by aeternus : December 10th, 2012 at 04:57 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Database design questions

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap