2011-08-15 15 views
0

私はフォーラムのウェブサイトを構築していましたが、そのMysql構造を作成する方法を決定できませんでした。ここのように、ユーザーはたくさんの質問をし、ユーザーは何度も答えますが、回答が多いと上書きされることはありません。だから、私はフォーラムのWebサイトの質問と回答のテーブルのテーブルを作成します。各ユーザーの質問と回答の表のテーブルを1つだけ作成すると、上書きされませんか?フォーラムのウェブサイトのMysql構造

答えて

1

ユーザー表:

user_id (int, auto_increment) 
username (varchar) 
password (varchar, 32 (md5)) 
email (varchar (to recover password)) 

フォーラム表:

forum_id (int, auto_increment) 
forum_title (varchar) 
forum_category (int) 

フォーラムサブカテゴリ:

forum_subcat_id (int, auto_increment) 
forum_id (int) 
forum_subcat_title (varchar) 
forum_subcat_description (text) 

フォーラムのスレッド:

thread_id (int, auto_increment) 
thread_title (varchar) 
thread_body (text, regular thread format) 
forum_subcategory (int, where it belongs) 
posted_by (int, the user that posts the thread) 
posted_on (int, timestamp of the time the thread was posted) 

コメント表:

comment_id (int, auto_increment) 
comment_body (text, comment text) 
thread_id (int) 
commented_by (int, user_id) 
comment_time (int, timestamp of the time the comment was posted) 

はちょうどあなたが評価システムのような多くの機能を追加することができますあなたのコースの、それがどのように見えるか、幅広いアイデアを、与え、世論調査など

0

これは、質問と回答の両方に対して1つのテーブルを作成しないためです。代わりに、2つのテーブルがあります。例えば:もちろん

Question 
======== 
question_id 
question_text 

Answer 
====== 
answer_id 
user_id 
question_id 
date_answered 
answer_text 

、USER_IDは、上記ユーザを収容するためのさらに別のテーブルを意味しています。

関連する問題