If this table in your database directly refers to another table, then no. Without the rest of your structure, I'm not quite sure. Therefore, I will give a general rule with an example:
Customer table:
But you will not ask for an individual address without associating it with a person. So, you have this second table called the address.
- CustomerId
- Street
- Town
- Zip
- State
So, this client will always have an associated address, so the definition of Foreign Key acceptable. Now, if the client is allowed to have more than one address, then yes, you will need a Primary Key , so the structure will stand by itself.
If this data is always bound to another table, you can simply define the Foreign Key . Obviously, your implementation and access to your database can have an impact. Therefore, you need to be careful. If you use various technologies, such as:
Knowledge of the implementation and design of your database and application.
However, without a Primary Key you will need to define Indexes so that you can optimize your database. Because Primary Key always Indexed .
A surrogate key with an index will suffice.
Sorry if I misunderstood your question, but hopefully this indicates that you are in the right place.
source share