mysql workbench crows foot_Crow’s Foot Notation

http://www2.cs.uregina.ca/~bernatja/crowsfoot.html

Crow’s Foot Notation

A number of data modeling techniques are being used today. One of the most common is the entity relationship diagram (ERD). Several ERD notations are available. For the purposes of CS270 we will be using Crow’s Foot Notation[b1].

Components used in the creation of an ERD:

Entity – A person, place or thing about which we want to collect and store multiple instances of data. It has a name, which is a noun, and attributes which describe the data we are interested in storing. It also has an identifier, which uniquely identifies one instance of an entity. The attribute which acts as the identifier is marked with an asterisk.

Relationship – Illustrates an association between two entities. It has a name which is a verb. It also has cardinality and modality.

Cardinality and Modality are the indicators of the business rules around a relationship. Cardinality refers to the maximum number of times an instance in one entity can be associated with instances in the related entity. Modality refers to the minimum number of times an instance in one entity can be associated with an instance in the related entity.

Cardinalitycan be 1 or Many and the symbol is placed on the outside ends of the relationship line, closest to the entity, Modality can be 1 or 0 and the symbol is placed on the inside, next to the cardinality symbol. For a cardinality of 1 a straight line is drawn. For a cardinality of Many a foot with three toes is drawn. For a modality of 1 a straight line is drawn. For a modality of 0 a circle is drawn.

zero or more [b4]

1 or more [b5]

1 and only 1 (exactly 1) [b6]

zero or 1 [b7]

Cardinality and modality are indicated at both ends of the relationship line. Once this has been done, the relationships are read as being 1 to 1 (1:1), 1 to many (1:M), or many to many (M:M).

1:1

1:M

M:M

1:M

Typically, ERDs are much more complex than this, involving quite a number of entities and relationships. If we join all of the above relationships together and add a few attributes, a small collection of data might be depicted in the following way using Crow’s Foot Notation:

Consider the following business rules for a patient appointment system:

A doctor can be scheduled for many appointments, but may not have any scheduled at all. Each appointment is scheduled with exactly 1 doctor. A patient can schedule 1 or more appointments. One appointment is scheduled with exactly 1 patient. An appointment must generate exactly 1 bill, a bill is generated by only 1 appointment. One payment is applied to exactly 1 bill, and 1 bill can be paid off over time by several payments. A bill can be outstanding, having nothing yet paid on it at all. One patient can make many payments, but a single payment is made by only 1 patient. Some patients are insured by an insurance company. If they are insured, they can only carry insurance with one company. An insurance compnay can have many patients carry their policies. For patients that carry insurance, the insurance company will make payments, each single payment is made by exactly 1 insurance company.

Given the above information, the following ERD can be drawn:

Intersection Entities

Intersection entities are used in the resolution of a many to many relationship. This resolution is done in order to store additional information which doesn’t fit into the attribute list of either entity in the M:M relationship. For instance, in the instructor-course example given earlier, there is a M:M relationship between Course and Section. A course can have many sections, and a section can have many courses. If we want to know how many students are registered in a particular class, we cannot store the information on either entity. We could store the total number of students registered in all sections of a particular course, in the course entity, ie: 300 students are registered in CS270, all sections included. We could store the total number of students registered in all courses with a particular section number, in the section entity, ie: 25,000 students are registered in a section numbered 002. If we want more practical information, such as how many students are registered in section 002 of CS270, we need another entity in which to store the information. So, we create an intersection entity, and place it between its related entities with the additional attributes. The M:M relationship becomes two 1:M relationships. See resolution below.

Independent Entities

Independent entities are those which can exist without another entity. Student, seat, instructor etc. are examples of independent entities.

Dependent Entities

Dependent entities rely upon the existence of other entities. Some of their attributes are taken from the identifiers in the entities upon which they depend. Class is an example of a dependent entity. It relies upon course and section, and gets two of its attributes from their identifiers.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值