Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

Multiplicity of Relationships

Читайте также:
  1. Attitudes and relationships
  2. BOOK 3. Unit 7. Topic 1. Describe your circle of friends. Tell about your relationships with friends.
  3. Describe tribal relationships in modern kazakh society.
  4. FACT 1: ABOUT MEN, WOMEN, AND RELATIONSHIPS
  5. Figure-ground relationships
  6. Friendships and other positive relationships
  7. Logical relationships

Lecture 4. Entity-Relationship (ER) Modeling

 

Basic ER Modeling Concepts

Entity-relationship (E/R) model is a data model:

· Historically very popular

· Primarily a design model—not implemented by any major DBMS

 

Diagrams to represent designs:

· Entity: a “thing”, like a record or an object. Entity – a class of real world objects having common characteristics and properties aboutwhich we wish to record information.

· Entity set: a collection of similar things, like a set of records or a class

~ represented as a rectangle

· Relationship: an association among two or more entities

Relationship - an association among two or more entities

* occurrence - instance of a relationship is the collective instances of the related entities

* degree - number of entities associated in the relationship (binary, ternary, other n-ary)

* connectivity - one-to-one, one-to-many, many-to-many

* existence dependency (constraint) - optional/mandatory

· Relationship set: a set of relationships of the same type; an association among two or more entity sets

~ represented as a diamond

· Attributes: properties of entities or relationships, like record fields

~ represented as ovals

Attribute - a characteristic of an entity or relationship

* Identifier - uniquely determines an instance of an entity

* Identity dependence - when a portion of an identifier is inherited from another entity

* Multi-valued - same attribute having many values for one entity

* Surrogate - system created and controlled unique key (e.g. Oracle’s “create sequence”)

Example: students take courses

Keys of Entity Sets

A key is a set of attributes whose values can belong to at most one entity in an entity set—like an entity “ID”. Each entity set must have a key ~ represented by underlining all attributes in the key

 

Example: SID is a key of Students; dept, number is a key of Courses

· An entity set may have multiple candidate keys (e.g., SSN is also a key of Students); just pick one key

· A key may include multiple attributes (e.g., dept, number is a key of Courses)

Attributes on Relationships

Example: students take courses and receive grades

Key attributes identify entities; what identify relationships?

· In a relationship set, each relationship is uniquely identified by the entities it connects

~ There can be at most one Take relationship between Bart and CS145

~ But there could be another TA relationship between Bart and CS145

Tricky: what if Bart took CS145 twice and got different grades?

 

Multiplicity of Relationships

· Many-many: each entity in E is related to 0 or more entities in F and vice-versa (e.g., Students-Courses)

· Many-one: each entity in E is related to 0 or 1 entity in F, but each entity in F is related to 0 or more in E (e.g., Courses-Instructors)

· One-one: each entity in E is related to 0 or 1 entity in F and vice-versa (e.g., Students-OracleAccounts)

· “One” is represented by an arrow

· “Exactly one” is represented by a rounded arrow


Дата добавления: 2015-11-16; просмотров: 62 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
Objectives of Database Management| There Was No Paper Money in the Elizabethan Era

mybiblioteka.su - 2015-2024 год. (0.006 сек.)