Database Basic Components

Decide what data to capture in a database by thinking about the business problems

  1. Discover what a business does

  2. Write down the data and connections between the data

  3. Design the database to align

  4. Repeat

Data Model (Entity Relationship Diagram) includes three parts: entity, attribute, relationship

  • Entity: Construct that represents what the database tracks

    • Held in a box

    • A given example of an entity is called an instance of that entity

  • Attribute: Characteristic of an entity

    • Held in a bubble linked to the box of the entity it is part of

    • There must always be at least one unique attribute (attribute whose value is different for each entity)

    • Types

      • Candidate Key: Unique attribute of an entity (Underline)

      • Composite Attribute: Attribute composed of attributes (put in parentheses)

      • Multivalued Attribute: Attribute that can have multiple values for the same attribute (double oval). For multivalued attributes, make a new table

      • Derived Attribute: Attribute that is calculated rather than stored (dashed oval)

      • Optional Attribute: Attribute allowed to be empty

  • Relationship: Links two entities together

    • Line between two entities

    • Cardinality: How many?

      • Maximum Cardinality: One is a | and many is a <

      • Minimum Cardinality: Required is a | and optional is a o


EMPLOYEE >|——|| Department

Laptop |o——|< Monitor

Restaurant >o——o< customer