SQL Schema - Default of 1:Many
How can I specify the default value of a 1:Many relationship ... for example take a user that has 5 phone numbers ... I need to record the "preferred" phone number. Should I use an attribute on the phone_number record to indicate the preferred one - or have a attribute of the user record (preferred_phone_nu开发者_运维知识库mber
for example) that is the primary key from the phone_numbers table ?
Thanks
User.preferred_phone
: you have zero or one preferred numbers per user.Phone.is_preferred
: you may have any amount of preferred numbers per user, without a way to choose the 'most preferred', and even 'preferred numbers' that no user relates to.
So I'd clearly stick with #1.
精彩评论