A supermarket chain is interested in building a decision support system with which they can analyze the sales of different products in different supermarkets at different times. Each supermarket is in a city, which is in a state, which is in a region. Time can be measured in days, months, quarters, and years. Products have names and categories (produce, canned goods, etc.). Design an E-R diagram for this application.
Expert Answer
An Entity Relationship Diagram (ERD) is a visual representation of a applications in which it is shown how different components of an application are connected to each other.It is a type of flowchart which gives us overall understanding of an application. It is mostly used to design the relational databases as they contain proper row column format and have proper connections with each other via key.
Following image contains the ER diagram of the above case
- Rectangle in diagram means Entity
- Oval means Attributes
- Rhombus means realationship between entities.
Region contains HAS/PRESENT relationship with product because in a particular region->state->city-> a product can be presennt or not.
Product contains SOLD relationship with Time because at a particular time either it is year,quarter,month or days we can calculate how many products sold.