18
Review concepts of design relationships. Learn more about relationships. Heuristics of a good ERD. Demonstrate MS Visio. Practice creating more ERD’s (if time…) 1 Agenda: 02/06/2014

Review concepts of design relationships. Learn more about relationships. Heuristics of a good ERD. Demonstrate MS Visio. Practice creating more

Embed Size (px)

Citation preview

Page 1: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

1

Review concepts of design relationships.

Learn more about relationships.

Heuristics of a good ERD.

Demonstrate MS Visio.

Practice creating more ERD’s (if time…)

Agenda: 02/06/2014

Page 2: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

2

We are purposely dividing data into entities to have less data redundancy.

Entities do not usually exist in isolation.

Entities are related because the data are related.

A relationship is a business association between two or more entities.

A relationship is a business rule.

An ERD is a simple modeling tool – it is not possible to depict every “real life” relationship with an ERD.

Relationship review

Page 3: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Example: Binary M:N Relationship

Page 4: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Example: 1:M Binary Relationships with Intersection Entity

Page 5: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Example: 1:M Binary Relationships with Intersection Entity

Depicts a Ternary Relationship

Page 6: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Example: 1:1 Binary Relationship

Page 7: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Example: 1:M Unary Relationship

Page 8: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Examples of Unary Relationships

Page 9: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

A many-to-many (M:N) unary relationship must also be

intersected

Page 10: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

10

Generalization is the concept that some entities are very similar and have some attributes in common, but other attributes that are distinct.

An entity “supertype” contains those attributes that are in common.

An entity “subtype” contains those attributes that are distinct. An entity “subtype” adds other attributes to those inherited from the supertype.

Generalization allows an analyst to understand more fully the relationships between entities.

Another type of relationship: Generalization (Enhanced ERD)

Page 11: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Let’s go back to the consulting ERD…

Page 12: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Depict the generalization hierarchy

Page 13: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Generalization constraints Constraints are limitations depicted on a data

model.

The most common types of constraints are:

Completeness. Addresses the question of whether an instance of a supertype must also be a member of at least one subtype. Result is either required or not required. Indicated by a double line in Visio.

Disjointness. Addresses the question of whether an instance of a supertype may simultaneously be a member of two or more subtypes. Result is specified as disjoint or overlap. Indicated with either an “o” or a “d”.

13

Page 14: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

14

Avoid redundant data that is composed of long alphanumeric data types.

Examples are names, addresses, comments, notes.

Standardize any “descriptive” attributes such as categories or types.

Put sample data in a few rows of each entity so that you can determine whether or not the data will be redundant.

If you don’t know what data will be stored, ask your client.

Heuristics: Redundant Data

Page 15: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

Heuristics: Relationships

Do not include M:N relationships.

M:N relationships always produce data redundancy.

Divide M:N relationships with an intersection entity that will create at least two 1:M relationships.

A single intersection entity can be used to intersect more than two strong entities.

In a 1:M relationship, the foreign key is placed in the entity on the “many” side of the relationship.

15

Page 16: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

16

Examine all 1:1 relationships. Determine whether the attributes could all be placed in just one of the two entities eliminating the need for the relationship.

In a 1:1 relationship, the foreign key can be placed in either entity. Put the foreign key in the entity that seems most “reasonable” and also will result in the fewest number of null values.

Heuristics for 1:1 Relationships

Page 17: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

17

A “natural” primary key is composed of attributes that are already part of the application specification.

A “surrogate” primary key is created by the database designer for the explicit purpose of being a primary key.

A surrogate primary key should NEVER be concatenated.

For logical database design, try and find a natural primary key.

Heuristics: Primary Key

Page 18: Review concepts of design relationships.  Learn more about relationships.  Heuristics of a good ERD.  Demonstrate MS Visio.  Practice creating more

18

Never add more attributes than are absolutely necessary to create a primary key value unique.

Use the primary key of the related strong entity as part of the primary key for the associative entity, if the relationship with the associative entity is mandatory.

Use the primary keys of the strong entities as part or all of the primary key for the related intersection entity.

Heuristics: More Primary Key