Skip to main content
Engineering LibreTexts Entities

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    Entities are the people, places, things, or events that are of interest for a system that we are planning to build. In the previous section we considered there were several entities: four students and two courses.

    In general we find examples of entities when we think of people, places, things, or events in our area of interest:

    People: student, customer, employee

    Places: resort, city, country

    Things: restaurant, product, invoice, movie, painting, book, building, contract

    Events: registration, election, presentation, earthquake, hurricane

    Entity sets are named collections of related entities. From our example we have two entity sets:

    • The Student entity set comprises at least the 4 student entities: John, Amelia, Lee, and April.
    • The Course entity set comprises at least the 2 course entities: Introduction to Art and Introduction to History.

    Entity sets are the collections of entities of one type. We consider an Entity Type to be the definition of the entities in such a set. A common convention is to name entity types as singular nouns and that, at least, the first letter is capitalized.

    In an ERD entity types are shown as named rectangular shapes. For example:

    ERD entity types example.
    Figure \(\PageIndex{1}\): ERD entity types example.

    The Student and Department entity types shown above are drawn with a simple single-line border. This means that they are regular (or strong) entity types that are not existence-dependent on other entity types (see the next section).

    Exercises (Set 1)

    Exercise \(\PageIndex{1}\)

    Consider your educational institution. Your educational institution needs to keep track of its students. How many student entities does the institution have? You have provided the institution with information about you. In your opinion, what attributes describe these entities?

    Exercise \(\PageIndex{2}\)

    Consider your place of work. The Human Resources department in your company needs to manage information about its employees. How many employee entities are there? What attributes describe these entities?

    Exercise \(\PageIndex{3}\)

    Consider your educational institution or place of work.

    1. What are some of the entity types that would be useful?
    2. What relationships exist that relate entity types to one another?
    3. What attributes would be useful to describe entities and relationships?
    4. Draw an ERD.

    Weak Entities

    Sometimes we know certain entities only exist in relationship to others. For example, a typical educational institution comprises a number of departments that offer courses. So we could have a History department, an Art department and so on. These departments would design and deliver courses that students would register for. In this framework the courses exist in the context of a department, and the identifier for a course is typically a department code and course number combination. So the history course, Introduction to History, belongs to the History department and it would be known by the identifier HIST-765. HIST is a code representing the History department and 765 is a number assigned to the course; other departments could have a course with that same number, 765.

    In these situations where the existence of an entity depends on the existence of another entity, we say the entity is a weak entity, and the corresponding entity type is a weak entity type. Weak entities often have identifiers that comprise multiple parts (such as department code and course number). Later on we will see other aspects of an ERD that relate to weak entity types. At this time we should be aware that weak entity types are illustrated in an ERD with a double-lined rectangle:

    Course as a weak entity type.
    Figure \(\PageIndex{2}\): Course as a weak entity type.

    Often when we purchase things the vendor provides an invoice giving details of each item that is purchased (see the sample invoice below). Appearing on the invoice are detail lines specifying the product, the quantity and price. Invoice lines are things that exist only in the context of an invoice and so each invoice line is a weak entity; the invoice lines are existence-dependent on an invoice:

    Sample Invoice.
    Figure \(\PageIndex{3}\): Sample Invoice.

    The following includes a few attributes to show how Invoice and Invoice Line could appear in an ERD.

    Invoices (regular entity type) and Invoice Lines (weak entity type).
    Figure \(\PageIndex{4}\): Invoices (regular entity type) and Invoice Lines (weak entity type).

    Exercises (Set 2)

    Exercise \(\PageIndex{4}\)

    Consider a requirement having to do with benefits that may be given to employees of a company. Suppose employees work in a department and that each employee may have several dependents (spouse, child). Draw an ERD that includes Department, Employee, and Dependent in your design. Include attributes for your entity types.

    Exercise \(\PageIndex{5}\)

    When you buy items in a store you often get a cash register receipt that details the items you have purchased. Develop an ERD that includes Store, Customer, Receipt, and Detail Lines. Entities is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Ron McFadyen.

    • Was this article helpful?