2

I'm designing a database. This system has question, answer and comment.

  • Question has some type of questions. In each type, there some differences so they're have some difference fields.
  • Answer and comment have some slight differences too.

But both those three tables have some same things: UserID, content, DateCreated, VoteUp, VoteDown, Share ...

  • With those similar, should I combine question, answer and comment into one table name Post?
  • Has an additional field to tell which kind of this post?
  • Which advantages and disadvantages for this way?
  • Take a look at open source "clones" of StackExchange here – Vérace Jul 8 '15 at 20:44
  • Well it all depends on the expected data volume and query patterns, can you give more information about these ? – Clément Prévost Jul 8 '15 at 21:36
  • @ClémentPrévost Query Pattern. Can you tell me more about this, please. In fact, I see that divide into two tables can make everything looks clearer and gain a little performance. thanks :) – hqt Jul 9 '15 at 9:06
  • But if I divide into two tables, I will meet some problems with ORM framework. The generating model doesn't know how reference key is from question or answer (because it needs a mark variable) – hqt Jul 9 '15 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.