ER Model (Entity-Relationship Diagram) PDF

Summary

This document provides a comprehensive explanation of Entity-Relationship Diagrams (ERDs), their components, types and their application in database design. The document describes various concepts, from entities and attributes to relationships, in relation to Database Management Systems (DBMS).

Full Transcript

ER Model (Entity- Relationship Diagram) by TEAM 4 ENTITY RELATIONSHIP MODEL The Entity Relationship Diagram (ER) is a database structure that identifies and represents entities and their relationships. It was developed by Peter Chen in 1976 and has evolved into variations lik...

ER Model (Entity- Relationship Diagram) by TEAM 4 ENTITY RELATIONSHIP MODEL The Entity Relationship Diagram (ER) is a database structure that identifies and represents entities and their relationships. It was developed by Peter Chen in 1976 and has evolved into variations like the Enhanced ER Model and the Object Relationship Model. The ER diagram provides a graphical representation of the overall logical structure of a database, allowing for easy understanding of the relationships among real-world objects. Why Use ER Diagrams In DBMS? ER diagrams represent the E-R model in a database, making them easy to convert into relations (tables). ER diagrams provide the purpose of real-world modeling of objects which makes them intently useful. ER diagrams require no technical knowledge and no hardware support. These diagrams are very easy to understand and easy to create even for a naive user. It gives a standard solution for visualizing the data logically. Components of a ER Diagram 1. Entity - Entity can be a physical or conceptual object, such as a person, car, house, or employee. Types of Entity Strong Entity - not dependent on any other entity and will always have a primary key, represented by a rectangle. Weak Entity - is dependent on a strong entity to ensure its existence. Unlike a strong entity, it does not have any primary key and represented by a double rectangle. Components of a ER Diagram 2. Attributes - are the properties that define the entity type, and is represented by an oval. For example, Roll_No, Name, DOB, Age, Address, and Mobile_No are the attributes that define entity type Student. Components of a ER Diagram Types of Attributes Key Attributes - The attribute which uniquely identifies each entity in the entity set is called the key attribute and is represented by an oval with underlying lines. Composite Attribute – an attribute composed of many other attributes. For example, the address attribute of a student entity type, consisting of Street, City, State, and Country, is represented in an ER diagram as an oval. Components of a ER Diagram Types of Attributes Multivalued Attribute - consisting of more than one value for a given entity. For example, Phone_No (can be more than one for a given student), is represented by a double oval. Derived Attribute - An attribute that can be derived from other attributes of the entity type and is represented by a dashed oval. For example, Age (can be derived from DOB). Components of a ER Diagram 3. Relationships - represents the association between entity types. For example, ‘Enrolled in’ is a relationship type that exists between entity type Student and Course. In ER diagram, the relationship type is represented by a diamond and connecting the entities with lines. Components of a ER Diagram 4. Cardinality - Specifies the number of instances in a relationship. One-to-one - One instance of Entity A relates to one instance of Entity B. For example, a student has only one student ID. For example, Let us assume that a male can marry one female and a female can marry one male. One-to-Many - Multiple instances of Entity A can relate to multiple instances of Entity B. For example, students can enroll in multiple courses, and courses can have multiple students. Components of a ER Diagram Many-to-One – Multiple instances of one Entity set can take part only once in the relationship set. For example, each employee works in a single department, but each department has many employees. Many-to-Many - Multiple instances of Entity A can relate to multiple instances of Entity B. For example, an author can write multiple books, and each book can be written by multiple authors. ERD Symbols and Notations ERD DIAGRAM SYBOLS Strong entity - These shapes are independent from other entities, and are often called “parent entities”, since they will often have weak entities that depend on them. They will also have a primary key, distinguishing each occurrence of the entity. Weak entity - Weak entities depend on some other entity type. They don't have primary keys, and have no meaning in the diagram without their parent entity. Associative entity - Associative entities relate the instances of several entity types. They also contain attributes specific to the relationship between those entity instances. ERD Symbols and Notations Relationship - Relationships are associations between or among entities. Weak relationship - Weak Relationships are connections between a weak entity and its owner. Attribute - Attributes are characteristics of an entity, a many-to-many relationship, or a one-to-one relationship. Multivalued attribute - Multivalued attributes are those that are can take on more than one value. Derived attribute - Derived attributes are attributes whose value can be calculated from related attribute values. ERD Symbols and Notations Composite attribute - An attribute that is a combination of other attribute. ERD DIAGRAM NOTATIONS ONE MANY ONE ( AND ONLY ONE ) ZERO OR ONE ONE OR MANY ZERO OR MANY ERD Symbols and Notations ONE - Represents a one-to-one relationship where one instance of an entity is related to only one instance of another entity. MANY - Represents a one-to-many or many-to-many relationship. ONE (AND ONLY ONE) - Indicates that an entity must have exactly one associated entity. ZERO OR ONE - Indicates that an entity may have zero or one associated entity. ONE OR MANY - Specifies that an entity must have one or many related entities. ZERO OR MANY - Indicates that an entity can have any number (including zero) of associated entities. Conceptual, Logical, and Physical Data Conceptual Logical Physical Data What is a conceptual data model? A conceptual data model (CDM) operates at a high level, providing an overarching perspective on the organization's data needs. It defines a broad and simplified view of the data a business utilizes or plans to utilize in its daily operations. Conceptual data modeling aims to create a shared understanding of the business by capturing the essential concepts of a business process. These essential concepts are usually captured in an Entity Relationship Diagram (ERD) and the accompanying entity definitions. Developing a conceptual data model assists your team and stakeholders in understanding the essentials and the big picture – what kind of data you're working with and how different data entities relate. In addition, it creates a shared understanding of the business process and a common language for all technical and non-technical members. While many data teams struggle with communication and trust with their stakeholders, the CDM can help by promoting effective communication. What is a logical data model? 1. A logical data model (LDM) contains representations that fully defines relationships in data, adding the details and structure of essential entities. It’s important to note that the LDM remains data platform agnostic because it focuses on business needs, flexibility, and portability. 2. The LDM includes the specific attributes of each entity, the relationships between entities, and the cardinality of those relationships. It gives your team a solid framework to follow as you build your systems, and it can be used to effectively and efficiently plan and implement cloud data warehouses, data marts, application databases, or data analysis datasets. What is a physical data model? A physical data model (PDM) is a data model that represents relational data objects. It describes the technology-specific and database-specific implementation of the data model and is the last step in transforming from a logical data model to a working database. A physical data model includes all the needed physical details to build a database. Conceptual, Logical, and Physical Data “How to draw an ER Diagram” The very first step is Identifying all the Entities, and place them in a Rectangle, and labeling them accordingly. The next step is to identify the relationship between them and place them accordingly using the Diamond, and make sure that, Relationships are not connected to each other. Attach attributes to the entities properly using ovals. Remove redundant entities and relationships. Add proper colors to highlight the data present in the database. OO Model (Object- Oriented) by TEAM 4 OBJECT ORIENTED MODEL The Object-Oriented (OO) model is a way of programming that centers around "objects." These objects are created from classes, which are like blueprints that define both the data (attributes) and the actions (methods) that the objects can have. The goal of the OO model is to mimic real-world things and how they interact, making it easier to handle complex software projects. Key ideas in this model include encapsulation (hiding data), inheritance (sharing features between classes), polymorphism (using a single interface for different types), and abstraction (focusing on important details while ignoring the rest). These principles help make code more organized and easier to maintain. Components of the OO Model 1. Class - is a blueprint for creating objects. It defines the attributes and methods that the objects instantiated from the class will have. Example: A Car class might have attributes like color, model, and methods like drive() and stop(). 2. Objects - are instances of classes. They represent specific entities created from a class. Example: myCar could be an object of the Car class with specific values like color = "red" and model = "Toyota". Components of the OO Model 3. Attributes - are the data stored within an object. They represent the state of the object. Example: In the Car class, attributes might include speed, fuelLevel, and owner. 4. Methods - are functions defined within a class that describe the behavior of objects. They can manipulate object attributes or perform actions. Example: A method like accelerate() in the Car class might increase the speed attribute. Components of the OO Model 5. Inheritance – allows a new class (subclass) to inherit properties and methods from an existing class (superclass). This promotes code reusability and establishes a hierarchical relationship between classes. Example: A SportsCar class might inherit from the Car class, gaining all its attributes and methods but also introducing new ones like turboBoost(). Purposes of OO Model Testing a physical entity before building it - when it comes to OO model developers and designers are allowed to create a detailed representation or model of a system or entity before actually constructing the physical version. Communication with customers - OO models provide a visual and conceptual framework that helps non-technical stakeholders, like customers or clients, understand the system design. Visualization - refers to the ability to represent the structure, behavior, and interactions of a system in a clear, graphical manner. Object-oriented models often use visual tools like UML diagrams that map out system components (classes, objects) and their relationships, making it easier to grasp complex systems. Reduction of complexity - OO models help break down complex systems into manageable objects or classes, each encapsulating data and behavior. This modular approach makes it easier to understand, design, and maintain complex systems by focusing on smaller, well-defined parts that can interact with each other through interfaces and inheritance. ADVANTAGES DISADVANTAGES We can build the programs from standard working modules that The length of the programmes developed using OOP language is much communicate with one another, rather than having to start writing the larger than the procedural approach. Since the programme becomes code from scratch which leads to saving of development time and larger in size, it requires more time to be executed that leads to slower higher productivity, execution of the programme. OOP language allows to break the program into the bit-sized problems We can not apply OOP everywhere as it is not a universal language. It that can be solved easily (one object at a time). is applied only when it is required. It is not suitable for all types of The new technology promises greater programmer productivity, better problems. quality of software and lesser maintenance cost. Programmers need to have brilliant designing skill and programming OOP systems can be easily upgraded from small to large systems. skill along with proper planning because using OOP is little bit tricky. It is possible that multiple instances of objects co-exist without any OOPs take time to get used to it. The thought process involved in interference, object-oriented programming may not be natural for some people. It is very easy to partition the work in a project based on objects. Everything is treated as object in OOP so before applying it we need to It is possible to map the objects in problem domain to those in the have excellent thinking in terms of objects. program. The principle of data hiding helps the programmer to build secure programs which cannot be invaded by the code in other parts of the program. By using inheritance, we can eliminate redundant code and extend the use of existing classes. Message passing techniques is used for communication between objects which makes the interface descriptions with external systems much simpler. The data-centered design approach enables us to capture more details of model in an implementable form. Elements of OO Model The Major and Minor Elements of the Object Models The object oriented model is defined by four major elements (abstraction, encapsulation, modularity and hierarchy) and by three minor ones (typecasting, simultaneity and persistence). Major Elements Abstraction Encapsulation Modularity Hierarchy Minor Elements Typing Concurrency Persistence Elements of OO Model Abstraction Abstraction means displaying only essential information and hiding the implementation details. Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation. The main purpose of abstraction is hiding the unnecessary details from the users. Abstraction is selecting data from a larger pool to show only relevant details of the object to the user. Elements of OO Model Encapsulation: Encapsulation is a process of wrapping up of data and functions together as a single unit. It refers to the bundling of data with the methods that operate on that data to prevents them from being accessed by other classes. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. A class is an example of encapsulation it consists of data and methods that have been bundled into a single unit. Elements of OO Model Modularity Modularity is the process of decomposing a problem (program) into a set of modules so as to reduce the overall complexity of the problem. Modularity refers to the concept of making multiple modules first and then linking and combining them to form a complete system. Modularity enables re-usability and minimizes duplication. Elements of OO Model Hierarchy: A hierarchy is an organizational structure in which items are ranked according to levels of importance. Through hierarchy, a system can be made up of interrelated subsystems, which can have their own subsystems and so on until the smallest level components are reached. It uses the principle of “divide and conquer”. Hierarchy allows code reusability. 2 types of Hierarchy IS -A PART-OF Elements of OO Model Static and Dynamic Typing: Typing of a class prevents objects of different types from being interchanged. Binding is the association of the variables or classes to their types. The programming language can be categorized as strongly typed or weakly typed language. In strongly typed languages, the violation of type conformance can be detected at the compile time. This type of binding variables to their types called static binding or early binding In weakly typed languages, violation of typing conformance cannot be detected until runtime. Here variable are bound to their type at only execution time. This is called as dynamic binding or late binding. Static bind is fast but rigid while dynamic binding is slow but flexible. Concurrency: Concurrency in operating systems allows performing multiple tasks or processes simultaneously. When a single process exists in a system, it is said that there is a single thread of control. However, most systems have multiple threads, some active, some waiting for CPU, some suspended, and some terminated. Systems with multiple CPUs inherently permit concurrent threads of control; but systems running on a single CPU use appropriate algorithms to give equitable CPU time to the threads so as to enable concurrency. Persistence An object occupies a memory space and exists for a particular period of time. In traditional programming, the lifespan of an object was typically the lifespan of the execution of the program that created it. In files or databases, the object lifespan is longer than the duration of the process creating the object. This property by which an object continues to exist even after its creator ceases to exist is known as persistence. Types of OO Model 1. Class Model (Object Model) - The class model is the blueprint of the system's structure. It focuses on defining the objects that exist within the system, their attributes (data), and the operations or methods they can perform. Objects are instances of classes, and classes define the characteristics of these objects. The relationships between classes are also a key aspect of the class model, such as associations (connections between objects), inheritance (a class deriving properties from another class), and aggregation (where one class contains objects of another class). This model is represented using class diagrams, which help visualize the static structure of the system—what objects the system will need and how they relate to each other. By understanding the class model, developers can structure their code to reflect the real-world objects they are trying to model, ensuring that the system accurately represents its requirements. Class Model Purpose: Describes the static structure of a system by focusing on the objects, classes, attributes, methods, and their relationships. Components: Classes: Represent types of objects in the system. Attributes: Characteristics or properties of a class. Methods: Operations or functions that can be performed by the class. Relationships: Includes associations, generalization (inheritance), and aggregation between classes. Types of OO Model 2. State Model (Dynamic Model) - The state model describes the behavior of individual objects, focusing on how they change over time in response to various events. Each object can exist in a particular state (e.g., "idle," "active," "completed"), and as it encounters different events, it transitions from one state to another. This model is especially useful for systems where objects need to react dynamically, such as in user interfaces or simulations. State models are represented using state diagrams, which illustrate the different states an object can be in and the transitions between those states triggered by events. This model allows designers and developers to understand how objects in the system will behave, helping ensure the system responds appropriately to inputs or actions. State Model Purpose: Describes the dynamic behavior of individual objects in response to external or internal events. This model focuses on how objects transition from one state to another over time. Components: States: Different conditions in which an object can exist (e.g., "active", "pending", "completed"). Events: Triggers that cause a transition from one state to another. Transitions: Arrows that show movement from one state to another. Types of OO Model 3. Interaction Model (Functional Model) - The interaction model focuses on how objects collaborate and communicate with each other to achieve system functionality. It captures the flow of messages between objects and how those messages lead to actions or changes in the system. This model often aligns with the system’s use cases, as it shows the sequence of interactions required to fulfill specific tasks. This model is typically visualized using sequence diagrams or use case diagrams, and activity diagrams which outline the order of interactions between objects. The interaction model helps developers understand the system's dynamic functionality—how it operates, how objects collaborate to perform tasks, and how user or system inputs are processed to generate outcomes. It’s essential for defining workflows and understanding how different components interact in real-time. Use case diagram A use case diagram is a type of behavioral diagram in UML (Unified Modeling Language) that represents the functional requirements of a system. It shows the interactions between external users (called "actors") and the system, outlining the main use cases or functionalities the system provides. The goal is to visualize who uses the system and what they can do with it. Components: Actors: Represent external entities interacting with the system (e.g., users, other systems). Use Cases: Represent the functionalities or services provided by the system (e.g., "Login", "Place Order"). Relationships: Lines or arrows connect actors to use cases, indicating the interactions. Example of an OO Model PERSON -NAME -AGE -SETNAME() STUDENT DOCTOR ENGINEER -ROLLNO -D_ID -E_ID -BRANCH -SPECIALIST -DEPARTMENT -SETMARKS() -COUNTOPERATION() -COUNTPAGE() Example of an OO Model Objects – An object is an abstraction of a real world entity or we can say it is an instance of class. Objects PERSON encapsulates data and code into a -NAME -AGE single unit which provide data -SETNAME() abstraction by hiding the implementation details from the user. Example of an OO Model Attribute – An attribute describes the properties of object. STUDENT Methods – Method represents the -ROLLNO behavior of an object. Basically, it -BRANCH -SETMARKS() represents the real-world action. Example of an OO Model Class – A class is a collection of DOCTOR -D_ID similar objects with shared structure -SPECIALIST i.e. attributes and behavior i.e. -COUNTOPERATION() methods. An object is an instance of class. ENGINEER -E_ID -DEPARTMENT -COUNTPAGE() Example of an OO Model Inheritance – By using inheritance, new class can inherit the attributes and methods of the old class i.e. base class. PERSON -NAME -AGE -SETNAME() STUDENT DOCTOR ENGINEER -ROLLNO -D_ID -E_ID -BRANCH -SPECIALIST -DEPARTMENT -SETMARKS() -COUNTOPERATION() -COUNTPAGE() Example of an OO Model https://www.geeksforgeeks.org/introduction-of-er-model/ LINKS USED: https://www.geeksforgeeks.org/basic-object-oriented-data- model/ Presented by: Jessele Fugaban https://www.geeksforgeeks.org/benefits-advantages-of-oop/ Jude Garingalo https://www.geeksforgeeks.org/types-of-models-in-object- Koby Garrovillas oriented-modeling-and-design/ Marvin Guevarra https://www.thoughtspot.com/data-trends/data- Mark Lois Gutierrez modeling/conceptual-vs-logical-vs-physical-data-models https://www.shrignanambicacollege.edu.in/userfiles/OOAD%20BC A%201.pdf

Use Quizgecko on...
Browser
Browser