Reputation: 1912
I am making a user
entity here, there are some things that are not clear to me. So I have an attribute phoneNo
that user may have one or more phone numbers , so if I need something like that do I make a new entity phoneNumber
and have a phoneNo
as PK ? Also similar thing with customers where customer can either be regular or premium , do I have to make a new entity CustomerType ? I didnt want to make a new entity for isAdmin because it can be either off or on ? would this be ok...
this is what I am talking about
Upvotes: 2
Views: 133
Reputation: 562368
If a given attribute may have multiple values, use a separate table. Your isAdmin
attribute probably can have only one scalar value, which may be true or false.
I would expect the reference in that diagram to go the other way. That is, User
may have multiple phoneNumber
s, so you should make phoneNumber
reference User
. And then you would not need a column phoneNo
in the User
table.
The diagram you have shows the opposite relationship, in which a phoneNumber
could have multiple User
s.
The direction of the reference for CustomerType
is consistent with what I would expect it to be. That is, there may be multiple User
s with a given CustomerType
.
Upvotes: 2