110 likes | 234 Vues
This presentation delves into the fundamental aspects of database relationships including maximum cardinality types (one-to-one, one-to-many, and many-to-many) and the degree of relationships (unary, binary, and ternary). It serves as an intermediate guide, assuming familiarity with key terms such as entity, attribute, and identifier. Practical examples illustrate how to interpret relationships in a database model, emphasizing implications for database structure and design. Discover the critical role these relationships play in organizing data efficiently.
E N D
Database Fundamentals The Data Model: More About Relationships Microsoft Enterprise Consortium: http://enterprise.waltoncollege.uark.edu Microsoft Faculty Connection/Faculty Resource Center http://www.facultyresourcecenter.com
Things you should know … • This presentation assumes you are already familiar with these terms: • Entity and entity type • Entity instance • Attribute • Identifier • Multivalued • Cardinality
Relationships and cardinality • What do the relationships symbols really mean to us? Here are a few examples of how to read the minimum and maximum symbols. • A customer can have a minimum of zero orders. • A customer can have a maximum of many orders. • An order is for a minimum of one customer. • An order is for a maximum of one customer. CUSTOMER ORDER LOCATION EMPLOYEE
Relationships • Based on maximum cardinality, a relationship falls into one of three types: • one-to-many • many-to-many • one-to-one one-to-many many-to-many CUSTOMER ORDER INVENTORY one-to-one LOCATION EMPLOYEE
Maximum Cardinality • Keep in mind that the 3 relationship types (1-to-1, 1-to-many, and many-to-many) describe the maximum cardinality at both ends of a relationship. • It’s incorrect to read the minimum and maximum cardinality as “one-to-many”, for instance. This is NOT one-to-many This is many-to-many. ORDER INVENTORY This is NOT one-to-one This is one-to-many. CUSTOMER ORDER
Degree of the relationship - Unary • The degree of the relationship refers to the number of entities in a single relationship. • The options are: unary, binary, ternary. • A unary relationship means a entity is related to itself. There is only one entity. Supervises Any one employee—Casey Wilson, for example—may be supervised by a minimum of zero employees. Any one employee—Casey Wilson, for example—may be supervised by a maximum of one employee. Any one employee—Carla Stevens, for example—may supervise a minimum of zero employees. Any one employee—Carla Stevens, for example—may supervise a maximum of many employees. EMPLOYEE Supervised by
Degree of the relationship - Binary • A binary relationship means two entities are directly related. This is by far the most common one you see in a data model. Any one order—order ID # 4528, for example—may have a minimum of one inventory items in the order. Any one order—order ID # 4528, for example—may have a maximum of many inventory items in the order. Any one inventory item—Day-Glow Toothpaste, for example—may be sold in a minimum of zero orders. Any one inventory item—Day-Glow Toothpaste, for example—may be sold in a maximum of many orders. sold in ORDER INVENTORY has
Degree of the relationship - Ternary • A ternary relationship means three entities are directly related. However, this three-way relationship between three entities can be decomposed into binary relationships. Therefore, we won’t spend more time on this term.
We’ve learned more about relationships • In this presentation we’ve seen that a relationship is one-to-one or one-to-many or many-to-many. This information has important implications for how the database is actually built. • We’ve also seen what the “degree of the relationship” means. How many entities are involved in a direct relationship: unary (1 entity), binary (2 entity), or ternary (3 entity)?
Resources • Microsoft Enterprise Consortium: http://enterprise.waltoncollege.uark.edu/mec.asp • The consortium provides teaching material and large databases donated by some major corporations. • Microsoft Faculty Connection—Faculty Resource Center http://www.facultyresourcecenter.com/ • A wide range of teaching resources are available.