How can the system ensure the uniqueness of mobile phone and email registration?

Source: Internet
Author: User
If only mobile Phone registration is required, you only need to make a unique index for the mobile phone, but if the mailbox can also be registered, it is not necessarily a mobile phone. That is to say, neither mobile nor email can have a unique index, because if two mobile phone users are registered, there will be two blank email records ,... if only mobile Phone registration is required, you only need to make a unique index for the mobile phone, but if the mailbox can also be registered, it is not necessarily a mobile phone. That is to say, neither mobile nor email can have a unique index, if two mobile phone users are registered, there will be two blank email records, which are not unique and vice versa. How can this problem be solved?

Reply content:

If only mobile Phone registration is required, you only need to make a unique index for the mobile phone, but if the mailbox can also be registered, it is not necessarily a mobile phone. That is to say, neither mobile nor email can have a unique index, if two mobile phone users are registered, there will be two blank email records, which are not unique and vice versa. How can this problem be solved?

I think there are two solutions:
1. Set email and mobile to the same field.
2. email and mobile are set to unique at the same time, But null is allowed. If they are both null, they can be inserted successfully.

What if mobile phone + email is used as the unique index?

The two fields upstairs should be both feasible.
But must these two fields be used as the unique index? Add another field and add a unique index value to the record?

You can set your mobile phone and email address as a unique index.
UNIQUE INDEXtable('Lelephone', 'email)

This is simple. If you select "Mailbox registration", the mailbox is a unique identifier (used for Logon) and can be bound to multiple mobile phones. If the mobile phone is used for registration, the mobile phone is a unique identifier. In theory, you can also bind multiple mailboxes (but most of them are forbidden ). In this status, you can register two accounts that do not affect logon through your mobile phone or email. Therefore, uniqueness is required, but different types of accounts can be unique! Please understand it!

You can use a unique meaningless number as the user's index, and then determine whether the mobile phone or email address used has been registered during registration. If it is not registered, a new unique number is generated as the index of the newly registered user.

The uniqueness of the mailbox and mobile phone is ensured by the judgment during registration.

However, if the user adds a mobile phone or email address that is not filled in at the time of registration, you need to consider whether the uniqueness should be ensured.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.