Primary Key

Toa Pita asked 2 years ago

Is it possible for an entity in a database to have multiple primary keys? For example, at my work, we can look up a customer file by their customer number. I would assume that CustomerID# would be the primary key except that each customer must have a distinct email address and an email address can only exist on one customer file at a time because the email is the identifying feature of the file. So which is the primary key? The customerID number or the email address? 

1 Answers
Justis answered 2 years ago

It just depends on how the database is set up, unless you need a composite primary key there’s no point in having two primary keys. However, In lots of databases you can set a field so that it must have a unique value when compared with all the other records, but that doesn’t make it a primary key. The primary key is simply the unique identifier for that specific record in that table and in other tables. So, it sounds like your work is using the customer ID as a primary key and have the ’email’ field set as a unique field. At the same time, you don’t need to know how to set fields as a unique field in an ERD, you just need to know the primary key, and in that case it would be the customer ID. Let me know if you have more questions about this!

Your Answer

11 + 18 =

css.php