At the end of the chapter, we’ll look at how we can use the open source
MySQL Workbench tool to automatically convert the conceptual design to a MySQL database schema.
The Entity Relationship ModelAt
a basic level, databases store information about distinct objects, or
entities, and the associations, or
relationships, between these entities. For example, a university database might store
information about students, courses, and enrollment. A student and a course are entities, while an enrollment is a relationship between a student and a course.
Similarly, an inventory and sales database might store information about products,
customers, and sales. A product
and a customer are entities, while a sale is a relationship between a customer and a product.
A popular approach to conceptual design uses the
Entity Relationship (ER) model,
which helps transform the requirements into a formal description of the entities and relationships that appear in the database. We’ll start
by looking at how the EntityRelationship modeling process itself works, then apply it in Entity Relationship Modeling Examples for three sample databases.
Representing EntitiesTo
help visualize the design, the Entity Relationship Modeling approach involves drawing an Entity Relationship (ER) diagram. In the ER diagram, an
entity set is represented by a rectangle containing the entity name. For our sales database example, the product and customer entity sets would be shown as in Figure 4-1. We typically use the database to
store certain characteristics, or
attributes, of the entities. Ina sales database, we could store the name,
email address, postal address, and telephone number for each customer. Ina more elaborate customer relationship man- agment (CRM) application, we could also store the names of the customer’s
spouse and children, the languages the customer speaks, the customer’s history of interaction with our company, and soon. Attributes describe the entity they belong to.
Customer
Product
Figure 4-1. An entity set is represented by a named rectangleShare with your friends: