UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] 2620003 [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.

Slides:



Advertisements
Similar presentations
Chapter 2: Entity-Relationship Model
Advertisements

Chapter 2: Entity-Relationship Model
Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the.
Text-Book Chapters (7 and 8) Entity-Relationship Model
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
1 Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of an E-R Database.
1–1 The E-R Model Prof. Sin-Min Lee Department of Computer Science.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Chapter 2: Entity-Relationship Model
Chapter 2: Entity-Relationship Model (Continued)
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com The following slides are.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
Entity-Relationship Model
Notes by Ankur Shukla Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys.
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Entity-Relationship Model
Chapter 2: Database Design and Entity-Relationship Model  Database Design  Entity Sets  Relationship Sets  Design Issues  Mapping Constraints  Keys.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 7 Database Design and The E–R Model. 2 Goals n Facilitate DB design and represent the overall logical structure of the DB. n Definition Entities.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
Chapter 6: Entity-Relationship Model. Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
6.1 Chapter 6: Database Design and the ER Model Skip 6.5.3, 6.10, 6.11.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 6: Entity-Relationship Model.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts DB Schema Design: the Entity-Relationship Model What’s the use of the E-R model? Entity Sets.
Entity – Relationship Model (E-R Model)
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model ([S] Chp. 6) Entity Sets Relationship Sets Design Issues.
Entity Relationship Diagram (2)
DATABASE MANAGEMENT SYSTEM Entity-Relationship Model.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Modeling A database can be modeled as: a collection of entities, relationship among entities. An entity is an object that exists and is distinguishable.
Database and Information Retrieval System
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.
 Design Process  Modeling  Constraints  E-R Diagram  Design Issues  Weak Entity Sets  Extended E-R Features  Design of the Bank Database  Reduction.
Database System Concepts, 5th Ed. Bin Mu at Tongji University Chapter 6: Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
Chapter 6: Entity-Relationship Model. Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the.
CST203-2 Database Management Systems Lecture 4. Student entity NIDFNameLNameRegNoExamIdBirthdate.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
CS157A Lecture 4 ER Model 2 Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Extended ER Modelling. Extended E-R Features: Specialization Top-down design process; we designate subgroupings within an entity set that are distinctive.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of an.
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
Chapter 2: Entity-Relationship Model
Entity Relationship (E-R) Model
Entity Relationship Model
Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Outline of the ER Model By S.Saha
Chapter 6: Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the.
Database EER.
Chapter 2: Entity-Relationship Model
Presentation transcript:

UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar

UNIT_22 The Entity-Relationship (E-R) data model perceives the real world as consisting of basic objects, called entities, and relationships among these objects. An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships between entities in a database. It was developed to facilitate database design by allowing specification of an enterprise schema, which represents the overall logical structure of a database. It Represent of the meaning of the data. ER diagrams often use symbols to represent Information  Entity-Relationship Model

UNIT_ Basic Concepts The E-R data model employs three basic notions: I. Entity sets II Attributes III Relationship sets Entity Sets An Entity is a “thing” or “object” in the real world that is distinguishable from all other objects. Individual objects are called entities Groups of the same type of objects are called entity types or entity sets Entities are represented by rectangles

UNIT_24  Attributes An attribute is a specification that defines a property of an object. Each attribute can have any value from its domain. Attributes can be simple or composite Having single-valued or multi-valued Fname STUDENT ADD_1

UNIT_25  An attribute, as used in the E-R model, can be characterized by the following attribute types. Simple and composite attributes Single-valued and Multivalued attributes Derived attribute Attributes have been simple; that is, they are not divided into subparts.  Simple Attributes

UNIT_26  Composite Attributes Composite attributes, on the other hand, can be divided into subparts. For example, an attribute name could be structured as a composite attribute consisting of first-name, middle-initial, and last-name. Composite attributes help us to group together related attributes, making the modeling cleaner.

UNIT_27

8  Single-valued Attributes The attributes in our examples all have a single value for a particular entity. For instance, the loan-number attribute for a specific loan entity refers to only one loan number. An employee‘s social security number might be the employee's key attribute. Such attributes are said to be single valued and key attributes. Attribute

UNIT_29 A Multivalued attribute can have more than one value. For example, an employee entity can have multiple skill values. Consider an employee entity set with the attribute phone-number. An employee may have zero, one, or several phone numbers.  Multivalued attributes Attribute

UNIT_210  Derived attribute The value for this type of attribute can be derived from the values of other related attributes or entities. A derived attribute is based on another attribute. For example: an employee's monthly salary is based on the employee's annual salary.

UNIT_211  Relationship Sets The relationship is the interaction between the entities. For example, we can define a relationship that associates customer Gitesh with loan no. L-15, This relationship specifies that Gitesh is a customer with loan number L-15. A relationship set is a set of relationships of the same type. Consider the two entity sets loan and branch. We can define the relationship set loan-branch to denote the association between a bank loan and the branch in which that loan is maintained.

UNIT_212  Constraints There are two types of constraints 1.Mapping cardinalities 2.Participation constraints

UNIT_213 Mapping cardinalities, or cardinality ratios, express the number of entities to which another entity can be associated via a relationship set. Mapping cardinality must be one of the following I. One to one: An entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A.  Mapping Cardinalities

UNIT_214 II. One to many: An entity in A is associated with any number (zero or more) of entities in B. An entity in B, however, can be associated with at most one entity in A.

UNIT_215 III. Many to one An entity in A is associated with at most one entity in B. An entity in B, however, can be associated with any number (zero or more) of entities in A.

UNIT_216 An entity in A is associated with any number (zero or more) of entities in B, and an entity in B is associated with any number (zero or more) of entities in A. IV. Many to many:

UNIT_217  Participation Constraints The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in at least one relationship in R. If only some entities in E participate in relationships in R, the participation of entity set E in relationship R is said to be partial.

UNIT_218  Keys No two entities in an entity set are allowed to have exactly the same value for all attributes. A key allows us to identify a set of attributes that suffice to distinguish entities from each other. Keys also help uniquely identify relationships, and thus distinguish relationships from each other.

UNIT_219  Types of Keys I. Super Key II. Candidate key III. Primary key IV. Unique Key V. Foreign Key Super key is a set of one or more than one keys that can be used to identify a record uniquely in a table. Example : Primary key, Unique key, Alternate key are subset of Super Keys. I. Super Key

UNIT_220 II. Candidate Key A Candidate Key is a set of one or more fields/columns that can identify a record uniquely in a table. There can be multiple Candidate Keys in one table. Each Candidate Key can work as Primary Key. Example: In below diagram ID, RollNo and EnrollNo are Candidate Keys since all these three fields can be work as Primary Key.

UNIT_221 Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It can not accept null, duplicate values. Only one Candidate Key can be Primary Key. III. Primary Key Uniquekey is a set of one or more fields/columns of a table that uniquely identify a record in database table. It is like Primary key but it can not accept null value and it can not have duplicate values. IV. Unique Key

UNIT_222 Foreign Key is a field in database table that is Primary key in another table. Example : We can have a DeptID column in the Employee table which is pointing to DeptID column in a department table where it a primary key. V. Foreign Key

UNIT_223  Practically in database, we have only three types of keys Primary Key, Unique Key and Foreign Key.  Other types of keys are only concepts of RDBMS that we need to know. NOTE:

UNIT_224  Entity-Relationship Diagram E-R diagram can express the overall logical structure of a database graphically. Such a diagram consists of the following major components: Rectangles: which represent entity sets Ellipses: which represent attributes Diamonds: which represent relationship sets Lines: which link attributes to entity sets and entity sets to relationship sets Double ellipses: which represent multivalued attributes Dashed ellipses: which denote derived attributes

UNIT_225 Double lines: which indicate total participation of an entity in a relationship set Double rectangles: which represent weak entity sets

UNIT_226

UNIT_227

UNIT_228  Weak Entity Sets An entity set may not have sufficient attributes to form a primary key. Such an entity set is named as a weak entity set. Weak entity set does not have a primary key, we underline the discriminator of a weak entity set with a dashed line We depict a weak entity set by double rectangles in E-R diagram. A weak entity is an entity that depends on the existence another entity.

UNIT_229

UNIT_2 30 An entity set that has a primary key is termed a strong entity set.  Strong Entity Set

UNIT_231  Extended E-R Features(Generalization, Specialization & Aggregation) An entity set may include subgroupings of entities that are distinct in some way from other entities in the set. For instance, a subset of entities within an entity set may have attributes that are not shared by all the entities in the entity set. Consider an entity set person, with attributes name, street, and city. A person may be further classified as one of the following:  customer  employee  Specialization

UNIT_232  Generalization A bottom-up design process – combine a number of entity sets that share the same features into a higher-level entity set. Specialization and generalization are simple inversions of each other; they are represented in an E-R diagram in the same way. It only differs in the design process. Specialization is a top-down design process, Whereas Generalization is a bottom-up design process. The concept of generalization is similar to inheritance in Java.

UNIT_233 Figure :Specialization and generalization

UNIT_234  Aggregation A feature of the entity relationship model that allows a relationship set to participate in another relationship set. This is represented in a ER diagram by a diamond shape. For example, an 'Employee' 'works-on' a 'branch‘. An 'Employee' 'manages' some tasks. The 'Works-on' entity here can be abstracted via the use of aggregation.

 Aggregation Suppose we want to record managers for tasks performed by an employee at a branch

UNIT_236 Relationship sets works-on and manages represent overlapping information – Every manages relationship corresponds to a works-on relationship – However, some works-on relationships may not correspond to any manages relationships So we can’t discard the works-on relationship Eliminate this redundancy via aggregation – Treat relationship as an abstract entity – Allows relationships between relationships – Abstraction of relationship into new entity Without introducing redundancy, the following diagram represents: – An employee works on a particular job at a particular branch – An employee, branch, job combination may have an associated manager  Aggregation (Cont.)

UNIT_237 Fig:E-R diagram with Aggregation

UNIT_238  Attribute Inheritance A crucial property of the higher- and lower-level entities created by specialization and generalization is attribute inheritance. The attributes of the higher-level entity sets are said to be inherited by the lower-level entity sets. For example, customer and employee inherit the attributes of person. Thus, customer is described by its name, street, and city attributes, and additionally a customer-id attribute; employee is described by its name, street, and city attributes, and additionally employee-id and salary attributes. A lower-level entity set (or subclass) also inherits participation in the relationship sets in which its higher-level entity (or superclass) participates.

UNIT_239  Constraints on Generalizations To model an enterprise more accurately, the database designer may choose to place certain constraints on a particular generalization. Constraint on which entities can be members of a given lower-level entity set. 1. Condition-defined E.g. all customers over 65 years are members of senior- citizen entity set; senior-citizen ISA person. Constraint on whether or not entities may belong to more than one lower-level entity set within a single generalization 2. User-defined

UNIT_ Disjoint An entity can belong to only one lower-level entity set. 4. Overlapping An entity can belong to more than one lower-level entity set. Completeness constraint: specifies whether or not an entity in the higher-level entity set must belong to at least one of the lower-level entity sets within a generalization. total : an entity must belong to one of the lower-level entity sets partial: an entity need not belong to one of the lower-level entity sets

UNIT_241  Summary of Symbols Used in E-R Notation

UNIT_242  Summary of Symbols (Cont.)

UNIT_243  Alternative E-R Notations

UNIT_244  Example of E-R Diagram