Database Engineering
  • Need of Database
  • Database and Database Management System
  • What is Relational Database Model ?
  • Installing Postgresql
    • Installing PostgreSQL on Linux
    • Installing PostgreSQL on Windows
    • Installing PostgreSQL on Mac
    • Postgres in Docker
  • What happens during the initial installation ?
    • Roles, Users & Groups
    • More examples on Roles
  • Sample Databases
    • DVD Rental Database
  • Querying Data
    • SELECT Query
    • Column Aliases
    • Order By
    • SELECT DISTINCT
    • DB-TASK-001
  • Filtering Data
    • WHERE ?
    • AND Operator
    • OR Operator
    • LIMIT
    • FETCH
    • IN
    • BETWEEN
    • LIKE
    • SIMILAR TO
    • IS NULL
    • ESCAPE
    • DB-TASK-002
  • Entity Relationship Diagram
    • What is an ER Diagram ?
    • Entity
    • Identifiers
    • Relationship
    • Attributes
    • Cardinality
    • Entity Relationship Diagram Tutorial
    • DB-TASK-003
  • Joins
    • Joins
    • Joins With Employee and Departments
  • Joins on E-Commerce
Powered by GitBook
On this page
  • Entity Type
  • Entity Set
  • Entity Categories
  • What Should an Entity Type Be?
  1. Entity Relationship Diagram

Entity

PreviousWhat is an ER Diagram ?NextIdentifiers

Last updated 5 months ago

A definable thing - such as a person, object, concept or event, that can have data stored about it. Think of entities as nouns. Examples: a customer, student, car or product.

Organisation require information in order to carry out tasks and activities for which they are responsible. The information that these organisations need could be categorized in a number of ways, for example,

An entity may represent a category of people, things, events, locations or concepts within the area under consideration. An entity instance is a specific example of an entity. For example, Syed Jafer is an entity instance of an student entity.

Denoted with Rectangle.

Entity Type

A group of definable things, such as students. Examples include:

  • Student: A generic type representing all students.

  • Course: Represents all courses offered by the university.

  • Department: Represents academic departments.

Specific Entities

  • A specific student, e.g., John Doe, Student_ID: 12345.

  • A specific course, e.g., Calculus I, Course_ID: MATH101.

  • A specific department, e.g., Mathematics Department.

Entity Set

Represents an entity type at a specific point in time. Examples include:

  • Students enrolled in "Fall 2024" semester: This subset might include John Doe, Jane Smith, and Alice Brown.

  • Courses offered in "Spring 2025": Includes MATH101, ENG202, and CS301.

  • Departments active as of "2024": Includes Mathematics, Physics, and Computer Science.

Related Instances

  • Instance of Student: John Doe, enrolled in Spring 2024.

  • Instance of Course: MATH101, offered by the Mathematics Department.

Entity Categories

🥁 For now, dont think about primary key, foreign key or something.

Strong Entity

  • Student: A strong entity because it can be uniquely identified using its own attributes like Student_ID.

  • Example attributes:

    • Student_ID (Primary Key)

    • Name

    • Date_of_Birth

Weak Entity

  • Dependent: A weak entity related to a student, such as a family member. It depends on the Student entity for identification. Even though it has a unique ID, Conceptually its dependant on student.

  • Example: Dependent_ID is meaningful only when associated with a specific Student_ID.

Associative Entity

  • Enrollment: An entity that associates Students and Courses.

  • Example attributes:

    • Enrollment_ID (Primary Key)

    • Student_ID (Foreign Key)

    • Course_ID (Foreign Key)

    • Semester

The Associative Entity is there to establish a Many to Many Relationship between Two or More Entities.

For Example, A Student can enroll in many courses. Also a course can be enrolled by many students. But we can't able to manage these details without an additional Entity (Table). This Entity is denoted as Associative Entity.

Also, Associative Entity, can contain additional values like duration in above example.

What Should an Entity Type Be?

SHOULD BE:

• An object that will have many instances in the database

• An object that will be composed of multiple attributes

• An object that we are trying to model

SHOULD NOT BE:

• A user of the database system

• An output of the database system (e.g. a report)