I would like to know how you can prevent to use of two same tags in a database table.
One said me that use two private keys in a table. However, W3Schools -website says that it is impossible.
My relational table
alt text http://files.getdropbox.com/u/175564/db/db7.png
My logical table
alt text http://files.getdropbox.com/u/175564/db/db77.png
The context of tables
alt text http://files.getdropbox.com/u/175564/db/db777.png
How can you prevent the use of duplicate tags in a question?
I have updated my NORMA model to more closely match your diagram. I can see where you’ve made a few mistakes, but some of them may have been due to my earlier model.
I have updated this model to prevent duplicate tags. It didn’t really matter before. But since you want it, here it is (for Postgres):
Note that there is now a separate Tag table with
TAG_IDas the primary key.TAG_NAMEis a separate column with a uniqueness constraint over it, preventing duplicate tags. TheQuestionTaggedTagtable now has (QUESTION_ID,TAG_ID), which is also its primary key.I hope I didn’t go too far in answering this, but when I tried to write smaller answers, I kept having to untangle my earlier answers, and it seemed simpler just to post this.