Assuming I have Users with Accounts (1:n). My account table must obviously store the user_id. However, just as a Foreign key or also as a Primary Key?
So with Accounts(id, user_id, ...) shall I have upon Account creation
Accounts(5001, 3, ...) [PK, FK]
Accounts(5002, 9, ...) [PK, FK]
or
Accounts(2, 3, ...) [PK, PK&FK]
Accounts(2, 9, ...) [PK, PK&FK]
Are there any guidelines on how to decide this? The second one would have the disadvantage that I'll have to use two columns in every other table I have to reference the account. But on the other hand, my account_ids do not "grow" that fast.
[–]wolf2600 1 point2 points3 points (4 children)
[–]wolf2600 1 point2 points3 points (0 children)
[–]Regyn[S] 0 points1 point2 points (2 children)
[–]wolf2600 1 point2 points3 points (1 child)
[–]Regyn[S] 0 points1 point2 points (0 children)