101.school
CoursesAbout
Search...⌘K
Generate a course with AI...

    How Databases work

    Receive aemail containing the next unit.
    • Introduction to Databases
      • 1.1What is a Database?
      • 1.2Importance of Databases
      • 1.3Types of Databases
    • Database Models
      • 2.1Hierarchical Model
      • 2.2Network Model
      • 2.3Relational Model
      • 2.4Object-oriented Model
    • Relational Databases
      • 3.1Introduction to Relational Databases
      • 3.2Tables, Records, and Fields
      • 3.3Keys and Indexes
    • SQL Basics
      • 4.1Introduction to SQL
      • 4.2Basic SQL Commands
      • 4.3Creating and Modifying Tables
    • Advanced SQL
      • 5.1Joins
      • 5.2Subqueries
      • 5.3Stored Procedures
    • Database Design
      • 6.1Normalization
      • 6.2Entity-Relationship Diagrams
      • 6.3Data Integrity
    • Transaction Management
      • 7.1ACID Properties
      • 7.2Concurrency Control
      • 7.3Recovery Techniques
    • Database Security
      • 8.1Security Threats
      • 8.2Access Control
      • 8.3Encryption and Authentication
    • NoSQL Databases
      • 9.1Introduction to NoSQL
      • 9.2Types of NoSQL Databases
      • 9.3Use Cases for NoSQL
    • Big Data and Databases
      • 10.1Introduction to Big Data
      • 10.2Big Data Technologies
      • 10.3Big Data and Databases
    • Cloud Databases
      • 11.1Introduction to Cloud Databases
      • 11.2Benefits and Challenges
      • 11.3Popular Cloud Database Providers
    • Database Administration
      • 12.1Roles and Responsibilities of a Database Administrator
      • 12.2Database Maintenance
      • 12.3Performance Tuning
    • Future Trends in Databases
      • 13.1In-memory Databases
      • 13.2Autonomous Databases
      • 13.3Blockchain and Databases

    Database Design

    Understanding Entity-Relationship Diagrams in Database Design

    diagram that represents a workflow or process

    Diagram that represents a workflow or process.

    Entity-Relationship Diagrams (ERDs) are a vital tool in database design. They provide a visual representation of the data and its interrelationships, making it easier to plan and design a database that meets the needs of the system it will support.

    What are Entity-Relationship Diagrams?

    An Entity-Relationship Diagram is a type of flowchart that illustrates how entities such as people, objects, or concepts relate to each other within a system. ERDs are used to model or design relational databases.

    Components of ERDs

    ERDs consist of three primary components:

    1. Entities: These are the objects or concepts that the database will store information about. For example, in a database for a university, the entities might include Students, Courses, and Professors.

    2. Attributes: These are the properties or characteristics of the entities. For the Student entity, attributes might include Student ID, Name, and Major.

    3. Relationships: These describe how the entities interact with each other. For example, a Student might be enrolled in a Course, or a Course might be taught by a Professor.

    Types of Relationships

    There are three types of relationships in ERDs:

    1. One-to-One (1:1): Each instance of Entity A can be associated with one instance of Entity B, and vice versa. For example, each student has one student ID, and each student ID belongs to one student.

    2. One-to-Many (1:M): Each instance of Entity A can be associated with multiple instances of Entity B, but each instance of Entity B is associated with only one instance of Entity A. For example, a professor can teach many courses, but each course is taught by one professor.

    3. Many-to-Many (M:N): Each instance of Entity A can be associated with multiple instances of Entity B, and vice versa. For example, a student can be enrolled in many courses, and each course can have many students.

    Cardinality and Modality in ERDs

    Cardinality and modality are two important concepts in ERDs:

    • Cardinality refers to the maximum number of times an instance in one entity can relate to instances of another entity. It can be one-to-one, one-to-many, or many-to-many, as described above.

    • Modality refers to the minimum number of times an instance in one entity can relate to instances of another entity. It can be zero (meaning the relationship is optional) or one (meaning the relationship is mandatory).

    Creating ERDs: Steps and Best Practices

    Creating an ERD involves several steps:

    1. Identify the entities: Determine what objects or concepts the database needs to store information about.

    2. Identify the attributes: Determine what information needs to be stored about each entity.

    3. Identify the relationships: Determine how the entities interact with each other.

    4. Draw the ERD: Use a tool or software to create the diagram, using standard symbols to represent entities, attributes, and relationships.

    Here are some best practices for creating ERDs:

    • Use clear, descriptive names for entities, attributes, and relationships.
    • Keep the diagram simple and avoid unnecessary complexity.
    • Regularly review and update the ERD as the system evolves.

    By understanding and effectively using ERDs, you can design a database that accurately represents the data and its relationships, making it easier to build, maintain, and use.

    Test me
    Practical exercise
    Further reading

    Howdy, any questions I can help with?

    Sign in to chat
    Next up: Data Integrity