Tuesday, March 29, 2011

DBMS-III,Entiry Relationship Model - I


Entiry Relationship Model - Part 1


            The title of the module is Entity Relationship model, which is considered as one kind of data model. A data model is basically a collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraints.  In this lecture, we cover the ER model and discuss how its features allow us to model a wide range of data faithfully.
               Entity – Relationship model was developed by Chen to facilitate database design by allowing the designer to express the logical properties of the database in an enterprise schema. The word enterprise means the organization for which the database is kept. ER model basically  translates the informal description into more detailed and precise  description suitable for implementation by DBMS.               
An enterprise schema is a description that corresponds to the conceptual schema in the three-layer architecture of databases. The model is valid for any kind of DBMS and will remain correct even if the if the DBMS is changed. Entity-Relationship model uses ER diagrams to represent enterprise schema, a conceptual level description that is independent of DBMS. The diagrams are basically design tools and documentation for the system.
                A data model that attempts to capture meaning as well as structure is termed as Semantic Data Model. The items in the model represent “things” in the real - world and the relationships between real - world “things” are expressed by relationships in the model. The environment of the model is described in terms of entities, attributes and relationships. 

                 
    
An entity is any distinguishable object in the real - world. Entity is categorized into entity types, and a collection of entities of the same type forms an entity set.  Attributes are representation of properties of the real-world entities. The set of values permitted for an attribute is its domain.  An attribute is mapping of the entity set into the domain of attribute.  Null values occur when an entity instance is missing a value for a particular attribute. For example: Names of  courses offered in a university  are values for course attribute course-name. These values are termed as domain. How each entity is described? Since each entity has several attributes, entity is described by a set of (attribute, data value) pairs. Attribute values describing an entity form a significant portion of the date stored in  the database.
Attribute Types: There are two types of attributes, i) simple and ii) composite. Each attribute in an entity set can be characterized by these  attribute types. 
Simple: when the value of the attribute is not divided, then it is called simple. Otherwise it is termed as composite. Example: name attribute : ( first, middle, last) is
example for composite attribute. Each component attribute can further be divided into subcomponents.
Single valued and multi valued attributes: When an attribute has a set of values for a specific entity, then it is termed as multi valued attribute. Otherwise it is single valued attribute. Phone number is an example for multi valued type attribute whereas rollno is a single valued.
Derived attribute: when we derive the value of a an attribute based on the values of other related attributes or entities then we call derived attribute. 
Key(s): An attribute or set of attributes which uniquely distinguish one entity with another entity. That means No two entities are allowed to have exactly the same values for all attributes. Keys are also useful to identify relationships uniquely and therefore we distinguish relationships from  each other
A relationship is an association or interaction between entities. For example, the two entities Instructor and Course are related by the fact that an Instructor teaches a Course. This is modeled using a ’relationship’ called ‘teaches’.
             A relationship set consists of all relations of a given relationship type. Relationships may be binary, linking two entities, ternary, linking three entities, or n-ary, linking n entities. Binary relationship instances can be represented as ordered pairs, ternary instances as ordered triples, and n-ary instances as ordered n-tuples. A relationship set is a subset of Cartesian product of the related entity sets. A relationship set always has primary keys of the related entity sets as attributes, but some also has descriptive attributes as well. Descriptive attributes appear in an oval connected to the relationship diamond.   Relationships have cardinality constraints, which specify how many entity instances may be related.  These may be one-to-one, one-to-many, many-to-one, or many-to-many.  In a relationship, each entity has a function called its role in the relationship.  When a single entity is related to itself then the relationship is recursive.
            In student-Course-Enroll database, two entity sets are student and course. The entity set student  is described with Four aftributes, namely rollno, name, address and city. The entity set course is  described with course-no, and Course-name and credits attributes.

No comments:

Post a Comment