The Computer Revolution/Databases/Entities and Entity Relationships

From Wikibooks, open books for an open world
< The Computer Revolution
Jump to: navigation, search

An entity is something of importance to a business or organization. When the entity is something an organization or business wants to store, it becomes a database table. There are three different relationships between entities. The first is one-to-one entity relationships. This exists when one entity is related to only one other entity of a particular type. For example, a business has multiple stores, each store location has a single manager, the relationship between store and manager is 1:1. The second relationship is one-to-many entity relationship. These are the most common relationships and exist when one entity can be related to more than one other entity. For example, if a supplier supplies more than one product to the company, the relationship between the supplier and the products is O:M. The last relationship is many-to-many entity relationship. This relationship exists when one entity can be related to multiple entities of the same type of the original entity. For example, if an order can contain multiple products and one product can appear on many orders, the relationship between orders and products is M:M.