Entities, Attributes, and Relationships PDF
Document Details
Uploaded by DecisiveGreatWallOfChina1467
Tags
Summary
This document provides a concise introduction to the Entity-Relationship (ER) model used in database design. It explains the fundamental concepts of entities, attributes, and relationships, along with the graphical symbols used to represent them in Entity Relationship Diagrams. The document is a good starting point for beginners learning about data modeling.
Full Transcript
302 Entities, Attributes, and Relationships In the ER (Entity-Relationship) model, entities, attributes, and relationships are the core ** ** ** ** ** ** **...
302 Entities, Attributes, and Relationships In the ER (Entity-Relationship) model, entities, attributes, and relationships are the core ** ** ** ** ** ** ** ** components used to define the structure of a database. Understanding these concepts is ** ** essential for designing a logical and efficient database. ** ** In this lesson, we’ll explore the symbols used in ER models, define entities and entity sets, ** ** ** ** ** ** ** ** explain different types of attributes, and introduce relationships between entities. By the ** ** ** ** ** ** end of this lesson, you’ll have a foundational understanding of how these elements work together to form a well-structured data model. ** ** Symbols Used in ER Models ** ER diagrams utilize specific symbols to make the structure of data intuitive and easy to ** ** ** ** ** understand: **~ Rectangles: Represent entities or groups of entities , known as entity sets, such as ~** ==** ** ** **== ** ** ** Student or Course. ** ** ** **~ Ellipses: Represent attributes , which are properties of entities like Name or Student ~** ** == == ** ** ** ** ** ** ID. ** **~ Diamonds: Depict relationships between entities, like a Student enrolling in a ~** ** == == ** ** ** ** ** ** Course. ** **~ Lines: Show connections ~** ** == == ** between entities and attributes or ** ** *** *** between entities and relationships. ** ** *** *** **~* Double Ellipses: Used to indicate Multivalued Attributes , * ~** ** == == ** **~* Dashed Ellipses: * ~** Used to indicate Derived Attributes, which are calculated from other attributes , such ==** ** * ** ***== as Age derived from Date of Birth. ** ** ** ** **~* Double Rectangle: * ~** Represents a Weak Entity. ** == == ** These symbols help visualize the data model and its structure, making it easier for designers ** ** * * ** ** and stakeholders to understand data requirements and organization. * * ** ** ** ** Entities and Entity Sets In the ER model, an entity is a real-world object or concept that is distinct and needs to be ** ** ** ** ** ** ** ** represented in the database. ** ** An entity is typically represented by a rectangle in ER diagrams. ** ** ** == == ** ** ** Entity Example For example, a Student in a school database is an entity that represents a real-world ** ** ** ** ** ** **~ individual with data to be stored. ~** ** ** Entity Set An entity set is a collection of similar entities that share the same attributes. For instance, ** ** * ** *** * ** *** the Student entity set includes all individual students, each with attributes like Student ID, ** ** ** ** ** ** ** ** ** Name, and Date of Birth. ** ** ** Attributes ** Attributes are properties or details about an entity. ** ** ** ** ** ** ** == Each Entity in an Entity Set has the same attributes , which are represented as ** ** ** ** * ** ***== * ** == ellipses in ER diagrams. == ** ** ** * ** Attributes provide specific details about each entity instance. ** ** ** ** ** Key Attribute A key attribute uniquely identifies each entity within an entity set , ensuring there are no ** ** == ** ** ** **== ~~ duplicates. ~~ ** Example: StudentID is a key attribute for the Student entity, uniquely identifying each ** ** ** ** ** ** ** ** student in the system. ** Composite Attribute A composite attribute consists of multiple components, each of which has its own ** ** * == ** ** meaning. == * *** Composite attributes can be divided into smaller attributes. ** == ** **== * ** Example: Address might be a composite attribute, which can be broken down into Country, ** ** ** ** ** ** ** ** State, City, and Street. ** ** ** ** ** Multivalued Attribute A multivalued attribute can hold multiple values for a single entity instance. ** ** ** ** * Unlike single-valued attributes, which store only one value per attribute, multivalued ** *** ** ** *** attributes allow for a list of values. ** * ** Example: For the Student entity, a multivalued attribute could be Phone Numbers if a ** ** ** ** ** ** ** ** student has multiple contact numbers. ** * * Derived Attribute A derived attribute is calculated from other attributes and is not stored directly in the ** ** * == ** ** ** database. **== * ** Example: Age can be a derived attribute based on the Date of Birth. ** ** ** ** ** * ** ** * Relationship Type and Relationship Set * * * * A relationship defines how two or more entities are associated. ** ** ** ** In ER diagrams, relationships are represented by diamonds connecting the related entities. ** ** ** ** ** ** ** ** Relationship Type * * == A relationship type describes the association between two or more entity types without ** ** ** **== == specifying the exact instances. ** **== * For example, a Student may "enroll" in a Course. This general type of connection, "Enrolls * ** ** ** ** ** ** ** In," describes how students are related to courses. ** ** ** ** ** ℹ Relationship Set * * A Relationship Set is a collection of similar relationships between instances of entities. ** ** ** ** ** ** ** ** * For example, the set of all instances of Students enrolled in Courses forms a Relationship * ** ** * ** Set for the "Enrolls In" Relationship Type. ** ** ** ** ** * Sets are depicted as a Vertical Shaded Ellipse and are at the Logical Level. Appendix: Relationship Type Vs. Relationship Instance ** Relationship Type: ** ** Definition: A relationship type represents a general, abstract association between two ** ** ** or more entity types. ** Scope: It applies at the schema level and defines how entities are expected to relate to ** one another. ** Example: ** *** == "Employee works for Department" – This describes a general rule or association ~ ~ == *** between the Employee and Department entity types. ** ** ** ** ** Purpose: Establishes the framework for how entities will relate, guiding the design of ** the database. ** Relationship Instance: ** ** Definition: A relationship instance is a specific occurrence of a relationship type that ** ** ** ** ** connects concrete entities. ** Scope: It applies at the data (instance) level and represents actual data entries that ** adhere to the relationship type. ** Example: ** *** == "John Smith works for IT Department" – This links the specific entity John ~ ~ == *** ` Smith (an instance of Employee) to the IT Department (an instance of ` ` ` Department). ** Purpose: Represents real-world data reflecting associations between actual records. ** ** Key Differences: ** Aspect Relationship Type Relationship Instance ** Level ** Schema/Design Data/Instance ** Abstract vs. Specific ** Abstract Specific ** Example of ER Diagram (lines Rows in a relationship Representation ** connecting entities) table (data entries) ** Persistence ** Defined during modeling Created dynamically as data is inserted In essence, relationship type defines how entities relate in theory, while relationship ** ** ** ** ** instances are the actual examples of those relationships in the database. ** ** ** …