skip to Main Content

Indexes table

Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No ID 7 A No
AD_ID BTREE Yes No AD_ID
USER_ID
1
2
A
A
No
Yes
USER_ID BTREE No No USER_ID 2 A Yes

How can the column of USER_ID be unique and at the same time not be unique as you can see in the indexes table?

2

Answers


  1. The answer is yes, it happens, it’s called a database inconsistency problem or corruption. But in this case I see the user_id and AD_ID is a bit weird but that’s by design.

    Login or Signup to reply.
  2. Column USER_ID alone is not unique, but the combination of AD_ID and USER_ID is.

    Example:

    PRIMARY USER_ID AD_ID
    1 First AD_ID1
    2 First AD_ID2
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search