规范化:它做得好吗?

时间:2013-12-11 19:58:05

标签: mysql database database-schema database-normalization

我正在创建游戏评论数据库。我是新人,但我正在努力。关于数据库的一点点:系统很简单,用户填写php表单,在那里插入他的名字,电子邮件时选择反馈是好还是坏,并留下评论/建议。我正在添加照片视觉效果,我很抱歉外部链接,我无法在此处上传:Visual database

所以这是我的表格以及我如何进行规范化的过程:

(I believe this is 1NF, correct me if I am wrong)

Table_review { 
    User ID 
    User name
    User email
    Feedback
    Comment
}    


(I believe this is 2NF, correct me if I am wrong)

Table_user { 
    User ID 
    User name
    User email
    Comment
}

Table_review { 
    Feedback ID 
    Feedback
}

(I believe this is 3NF, correct me if I am wrong)

Table_user { 
    User ID 
    User name
    User email
    Comment
}

Table_review { 
    Feedback ID 
    Feedback
}

Table_user { 
    User ID 
    User name
    User email
    Comment
}

Table_whole { 
    User ID 
    Feedback ID
}

我的问题:

它是否正常化了?

“Table_whole”应该包含自己的ID吗?

我说感谢你的帮助,因为我的时间已经不多了。

1 个答案:

答案 0 :(得分:0)

-- The user can make as many comments as they like
Table_review { 
    User ID 
    Game ID
    Feedback ID
}    

Table_feedback {
    Feedback ID
    Comments
    TimeStamp
}

-- Now users can comment on what other users think 
-- but only to one level of nesting
Table_feedback_comments {
    Feedback ID
    User ID
    Comment
    TimeStamp
}

-- a user can only rate a game once, but they can change their rating over time
-- For example more content was added and the user likes this 
-- and wants to reflect that in their rating
Table_rating {
    Game ID
    User ID
    Rating
}

Table_user { 
    User ID 
    User name
    User email
    Comment -- something that describes the user
}

-- Even if you have only one game you can still store it in the database
Table_game {
    Game ID
    Game Name
    -- other columns used to represent a game
}