If only mobile phone registration, as long as the mobile phone to do a unique index, but if the mailbox can also be registered, the incoming is not necessarily a mobile phone, that is, mobile and email two can not set a unique index, because if two mobile phone users registered in, there will be two e-mail records of empty, There are no unique cases, and vice versa. What's the deal?
Reply content:
If only mobile phone registration, as long as the mobile phone to do a unique index, but if the mailbox can also be registered, the incoming is not necessarily a mobile phone, that is, mobile and email two can not set a unique index, because if two mobile phone users registered in, there will be two e-mail records of empty, There are no unique cases, and vice versa. What's the deal?
I feel there are two kinds of solutions:
1. Email and mobile are set to the same field.
2, email and mobile are also set to unique, but allow null, when the same is null can be inserted in a successful
Mobile + mailbox To do a unique index?
The upper two fields are judged to be feasible at the same time.
But do you have to use these two fields as a unique index? Add another field, adding a unique index value to the record, I don't know.
You set up your phone and mailbox as a federated unique index.
UNIQUE INDEX table
(' mobilephone ', ' email ')
This is easy. Select Mailbox Registration The mailbox is a unique identifier (for login) and can be tied to multiple phones. If the phone is registered, the phone is uniquely identified and can theoretically be bound to multiple mailboxes (but most of the actual prohibitions are multiple). This status can be registered by mobile phone and email two non-affected login account. So uniqueness is a must, but different types of accounts can exist what you call not unique! Get a good understanding of it!
You can use a meaningless unique number as the user's index, and then register to determine if the phone or mailbox you are using has already been registered. If you have not registered, generate a new unique number as the index for this newly registered user.
The uniqueness of the mailbox and the phone is guaranteed by the judgment at the time of registration.
However, if a user supplements a phone or mailbox that is not filled in at the time of registration, it is necessary to consider whether or not you still want to be unique.