Tutorial 2 Pre-excercise
1. Drawing ERD for sample situation
A manufacturing company produces products. The following product information
is stored: product name, product ID and quantity on hand. These products are made
up of many components. Each component can be supplied by one or more
suppliers. The following component information is kept: component ID, name,
description, suppliers who supply them, and products in which they are used.
Supplier information includes id, name of supplier
Assumption
A supplier can exist without providing components.
A component does not have to be associated with a product. Not all
components are used in products.
A product cannot exist without components.
Create an ERD to show how you would track this information.
Show entity names, primary keys, attributes for each entity, relationships between
the entities and cardinality.
Step by step identification
Step 1: Identify entity in the context
A manufacturing company produces products. The following product information
is stored: product name, product ID and quantity on hand. These products are made
up of many components. Each component can be supplied by one or more
suppliers. The following component information is kept: component ID, name,
description, suppliers who supply them, and products in which they are used.
Step 2: Identify relationship between entities based on assumptions
These products are made up of many components 1 Products ~ M components
A component does not have to be associated with a product. Not all components are
used in products 0 Products ~ 1 component
A product cannot exist without components 1 Product ~ at least 1 components
(1 – 1..M)
Assumption -> Components can be used in many products M products ~ 1
components
Products M:M components
Similarly. Components M:M supplier
Step 3: Identify attributes on each entity
Bold italic means that attribute is in consideration. Bold means attributes are
surely in that entity.
The following product information is stored: product name, product ID and
quantity on hand
The following component information is kept: component ID, name, description,
suppliers who supply them, and products in which they are used
Supplier information includes id, name of supplier
Suppliers and products doesn’t belongs to entity itself, since we define M-M
relationship on Product and components && components/supplier => supplier
belongs to middle table, between component and supplier and product belongs to
middle table between component and Product enough to define which
component belongs to which supplier and product respectively.
Step 4: Build ER diagram based on exercise title