Chapter -2- Data Modeling Using the Entity-Relationship Model

Slides:



Advertisements
Similar presentations
Database Design The process of finding user requirement
Advertisements

the Entity-Relationship (ER) Model
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Week 3 Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model.
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Chapter 3)
APPENDIX C DESIGNING DATABASES
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Chapter 3 Relational Model Chapter 4 in Textbook.
Data Modeling Using the Entity-Relationship Model
Data Modeling Using the Entity-Relationship Model
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Data Modeling.
Chapter 2 Entity-Relationship Model Chapter 11 & 12 in Textbook.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entity-Relationship Model
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Entity-Relationship Model Ch. 3
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
Chapter 7: Modeling Data in the Organization Dr. Taysir Hassan Abdel Hamid IS Department Faculty of Computer and Information Assiut University March 8,
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Entity – Relationship Model (E-R Model)
Data modeling using the entity-relationship model Chapter 3 Objectives How entities, tuples, attributes and relationships among entities are represented.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
Data Modeling Using the Entity-Relationship (ER) Data Model (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Data Modelling Using Entity-Relationship (ER) Model
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Data Modeling Using the Entity- Relationship (ER) Model
Comp 1100 Entity-Relationship (ER) Model
Data Modeling Using the Entity- Relationship (ER) Model
Entity-Relationship Model
Chapter 3 Data Modeling Using the Entity-Relationship Model
CS4222 Principles of Database System
Data Modeling Using the Entity- Relationship (ER) Model
Database Management Systems
Entity- Relationship (ER) Model
ER model Ashima Wadhwa.
Entity-Relationship Model
Entity Relationship Model
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Entity-Relationship Model
Tables and Their Characteristics
Chapter -3- Data Modeling Using the Entity-Relationship Model
Chapter -3- Data Modeling Using the Entity-Relationship Model
Entity-Relationship Modelling
Outline of the ER Model By S.Saha
ER MODEL Lecture 3.
Lecture3: Data Modeling Using the Entity-Relationship Model.
بسم الله الرحمن الرحيم.
ERD’s REVIEW DBS201.
Entity Relationship Diagrams
Chapter 4+17 The Relational Model Pearson Education © 2014.
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
Entity-Relationship Modelling
Database Modeling using Entity Relationship Model (E-R Model)
Review of Week 1 Database DBMS File systems vs. database systems
Conceptual Data Modeling Using Entities & Relationships
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
Entity-Relationship Diagram (ERD)
Mapping an ERD to a Relational Database
Entity Relation Model Tingting Zhang.
Chapter # 4 Entity Relationship (ER) Modeling.
Presentation transcript:

Chapter -2- Data Modeling Using the Entity-Relationship Model Database Design Chapter -2- Data Modeling Using the Entity-Relationship Model References: Prof. Mona Mursi Lecture notes

Database Design Steps in building a database for an application: 1. Understand real-world domain being captured 2. Specify it using a database conceptual model (E/R,OO) 3. Translate specification to model of DBMS (relational) 4. Create schema using DBMS commands (DDL) 5. Load data (DML) خطوات تصميم قواعد البيانات اتطبيق معين (بنك مثلا): تحليل الاحتياج ودراسة الواقع. تحديد المواصفات بواسطة نموذج تصوري (ER model). ترجمة المواصفات لنموذج قاعدة بيانات. عمل مخطط لتركيبة قاعدة البيانات (schema). إنشاء النظام وتحميل البيانات. Real-world domain Conceptual model DBMS data model Create Schema (DDL) Load data (DML)

Database Design Process Requirement Analysis Conceptual Design Logical Design Physical Design مراحل تصميم قواعد البيانات: تحليل الاحتياج التصميم المفاهيمي ER (يشرح الكينونات للنظام والعلاقات بينها) التصميم المنطقي (schema) التصميم الفعلي (يتعلق بكيفية تخزين البيانات ومسارات الوصول إليها)

Entity Relationship Data Model ER model was first developed by Peter Chen in1976. It is a high-level conceptual data model. ER model describes the users data requirements as relationships among a group of entities. It represent the logical structure of databases. Special graphical symbols are used to present entities and the relationships between them.

Entity Relationship Modeling Identifying the entities. Define the relationships among these entities. Define the attributes and keys for each entity. The ER diagram.

Entity-Relationship Model (E/R) The Entity-Relationship model (ER) is a high-level description of the structure of the DB The Entity-Relationship Diagram (ERD) is a graphical model for representing the conceptual model for the data A E/R models the DB using three element types: - Entities - Attributes - Relationships

ERD Example

Entities Entity: The basic object that the ER model represent is an entity which is a thing in the real world. Physical existence : like a person, employee, cars . Conceptual existence : like job, course. Entity type: Entities sharing the same attribute set. It is described by its name and attributes. Entities of the same entity type are called entity set. الكينونة: كائنات تمثل أشياء في الواقع ممكن أن تكون موجودة بشكل حقيقي مثل الموظف أو بشكل تصوري مثل المقرر

The particular properties that describes the entity. Attributes Attribute: The particular properties that describes the entity. e.g.: an employee is described by : name, age, address, salary , job. * An entity will have a value for each of its attributes. السمات (الخواص): خواص مميزة تصف الكينونة مثل: الكينونة: الموظف. السمات: الاسم، العمر،العنوان، الراتب، الوظيفة. كل كينونة لها قيم خواصها

Entities & Attributes STUDENT COURSE STUDENT COURSE name DOB name St_no Tel_no hours number STUDENT COURSE

Attributes Attribute types :- Composite and Simple. Single Valued and Multi valued. Stored and Derived Attributes. أنواع الخواص (السمات): مركبة أو بسيطة. وحيدة القيمة أو متعددة القيم مخزنة أو مستمدة من خواص أخرى

Attribute Types Composite vs Simple Composite attributes: divided into smaller subparts e.g. name divided into first, initial ,last. Simple attributes: attributes that are not divisible e.g. salary. Name FirstName MiddleName LastName SALARY initial FName LName الخواص المركبة الخواص البسيطة Area_cd DOB name no St_no Tel_no EX STUDENT

Single Valued vs Multivalued Single value : most attributes are of this type. E.g. age Multivalued: set of values for the same Attribute . E.g. car colors, previous degrees. Color initial FName LName الخواص ذات القيمة الوحيدة الخواص ذات القيم المتعددة Area_cd DOB name no St_no Tel_no EX Mobile STUDENT

Stored vs Derived Attributes Stored attributes: regular attributes. Derived attributes: are calculated from attributes of one or several related entities. E.g. calculating the salary from the hours worked and number of hours. BDate Age الخواص المخزنة الخواص المستمدة name DOB St_no Tel_no age STUDENT

More Attribute Types Null values: some entities may not have an applicable values for an attribute => a special value is created called Null. E.g. in the employee information the field of mobile number can have a null value because some employees do not have mobile phones. Complex attributes: composite and multivalued attributes can be nested. {} represents multivalued. () represents composite attributes. E.g. a person may have many certificate, each certificate has the subfields name, year and level. Therefore it is represented this way : {certificate (name, year, level)} الخواص الخالية الخواص المركبة

Example of Entity & Attributes Name Fname Lname Address Street City Zip Degree Id STUDENT Ssn Age Gpa STUDENT id, (Fname,Lname), {degree},(street, city, zip), age, gpa, ssn

Entities Entity Type: is a collection of occurrences of entities that have common properties. E.g. employees. Entity Instance: is a single occurrence of an entity type. E.g. the student named Nora. Entity Set: a collection of all entities of a particular entity type in the database at any point in time. E.g. Employee . Employee refers to both the type of entity + the current set of all employees entity in the database. مثلا الكينونه الموظفين هذه تسمى entity type هذه الكينونه فيها اكثر من خاصيه مثلا الأسم و العنوان و الراتب الموظف احمد يسمى entity instant مجموعه البيانات المدخله في جدول الموظفين من اسماء و عنواين و رواتب لكل الموظفين تسمى Entity set الموظف احمد راتبه و عنوانه مع بعض يسمى entity وهي نفس السجل record في الجدول

Entity Must have many instants in DB. Must have many attribute . Represented as a rectangle box inside it the entity type name . الكينونات: يجب أن يكون لها حالات يجب أن يكون لها خواص مميزة تمثل برسم مستطيل

Entity Doctor Ahmed manage a heart clinic in a hospital . Where is the entities types and relationships ? Doctor , hospital  entity Ahmad  instant Manage  relationship الكينونة الدكتور أحمد يدير عيادة القلب في المستشفى Doctor Manage hospital

Key Attributes of an Entity Type Key attribute: is a key that identifies each entity uniquely, and has a distinct value . E.g. the name attribute in the company entity is unique. primary key: The primary key uniquely identifies each record in the table Candidate Key (CK): a set of attributes that uniquely identify an instance of an entity. E.g. Students can be identified by SSN or ID. Composite Key: is a key made from more than one attribute. E.g. the flight can be uniquely identified by flight number and flight date. Alternate Key (AK): is a candidate key that is NOT selected to be the primary key. مفتاح الكينونة: الفتاح الأساسي المفتاح المرشح المفتاح المركب المفتاح البديل

Keys Example Student Birth date Student name Student _ id المفتاح البسيط Example of Simple key

Composite Key in ERD CLASS FLIGHT name Section_no hours crs_code المفتاح المركب FlightNo Date FLIGHT

Primary Key Attribute (PK) Can be a single attribute or composite attribute. Can be called identifier. Weak entity may have no key. Has the following criteria: Should not change its value Not null خصائص المفتاح الأساسي: يمكن أن يكون أحادي أو مركب يسمى معرف (Identifier) الكينونات الضعيفة قد لا يكون لها مفتاح- سنشرح ذلك لاحقا المفتاح الأساسي لا يمكن تغيير قيمته ولا يمكن أن يكون خاليا

Strong & Weak Entity Types A strong entity type is NOT existence-dependent on some other entity type. It has a PK. A weak entity type is an entity type that is existence-dependent on some other entity type. It does not have a PK. الكينونات القوية والكينونات الضعيفة الكينونات القوية لا يعتمد وجودها على وجود كينونات أخرى ولها مفتاح أساسي الكينونات الضعيفة يعتمد وجودها على وجود كينونات أخرى وليس لها مفتاح أساسي

Weak Entity Type The existence of a weak entity type depends on the existence of a strong entity set; it must relate to the strong entity type via a relationship type called identifying relationship. The PK of a weak entity set is formed by the PK of its strong entity type, plus a weak entity type discriminator attribute (Partial key). الكائنات الضعيفة يجب أن تعتمد على وجود علاقة لها مع كائنات قوية المفتاح الأساسي للكائن الضعيف هو عبارة عن المفتاح الأساسي للكائن القوي ذا العلاقة معه مضافا إليه خاصية مميزة من الكائن لضعيف LName FName gender NAME emp_no DOB has EMPLOYEE DEPENDENT

Values Sets (Domains) of Attributes Domain: the set of values that might be assigned to the attribute for each individual entity. e.g. ages of employees can be ( 16-70) e.g. names is a set of alphabetical characters only Not displayed in ER diagram. المجال: مجموعة القيم الممكنة لكائن معين. مثال: القيم الممكنة لعمر الموظف مثلا (16-70) مثال: القيم الممكنة لاسم الموظف هي حروف فقط. لا تظهر على رسم ER

Relationships Constrains on relationship type: Cardinality ratios: The max number of relationships instance an entity can participate in. The values of Cardinality ratios: One to one(1:1). One to many (1:N) many to one (N:1). Many to many (M:N). A student is enrolled in one or more courses and a course has many students in it. M N STUDENT Registers COURSE N 1 TEACHER Works-in DEPARTMENT

Relationships Participation constrains: The min number of relationships instance an entity can participate in. Tow types of participation: Total (every entity in the entity type must participate in the relationship). Partial (some entities in the entity type participate in the relationship). Every course must have a teacher but not every teacher must teach a course. Teaches Total TEACHER Partial COURSE

Relationship ( min, max) constrains: There used to replace both cardinality & Participation Min value is minimum number of entity participation in a relationship. 0 : partial participation. 1 and more : total participation. Max value is maximum number of entity participation in a relationship must have max >=1. Teaches TEACHER COURSE Is equivalent to: (0,n) (1,n) Teaches TEACHER COURSE