Sunday, April 6, 2014

ER diagram for a database of company

Problem
Draw an entity-relationship diagram for a database with companies, people, and professionals (people who work for companies).
Solution
  • Entities:
    1. Company: companyID, companyName, companyLocation, ect
    2. People: peopleID, name, gender, age, etc
    3. Professional: professionalID , FK to People, degree, work experience
  • Relations:
    1. People ISA Professionl: 1:1
    2. Professional WORKS Company: N:1
People who work for companies are Professionals. So there is an ISA (is a) relationship between People and Professionals (or we could say that a Professional is derived from People). So, Professional is a person, but not all people are professional.
Each Professional has additional information such as degree, work experiences, etc, in addition to the properties derived from People.

A Professional works for one company at a time, but Companies can hire many Professionals, so there is a Many to One relationship between Professionals and Companies. This “Works For” relationship can store attributes such as date of joining the company, salary, etc. These attributes are only defined when we relate a Professional with a Company.

A Person can have multiple phone numbers, which is why Phone is a multi-valued attribute.

References
http://tianrunhe.wordpress.com/2012/04/18/er-diagram-for-a-database-of-company/

Reactions:

3 comments:

  1. Thanks this info was really helpful! I used a website called Lucidchart to find er diagram examples and it was really easy to understand. If you use diagrams often you should check it out!

    ReplyDelete
    Replies
    1. Yes its a good and online option. For offline (and online) option, we can also use Microsoft Visio, which is equally good.

      Delete
  2. I agree with Macy! I learned How to Draw ERD (Entity Relationship Diagram) using Lucidchart and it was very helpful and easy to use!

    ReplyDelete