DBMS ASSIGNMENT SUBMITTED TO: Mrs. GOONJAN JAIN SUBMITTED BY : PANKAJ JAISWAL ( 2K15/MC/050) ENTITYRELATIONSHIP MODELAn entity relationship model is also called an entity-relationship diagram.It is a graphical representationof entities and their relationships to each other.The ER model consists of three basic elements: entities, attributes andrelationships.
CUSTOMER-ORDER-PRODUCTER-MODEL Construction of E-R Diagrams 1. Identify Entities: Modelling the entities is the firststep to create an ER data model. An entity is anobject, event or concept which is usually identified by a single, uniqueattribute. Generally, when a data model has an identifier fora possible entity, it is likely to be the entity. For ex, if there is a fieldfor customer name or customer number, then the entity relationship data model shouldhave an entity name CUSTOMER . Entity ORDER CUSTOMER PRODUCT 2. Identify attributes: Identify the attributes for each entity.
If the price of a product is constant for all orders, then PRICE is afunction of PRODUCT. If the price of the same product is different fordifferent orders, then the PRICE is a function of the relationship betweenORDER and PRODUCT. Entity Attributes ORDER ORDER_NO, DATE, AMOUNT CUSTOMER CUSTOMER_ID, NAME, ADDRESS, NUMBER PRODUCT PRODUCT_ID, DESCRIPTION, PRICE However, all cases are not so clear.
For example, take ADDRESS, perhaps a number of attributes were identified forthis candidate entity, like HOUSE NUMBER, STREET, STATE, ZIP_CODE. Does itindicate that ADDRESS is an entity? however, all of these should be attributesof CUSTOMER entity.3. Choose Primary Keys:After identifyingand modeling each entity and its attributes, primary keys must be chosen foreach entity. Desirable Primary Key Characteristics 1. Uniquely identifies an entity instance.
2. Non-null (always has a value) 3. Data-less 4. Never changes Characteristics of a Good Primary Key4. Identify the Relationships: Relationships among entities are acritical part of the Entity Relationship Diagram. When these relationships areimplemented in the database, they provide the links among the various tablesthat give the database its flexibility.
To maximize the flexibility of adatabase, relationships must be properly identified and modeled.Many relationships are relatively easy to recognize, such as thosebetween ORDERS and CUSTOMERS, ORDER and CUSTOMER are related, as are ORDER and PRODUCT. However, weknow that there may not necessarily be a relationship between PRODUCT andCUSTOMER. Because both are related to ORDER we can report which products areordered by a particular customer.5. Determine Cardinalities: There are both maximum and minimumcardinalities. ONE TO ONEONE TO MANYMANY TO MANYEXACTLY ONEONR OR MOREZERO OR ONEZERO OR MORE There are two relationships, onebetween PRODUCT and ORDER, and the other between ORDER and CUSTOMER.
a. Each customer can place: min =0, max = many ordersb. Each order can be placed by: min one max one customersc. Each order can list: min one max many productsd.
Each product can be listed on: min zero max many orders 6. Checkthe Model: The final step in creating an E-Rdiagram is often overlooked, but is just as important as any of the previoussteps. Analysts who fail to carefully check their ERD often produce diagrams ofpoor quality, which of course should be avoided.In order to check the ERD, you mustreturn to your original information sources, the forms, reports, and interviewswith users. The basic idea is to go back to the original documents and makesure that the structure represented in the ERD can satisfy the requirements.