DBMS ASSIGNMENT SUBMITTED TO: Mrs. GOONJAN JAIN SUBMITTED BY : PANKAJ JAISWAL ( 2K15/MC/050) ENTITYRELATIONSHIP MODELAn ER-model is also called an ER-diagram. It describes thegraphical representation of 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_ID, ORDER_DATE, ORDER_AMOUNT CUSTOMER CUSTOMER_ID, CUSTOMER_NAME, CUSTOMER_ADDRESS, NUMBER PRODUCT PRODUCT_ID, DESCRIPTION, PRODUCT_PRICE, PRODUCT_QUANTITY However, in general all cases are notso simple and clear. For example, take ADDRESS, maybe a number of attributes forthis candidate entity were identified, like HOUSE_NO, STREET_NO, STATE, ZIP_CODE, COUNTRY.
Does it indicate that ADDRESS is an entity? however, all of theseshould be the attributes of CUSTOMER entity. 3. Choose Primary Keys: Primary keys mustbe chosen for each entity after identifying and modeling each entity and itsattributes.
Primary Key should have following properties 1. Entity should be uniquely identified. 2. Not null (it should always has a value) 3. Data less needed 4. Never changes it value and properties Properties of a Good Primary Key 4.
Identify the Relationships: Relationships among entities areimportant part of the ER (model)Diagram. They provide the joints among thedifferent tables that give the database its flexibility, when theserelationships are used in the database. To increase the flexibility of thedatabase, relationships must be properly recognized and modeled. Most of the relationships are simple and easy to identified, there isrelationship between ORDERS and CUSTOMERS, ORDER and PRODUCTS. It is visible that there maynot be a relationship between PRODUCT and CUSTOMER but both are related toORDER.
we can find which products are ordered by a particular customer. 5. DetermineCardinalities: There are both maximum and minimumcardinalities. ONE TO ONEONE TO MANYMANY TO MANYEXACTLY ONE ONR OR MOREZERO OR ONE ZERO OR MORE There are two relationships, onebetween PRODUCT and CUSTOMER, and the other between ORDER and PRODUCT. Each customer can place minimum – 0, maximum – many ordersEach order can be placed by: minimum – 1 maximum – one customersEach order can list: minimum – 1 maximum – many productsEach product can be listed on: minimum – 0 maximum – many orders 6. ModelChecking: 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.