Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Modeling Man is a knot, a web, a mesh into which relationships are tied. Only those relationships matter Saint-Exupéry.

Similar presentations


Presentation on theme: "Data Modeling Man is a knot, a web, a mesh into which relationships are tied. Only those relationships matter Saint-Exupéry."— Presentation transcript:

1 Data Modeling Man is a knot, a web, a mesh into which relationships are tied. Only those relationships matter Saint-Exupéry

2 Data modeling A technique for modeling data
A graphical representation of a database The goal is to identify the facts to be stored in the database Data modeling is a partnership between the client and analyst

3 The building blocks Entity Attribute Identifier Relationship

4 Data model quality A well-formed data model A high fidelity image

5 A well-formed data model
No ambiguity All entities, attributes, relationships, and identifiers are defined Some relationships are labeled to avoid confusion All relationships are represented using the correct notation Names are meaningful to the client

6 A high fidelity image Faithfully describes the world it is supposed to represent The data model makes sense to the client

7 Quality improvement Is the level of detail correct?
Are all exceptions handled? Is the model accurate?

8 Pure geography Storing details of the world’s cities
Can a city be the capital of more than one state? Can a nation have more than one capital? What do the one-to-one lines represent? Can a state have more than one capital?

9 http://geology. com/world/bolivia-satellite-image
(La Paz is administrative and Sucre is constitutional) Google: chandigarh india

10 Geography revised

11 Can we reduce the redundancy of the man and woman entities?
Family matters - take 1 Can we reduce the redundancy of the man and woman entities?

12 Family matters - take 2 A person can have only one spouse and a spouse can be married to only one person. But, is this true?

13 Family matters - take 3 What about couples who don’t officially get married but are considered to be married by the law?

14 What about the children?
Family matters - take 4 What about the children?

15 Family matters - take 5

16 Why don’t we use book copy as an attribute of book?
Bookish matters - take 1 Why don’t we use book copy as an attribute of book?

17 This model records only the current borrower of a copy of a book
Bookish matters - take 2 + This model records only the current borrower of a copy of a book

18 Exercise A plane is leased to an airline for a specific time period. When a lease expires, the plane can be leased to another airline. So, a plane can be leased many times, and an airlines can lease many planes. Furthermore, there is an agent responsible for handling each deal. An agent can lease many planes and deal with many airlines. Over time, an airline will deal with many agents. When an agent reaches a deal with an airline to lease a particular plane, you have a transaction. Create the data model with MySQL workbench.

19 A ménage à trois for entities - take 1
But where do we store information about the lease?

20 Cardinality Some data modeling languages are quite precise in specifying the cardinality, or multiplicity, of a relationship

21 Minimalist approach Focus has been on identifying the basic cardinality (1:m or m:m?) Now add greater precision There must be 1 instance Learn the basics and then add more detail

22 Modality Also known as optionality
Does an occurrence of this entity require an occurrence of the other entity?

23 Modality It is mandatory for an instance of stock to have an instance of nation, but it is optional for an instance of nation to have an instance of stock, which means we can record details of a nation for which we do not have stocks

24 Cardinality and Modality
Meaning 0,1 Optional There can be zero or one instances of the entity relative to the other entity 0,n There can be zero or many instances of the entity relative to the other entity 1,1 Mandatory There is exactly one instance of the entity relative to the other entity 1,n The entity must have at least one and can have many instances relative to the other entity

25 Modality and Cardinality
Mandatory Optional 0,n 1,n

26 Entity types Independent Dependent Associative Aggregate Subordinate

27 Independent Often a starting point Prominent in the client's mind
Often related to other independent entities

28 Dependent Relies on another entity for its existence and identification Can become independent if given an arbitrary identifier

29 Associative A by-product of an m:m relationship
Typically between independent entities Can store current or historical data Can become independent if given an arbitrary identifier

30 Aggregate Created from several different entities that have a common prefix or suffix Commonly used with addresses or names

31 Subordinate An entity with data that can vary among instances

32 Hints on data modeling The model will expand and contract
Invent identifiers where necessary Identifiers should have only one purpose – identification A data model does not imply ordering Create an attribute if ordering of instances is required An attribute’s meaning must be consistent

33 Names and addresses The query test
If an attribute has parts, are any of the parts ever likely to appear in a query? Have an understanding on representing names and addresses in a data model

34 Hints on data modeling Single instance entities are OK
Can you think of an example? Select names carefully Synonyms—different words have the same meaning Get clients to settle on a common word or use views Homonyms—same word has different meanings Clarify to avoid confusion Naming associative entities Concatenate entity names if there is no obvious real world name

35 Hints on data modeling Uncover all exceptions
Label relationships to avoid ambiguity Keep the data model well-formed and accurate

36 Meaningful identifiers
An identifier is meaningful when some attributes of the entity can be inferred from the identifier’s value Advantages Disadvantages Recognizable and rememberable Identifier exhaustion Administrative simplicity Reality changes Loss of meaningfulness

37 Recommendation Nothing, however, is lost and much is gained by using non-meaningful identifiers Non-meaningful identifiers serve their sole purpose well To uniquely identify an entity Attributes are used to describe the characteristics of the entity A clear distinction between the role of identifiers and attributes creates fewer data management problems

38 The seven habits of highly effective data modelers
Immerse Challenge Generalize Test Limit Integrate Complete

39 Key points A high-fidelity data model handles all exceptions
Identifiers need identify only an instance Data modeling skills take time to develop


Download ppt "Data Modeling Man is a knot, a web, a mesh into which relationships are tied. Only those relationships matter Saint-Exupéry."

Similar presentations


Ads by Google