Insert data into a table so that its primary key is combined from 2 columns

I am combining these columns as a primary key.

room_no, type 

When I insert new data, for example, 0001 01 .

And then I insert 0001 02 .

It's impossible. He said a duplicate primary key. Why is it duplicated, although I define 2 columns as the primary key.

+4
source share
2 answers

This is the same as the compsite key.

You can read this article: - http://www.techrepublic.com/article/the-great-primary-key-debate/1045050

0
source

Just a thought:

  • Have you defined specific indexes on them?
  • Have you identified each key individually as unique?
+4
source

All Articles