You are on page 1of 15

Data modelling using ERD with Crow Foot Notation - CodeProject Page 1 of 15

12,823,663 members (58,494 online) Sign in

crows foot ERD

articles quick answers discussions community help

Articles Development Lifecycle Design and Architecture Data Structures

Data modelling using ERD with Crow Foot Notation


John C Rayan, 20 Feb 2015 CPOL Rate this:
4.82 (11 votes)

Architecting Data Structures

Introduction
In this article I am going to show you architecting data structures using the data modelling technique Entity Relationship Diagram
with Crow Foot Notation.

Background
There are many techniques are in use among data architects for designing data models, such as Entity Relationship Diagram (ERD)
and Data Matrix etc. This article however will be demonstrating only the most widely used technique, which is ERD. In ERD, there is
a wide range of notations used by data architects for denoting the relationship and cardinality between the data entities. Some of
such notations are OMT, IDEF, Bachman, Chen, Martin, UML and Crow Foo , however this article is intended for demonstrating Crow
Foot Notation only.

Relationship and Cardinality/Multiplicity


The understanding of relationship and cardinality/multiplicity between entities are vital in modelling a database system. When it
comes to relationship between entities, one of the following three relationships can exist between two entities.

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 2 of 15

Hide Copy Code


One to One

One to Many

Many to Many

Let me explain them with some examples.

A car needs a tax disc (One to One),


A car has four wheels (One to Many)
A car can carry more than one person (One to Many)
A driver is allowed to drive more than one car and a car can be driven by more than one driver (Many to Many).

One must understand the possible cardinality a table/entity can take in a relationship too . A cardinality is the number of rows a
table can have in the relationship. As you may have noticed that I have used the terms table and entity interchangably, and the
reason for that is an enitity eventually becomes a table in the database. we will see how in detail in the coming sections.

Hide Copy Code


The possible cardinalities are

One and Only One

One or Many

Zero or One or Many

Zero or One

In the relationships that we have mentioned the relationship section, when we say a car can carry more than one person then we
know that a minimum of one person the car will carry, which is the driver. Also it can carry many upto 5 or 7 or more depends on
the vehicle. So we can now add further constraints - One to (One or Many). The one or many is called the cardinality/multipilicy in
a relationship.

Let us see some more examples.

A car can have one and only tax disc One to (One and Only One)

A driver can drive more than one vehicle but at the same time he doesnt need to own a car and can use public transport. In this
instance the driver drives zero vehicles One to (Zero or One or Many).

A car can be declared off the road and doesnt require a tax disc. In this instance, a car doesn't have a tax disc - One to (Zero or
One).

A car owner or the owners spouse or any comprehensive licence holder can drive the owners car (Many to One). Again, the car
can be declared off road and no one can drive it (Zero or One or Many) to One

You get the idea!

Crow Foot Notation Symbols


Now let us take a look at the crow foot notation symbols and understand their meaning before dive in to datamodelling.

To illustrate the above relationship and cardinality of the entities in an ERD, the Crow Foot Notation Symbols are used with
cardinality. The Crow Foots symbols and its meaning are given below. The symbols given in the parenthesis are used in UML.

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 3 of 15

I am sure that it is self-explanatory and does not require further explanation. However if you have any questions please do not
hesitate to contact me by using the comments at the bottom of this article and I am more than happy to help you.

Data Models
There are three levels of data model involved in the data modelling process. The conceptual and logical levels of data model may
undergo as many iterations as it can go until all entities and relationships are identified, finalised and agreed with all stakeholders.
Then the final level of physical model is developed to create the database.

Hide Copy Code


Now lets take a look at the three levels of models

1. Conceptual Model

2. Logical Model

3. Physical Model

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 4 of 15

To demonstrate these three data models, I am going to use short version of an Online Motor Insurance Quote System. The above
three levels of a data model are executed in the same order as they are given.

Note: Please note that this model is not by any means a complete online motor quote system and for simplicity I have
ignored many data elements from the system like Payments and many others.

Conceptual Model
In this level, entities and its relationships are identified by engaging all the stakeholders involved in the project. When the
requirement is ready, then the data architect creates the conceptual model by having discussions with business analysts, product
owners and other stake holders. The conceptual model is an abstract form of logical model and it shows all entities at high level
without worrying about the detailedl structure such as attributes (columns) and its types.

The following entities and relationships are identified for our Online Motor Insurance Quote System.

Entities

User

Quote

Vehicle

Driver

Claim

Conviction

Policy

MTA

Endorsement

Document

Relationships & Cardinalities

A User can have zero or one or many quotes. - One to (Zero or One or Many)

A Quote can have only one vehicle (Multiple vehicles on a single policy are not supported by the insurers panel) One to (One and
Only One)

A Quote can have one or many Drivers. (One to (One or Many)

A Driver can have zero or one or many claims. - One to (Zero or One or Many)

A Driver can have zero or one or many convictions. - One to (Zero or One or Many)

A Quote can have zero or only one policy. - One to (Zero or One)

A Policy can have zero or one or many endorsements. - One to (Zero or One or Many)

A Policy can have zero or one or many MTA. One to (Zero or One or Many)

A document can be part of one or many policies and a policy can have one or many documents. (One or Many) to (One or Many)

Until the conceptual model is agreed and signed off by the functional team, this process goes through many iterations. The
conceptual model for the above requirement is shown below.

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 5 of 15

Things to note:

Dotted Lines means - Weak (Non-Identifying) Relationship:


Entity's existence is independent of other entities
Primary Key of child entity doesnt contain Primary Key of parent entity

Solid Lines means - Strong (Identifying) Relationship:


Child entity's existence is dependent on parent

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 6 of 15

Primary Key of child entity contains Primary Key of parent entity

Logical Model
Once the conceptual model is accepted and signed off by the functional team, then the logical model helps to define the detailed
structure of the entities and its relationships. The logical model forms the basis for the physical model. It is a very important level
because this model clearly represents the business requirement and data structures that are required for the system.

By taking the findings from the conceptual model, the detailed structure of each entity is designed in the logical model. The
attributes of the entities and its types are identified in this level however the types are platform independent. The actual table name
and column names are not necessarily matching the entity name and attributes in the logical model.

For brevity I have not included all attributes but in the real world you will expect far more attributes. The reason being, this is to
convey the concept of datamodelling and not providing a full fledged system as such.

The following diagram is the logical model for the relationships between entities for our system.

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 7 of 15

As you can see in the above diagram the implementation of Many-to-Many relationship (highlighted in red circle) between Policy
and Document is not implemented and left to do at the level of physical model. At this logical level, it just shows the logical
relationship but not the physical implementation.
Hide Copy Code
The logical model defines the attributes (columns) and its types (data types) for each entity but
it is still platform independent.It means by taking a logical model, one can implement in any
database of their choice such as Oracle or SQL Server.

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 8 of 15

Physical Model
The physical data model visually represents the actual database schema and it is platform specific. It means that the physical model
can be implemented into the database which the model was designed for. For example, if a physical model is designed for SQL
Server then it cannot be implemented into ORACLE simply because the data structures are database specific and its columnss' data
types will work working only on the targeted DB.

For example, in our example the column types are generated targeting SQL SERVER (First diagram below) database. It means that
the physical model need to be modified for other databases like Oracle (Second diagram below). The reason for that is the data
type VARCHAR in SQL SERVER physical model cannot be used in ORACLE as the data type is invalid.

This means that the physical model is the actual representation of the database model and one can create the actual database
schema straight from the physical model and run into the DBMS directly by using a right tool. There are many tools out there to do
the job.

Also the Many-to-Many relationship between Policy and Document has been implemented in the physical model by introducing a link
table PolicyDocument. Remember that Many-to-Many relationship cannot be implemented without a link table for any two entities.

The table name, column names and the column data types for the target database are finalised in the physical model as shown
below. The red circle is just to highlight that the actual implementation of Many-to-Many relationshp has taken place in the
physical model and nothing more than that.

I have generated two physical models from the same logical model wihout much work using a tool. The first one is for SQL SERVER
and the second one for ORACLE.

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 9 of 15

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 10 of 15

We can also generate the SQL scripts for the targeted database from the tool but that is beyond scope of this article. Hope you find
this article useful and I am more than happy to answer if you have any questions.

Please do not forget to vote for me if you find it useful. Thank you!

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 11 of 15

License
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share
EMAIL TWITTER

About the Author


John C Rayan

Engineer
United Kingdom

Areas of Expertise:

.NET, JAVA , SQL Server, Oracle, XML , SOA and WEB solutions.

* Microsoft certified in C# Programming.


* Microsoft certified Techology Specialist (ASP.NET)
* IBM certified in XML technology
* Sun certified Java Programmer
* Sun certified Web solution developer

You may also be interested in...


Pro How to choose a database for Pro NoSQL Database Evaluation
your mobile apps Guide

ASP.NET MVC Model Binding Intel Advisor Review


and Data Annotation

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 12 of 15

Ontology, Notation 3, and 10 Ways to Boost COBOL


SPARQL Application Development

Comments and Discussions

You must Sign In to use this message board.

Search Comments

Spacing Relaxed Layout Open All Per page 25 Update

First Prev Next

Seems same concepts you gave different ximanking 4-Feb-17 11:29


explanations

In book Database Systems - Design, Implementation, and Management (9th Edition) by Carlos, at conceptual model stage,
the attributes & type are added in. logical model means that conceptual model are loaded into specific DBMS. Physical
model refers to the storage on media such as disc.

In your article, the 3 models are with different meaning. Strange!

Sign In ViewThread Permalink

Re: Seems same concepts you gave different John C Rayan 6-Feb-17 23:42
explanations

Thank you for your email.

I have not read the book so I cannot comment on the book. I am not sure how you understood the physical model
from the author when he mentioned Disk.(Physical database like SQL server . Oracle) However , I would like to bring to
your attention to the following lines in my article about the attributes.

"By taking the findings from the conceptual model, the detailed structure of each entity is designed in the logical
model. The attributes of the entities and its types are identified in this level however the types are platform
independent. The actual table name and column names are not necessarily matching the entity name and attributes in
the log"

The attributes are added in logical model but not necessarily their properties (like type) are determined to a particular
database.

For you information , if you google you will find enough information. Some are below.

[^]

What are Conceptual, Logical and Physical Data Models? | InfoAdvisors Blog[^]

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 13 of 15

Hope this helps

Sign In ViewThread Permalink

Recursive relationship Member 12972265 28-Jan-17 21:57

Is this valid in Crow's notation?

Sign In ViewThread Permalink

Re: Recursive relationship John C Rayan 31-Jan-17 6:52

It is valid but there is no separate notation for this. You can achieve this by using one-and-onlyone and one-to-
many relation for example A supervisor (employee) supervises many employees.

Sign In ViewThread Permalink

Re:Question Member 12205433 13-Dec-15 22:06

Take a simple example:


A Flying Car capable of going on the road...

Consider the relationship between a car and tyres.


the cardinality for car is one car can have four tyres or it should not have any tyre at all...
The Cardinality must be Zero OR Many.... Is there a notation to denote that relationship?

if i use the third notation you've mentioned in the article, it uses Zero OR one OR Many... That might give the developer a
misunderstanding that the car might work with a single tyre...

Sign In ViewThread Permalink

Re:Question John C Rayan 13-Dec-15 23:32

Hi

Third one is for zero or Many. (0..*) means zero or many.

But to make it more understanding to readers, I have included one in between to emphasis that not just many but you
could have just one too. 1 included in the many as well.

Therefore (0..*) means zero or many.

Coming back to your argument that third option might give misunderstanding that the reader may think a car might
have only one tyre... In the same sense they might think a car can have 15 tyres because many means you can have n
number of tyres.

If you are sure about the upper bound then you can specify like 0..4.

Hope this helps.

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 14 of 15

Sign In ViewThread Permalink

Question cgandepalli 9-Dec-15 2:17

Hi,

Nice article.

Have a query: (I was referring some sample E-R diagram using Crow Foot Diagram in below URL, in that I noticed that once
one line is used on side of relation - Is that a One-One relationship?)

Example: Relation between Employees and Jobs entity ( one side it is zero through many relation and other side "Only one
line is used") -

http://www.vertabelo.com/_file/blog/data-vault-series-data-vault-2-0-modeling-basics/hr-application-source-oltp-
model.png[^]

Sign In ViewThread Permalink

Re: Question John C Rayan 9-Dec-15 2:48

From the relationship , it states that a job can be linked to zero or many employees.

Sign In ViewThread Permalink

Comment M.Khuram Javed 1-Aug-15 0:35

Fanstastic, sir nice article

Sign In ViewThread Permalink

Re: Comment John C Rayan 9-Dec-15 2:38

Thank you and sorry for the delayed response. Better Later than Never

Sign In ViewThread Permalink

Tool Alex JMW 23-Feb-15 18:52

First, nice article. Simple enough so it easy to understand, yet enough detail to 'get going'.

You mentioned you used a tool, but did not mention the name of the tool. Although it might be out of scope of how the
tool works etc, it would be nice to know which tool you use.

Sign In ViewThread Permalink

Re: Tool John C Rayan 24-Feb-15 0:02

Hi Alex

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017
Data modelling using ERD with Crow Foot Notation - CodeProject Page 15 of 15

Thanks for your comments.

I used Visio and am sure that you could Enterprise Architect too.
If you google you will find some free tools too.

Sign In ViewThread Permalink

Nice to see Chen Notation Joe Gakenheimer 20-Feb-15 9:41

I saw Chen notation listed and remembered I had to use it in college. Nice to see the inventor of the entity-relationship
model recognized (Codd was the relational database model inventor). I also used Oracle notation in college, but in the
professional environment it has always been Crows Foot notation.

Sign In ViewThread Permalink

Re: Nice to see Chen Notation John C Rayan 20-Feb-15 9:44

You are absolutely right.

Sign In ViewThread Permalink 5.00/5 (1 vote)

Last Visit: 31-Dec-99 19:00 Last Update: 27-Mar-17 11:21 Refresh 1

General News Suggestion Question Bug Answer Joke Praise Rant Admin

Permalink | Advertise | Privacy | Terms of Use | Mobile Article Copyright 2015 by John C Rayan
Select Language
Web02 | 2.8.170308.1 | Last Updated 20 Feb 2015 Everything else Copyright CodeProject, 1999-2017
Layout: fixed | fluid

https://www.codeproject.com/articles/878359/data-modelling-using-erd-with-crow-foot-no... 3/27/2017

You might also like