Search code examples
rdbms

What is the difference between entity and relationship


I am new to the RDBMS.

I am Learning ER model in RDBMS. In ER model, the entity is an real world object and it has an attributes. The relationship is an mapping between entity set. The relationship also have a the attributes. Please explain the difference between entity and relationship.


Solution

  • You seem to have the definition differences available. But I assume you still do not understand the differences. Here is a very simplified example of two entities and the relationship that may exist between them:

    A Bank and a Person are each an entity. The relationship that exists between a Bank and a Person is that a Person is a Customer to a Bank. Therefore Customer is the relationship. An attribute for a Person for example would be Date_of_Birth. An attribute for a Bank would be Bank_Name . An attribute for a Customer would be Customer_Bank_Acc_Number.


    Update: For those that like to pick at details here is a better relationship example:

    A Person can have a relationship with a Bank of either being a Debtor or Creditor.


    Update

    There is also what is called an Associative Entity. Click the link for details on how that is different to an Associative Relationship.

    I hope this makes sense. Cheers