0

This question is based on my plan at the thread.

I have the following table

alt text http://files.getdropbox.com/u/175564/table-problem-2.png

where kysymys is a question in English.

I would like to know how I should store the data of an user's question:

  • in a separate table where I have the parameters question-id and question-body OR
  • in the current table where I have other parameters too

I need to neutralize the question-body somehow in the future such that user does not give code which breaks my system.

How would you store the data of the user's text?

Community
  • 1
  • 1
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697

2 Answers2

2

This will depend:

You mention: "where kysymys is a question in English."

Are you planning to have the same question in other languages?

If that's the case, normalize the question and question body out to another table. That way, given a language and a question ID, you can retrieve the right one.

However, if the question is only going to be in English, just leave it in the same table. That's perfectly fine.

thedz
  • 5,496
  • 3
  • 25
  • 29
  • I am not planning to have the same question in many languages. --- My table contains some Finnish because I need to explain it to people who do not understand English. – Léo Léopold Hertz 준영 Jul 25 '09 at 18:49
  • In that case, I'd just leave it in the same table. There's no point in normalizing it out to another table. – thedz Jul 25 '09 at 19:07
1

Are you planning to store revisions of a question ? e.g. StackOverflow allows you to revise the question text and it stores the history.

If this is the case I would store the text separately. You would store answers/comments referenced against the question-id, but the question text would be held in a separate table.

Your data neutralisation issue (above) is orthogonal to this (a separate issue of data sanitisation/cleansing).

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
  • Thank you for pointing that out! -- I want to build a system which I can extend in the future. I will put the questions to a separate table. – Léo Léopold Hertz 준영 Jul 25 '09 at 19:12
  • Glad to be of help. I usually normalise data in databases early and collapse later if/when I realise that level of indirection is not required or not optimal – Brian Agnew Jul 25 '09 at 19:14