Are composite keys guaranteed to be unique as long as the individual values of the columns it consists of are unique (as in the column values are separately evaluated), or is it the resulting value (as in a concatenation of the column values) that makes up the key and has to be unique?
Would, for example, the following two rows result in the same key, or would they both be considered unique and therefore allowed:
PRIMARY KEY (user_id, friend_id)
|-----------|-------------|
| user_id | friend_id |
|-----------|-------------|
| 10 | 283 |
| 1028 | 3 |
|-----------|-------------|
Now, I'm obviously no database expert, it's actually the first time I'm thinking about using composite keys (never had reason to before), so it might be something that "everyone" knows about or is just really easy to find in the documentation, but I've been unable to find an answer to it.
You expect the example above to work (logically, why shouldn't it? The separate values are certainly unique), but I just really want to be sure before I proceed with my project.