1

If I have a table like the Following

CustomerAddress(CustomerId, AddressId)

Would I still need an additional primary key, e.g., int auto increment? Or would setting both the columns as primary keys be sufficient?

ASSUMPTION: When deleting, I will only delete by customerId, never by both customerId and AddressId

Null Reference
  • 11,260
  • 40
  • 107
  • 184

2 Answers2

0

It seems this is a join table. In this case, I'd have a cascading delete between the dependent objects, e.g. when a customer is deleted, all customerAddresses belonging to said customer are also deleted.

hd1
  • 33,938
  • 5
  • 80
  • 91
0

I suggest you to keep a primary key. Though it is not useful for now, it might be useful in future. May be the combination customerid and addressid could have new field like current_address_flag. And its just about creating a field that is almost manipulated by the DB system.

hsuk
  • 6,770
  • 13
  • 50
  • 80