What is Entity Relationship Diagram (ER Diagram) or ERD?

Entity Relationship Diagram (also called as ER Diagram, ER Model, ERD) contains entities/attributes and relationships with those entities. ER Model is a methodological approach to create entities in normalized forms to minimise redundancy. It is drawn with the use of Data Modeling Tools and the following steps are done to create the entity relationship diagram.

  1. Understanding the business requirements
  2. Meetings / discussions with stakeholders (BA/SME/PM etc) to find out entities and relationships
  3. Data Modeler designs the ER diagram.

Data Modeling with ER Model:

In the above mentioned example,

1. Following entities are created by data modeler

  1. Department
  2. Gender
  3. Employee
  4. Salary Grade
  5. Degree

2. Then the data modeler adds the relevant attributes to those entities.

3. Creating attributes: Example Employee

  1. Employee ID
  2. Department Number
  3. Salary Grade Identifier
  4. Gender Code
  5. Degree Code
  6. Employee Name
  7. Birth DATE

4. The data modeler assigns relevant datatypes for each attribute based on the type of data stored:

Example Employee ID in employee entity

5. Relationships:

  1. After creating entities and attributes the data modeler decides how to create the primary key, foreign key
  2. Creating primary key:
    1. Example: Employee ID in Employee entity
  3. Creating foreign key:
    1. Example: Employee entity references Department entity, Gender entity, Salary Grade and Degree Entity

Optionality and Cardinality  options:

(Source: www.Erwin.com)

Creating foreign key:

  1. Example: Employee entity references Department entity, Gender entity, Salary Grade and Degree Entity

In The below ER diagram created from Erwin Data Modeling Tool by using Information Engineering (IE) notation, near to that department entity, one can see ZERO and ONE and near employee entity, ZERO AND ONE AND MORE. These symbols have specific meaning and the data modeler has assigned the right symbols due to business rules.

Similarly, entities are created in ER diagram and the data modeler gets the approval from the business team, technical to release the data models.

Data Modeling Software Tools Trial Versions:

Oracle has released “SQL Developer Data Modeler” and it is a free data modeling tool. If you want to become a data modeler, you can start designing data with “SQL Developer Data Modeler”.

Download ‘SQL Developer Data Modeler’:


With Erwin and PowerDesigner, you can get the trial version.

Download Erwin:


Download PowerDesigner:



If you are interested to learn data modeling by using Erwin or SAP PowerDesigner or Oracle SQL Data Modeler, please reach us for more details – Training@learndatamodeling.com or 91-90801 57239.

Data Modeling Topics – Index

Data Modeling

Data Modeling Overview

Data Modeling Tools

Creating Objects & Data Modeling Relationships

Data Modeling Types


Physical Data Modeling

Modeling Data Warehouse and Data Mart

Interview Questions

Challenging Situations in Data Modeling

Challenges & Solutions in Data Modeling:

Anyone can Learn Data Modeling Concepts by reading some books or going through online or by getting some help from experts in the field. But practically, while working with a particular Data Model, there may arise many challenging situations where one has to think about various possibilities and requirements, before imposing a cardinality rule or before creating a relationship. Will it be sufficient if I go with one additional entity or I should create one lookup in order to satisfy the Business Requirement? Will the current data structures be hold good for any future expansions and modifications?

So many challenging situations may arise during the course of one Data Modeling Life Cycle. This page is entirely for that purpose which makes Data Modeler to be to think ahead and decide on what rule to apply in order to create the right Data Model.

We will come up with many difficult situations and present you with some practical based scenarios and post it on this page on the daily or weekly basis. Data Modelers make a note of this page and use it as a reference or an assignment to improve your skills in the Data Modeling Field.

Challenging Situations in Data Modeling from the Client End:
  • No documents or fewer documents with less information which explains the business process and business rules.
  • Less knowledge and no proper explanation from SME or BAs.
  • User requirements and demands are more.
  • No proper plan in the Enterprise Architecture.
Challenging Situations in Data Modeling from the Data Modeler’s Perspective:
  • Not able to understand the business requirements.
  • Understanding the business requirements but not able to predict the entities required for this project.
  • Understanding the entities required but not able to place the attributes properly in the entity.
  • Placing the attributes in entities but not able to create identifying relationships or non-identifying relationships.
  • Able to create identifying and non-identifying relationships but not sure whether ZeroOrOne to ZeroOneorMore, One to ZeroOneorMore.

How the change in the business rules affects the data model?

Original Business Rule 1:

  • Employee’s present manager to whom he reports must be tracked.
  • An entity called Employee is created and by using Self Referential Integrity and the role name, Manager is added.

Business Rule 1 Change:

  • Employee’s previous manager, present manager and future managers are to be tracked.

Original Business Rule 2:

  • Employees current residential address must be tracked.
  • An entity called address is created and you connect that address with employee entity.

Business Rule 2 Change:

Employees previous/current/future residential address must be tracked.

Here how these Business Rules(1 & 2) affects the current Data Model and as a data modeler, how will you implement these changes? What is the best way to do it?

Business Rule 3:

If there are three definite values for a column, and if you are sure that these values never change over time then what approach you will follow? – a Lookup or a Check Constraint?

Example: In URLA 1003 form provided by Fannie Mae, Page No.5, Section No. 4 one can see Purchase, Refinance and Other as the values for the field “Loan Purpose”. Should we create a lookup for these 3 values or will it be better if we create an identifier and impose a check constraint on these 3 values.

Business Rule 4:

How will you implement a Candidate Key – By creating it as a Primary Key or an Unique Constraint?

Example: Social Security Number is always a Candidate Key and whether this should be created as a Primary Key in a table or a stand alone column with Unique Constraint imposed on it.


Reach US!!!


  • We provide online training in advanced OLTP Data Modeling and DIMENSIONAL Data Modeling.
  • We also teach the data structures with Data Analytics Software “R”.
  • We provide online Data Modeling Project Support when you get struck with projects that you are involved.
  • We can analyse your Business Requirements, understand and suggest solutions to create OLTP Data Models and Dimensional Data models.
  • We provide Data Modeling Interview Preparation Sessions with a lot of Data Modeling Interview Questions/Answers, which will help you to clear any interview.

If you are interested, please reach us at Training@LearnDataModeling.com or 91-9080157239

Fact Table

Fact Table | Star Schema:

The centralized table in a star schema is called as FACT table. A fact table typically has two types of columns: those that contain facts and those that are foreign keys to dimension tables. The primary key of a fact table is usually a composite key that is made up of all of its foreign keys.

In the example, “Sales Dollar” is a fact (measure) and  it can be added across several dimensions. Fact tables store different types of measures like additive, non additive and semi additive measures.

Measure Types:

  • Additive – Measures that can be added across all dimensions.
  • Non Additive – Measures that cannot be added across all dimensions.
  • Semi Additive – Measures that can be added across few dimensions and not with others.

In the real world, it is possible to have a fact table that contains no measures or facts. These tables are called as Factless Fact tables.

Steps in designing Fact Table:

  • Identify a business process for analysis(like sales).
  • Identify measures or facts (sales dollar).
  • Identify dimensions for facts(product dimension, location dimension, time dimension, organization dimension).
  • List the columns that describe each dimension.(region name, branch name, region name).
  • Determine the lowest level of summary in a fact table(sales dollar).

Example of a Fact Table with an Additive Measure in Star Schema:

Example of a Fact Table with an Additive Measure in Star Schema


Designing Snowflake Schema

Snowflake Schema:

A snowflake schema is a term that describes a star schema structure normalized through the use of outrigger tables. i.e dimension table hierarchies are broken into simpler tables.

In Star Schema example we had 4 dimensions like location, product, time, organization and a fact table (sales).

In Snowflake schema, the example diagram shown below has 4 dimension tables, 4 lookup tables and 1 fact table. The reason is that hierarchies(category, branch, state, and month) are being broken out of the dimension tables(PRODUCT, ORGANIZATION, LOCATION, and TIME) respectively and shown separately. In OLAP, this Snowflake schema approach increases the number of joins and poor performance in retrieval of data. In few organizations, they try to normalize the dimension tables to save space. Since dimension tables hold less space, Snowflake schema approach may be avoided.

Example of Snowflake Schema:

Example of Snowflake Schema


Designing Star Schema

Star Schema: General Information

In general, an organization is started to earn money by selling a product or by providing service to the product. An organization may be at one place or may have several branches.

When we consider an example of an organization selling products throughout the world, the main four major dimensions are product, location, time and organization. Dimension tables have been explained in detail under the section Dimensions. With this example, we will try to provide detailed explanation about STAR SCHEMA.

What is Star Schema?

Star Schema is a relational database schema for representing multidimensional data. It is the simplest form of data warehouse schema that contains one or more dimensions and fact tables. It is called a star schema because the entity-relationship diagram between dimensions and fact tables resembles a star where one fact table is connected to multiple dimensions. The center of the star schema consists of a large fact table and it points towards the dimension tables. The advantage of star schema are slicing down, performance increase and easy understanding of data.

Steps in designing Star Schema:

  • Identify a business process for analysis(like sales).
  • Identify measures or facts (sales dollar).
  • Identify dimensions for facts(product dimension, location dimension, time dimension, organization dimension).
  • List the columns that describe each dimension.(region name, branch name, region name).
  • Determine the lowest level of summary in a fact table(sales dollar).

Important aspects of Star Schema & Snow Flake Schema:

  • In a star schema every dimension will have a primary key.
  • In a star schema, a dimension table will not have any parent table.
  • Whereas in a snow flake schema, a dimension table will have one or more parent tables.
  • Hierarchies for the dimensions are stored in the dimensional table itself in star schema.
  • Whereas hierarchies are broken into separate tables in snow flake schema. These hierarchies helps to drill down the data from topmost hierarchies to the lowermost hierarchies.


Hierarchy: A logical structure that uses ordered levels as a means of organizing data. A hierarchy can be used to define data aggregation; for example, in a time dimension, a hierarchy might be used to aggregate data from the Month level to the Quarter level, from the Quarter level to the Year level. A hierarchy can also be used to define a navigational drill path, regardless of whether the levels in the hierarchy represent aggregated totals or not.

Level: A position in a hierarchy. For example, a time dimension might have a hierarchy that represents data at the Month, Quarter, and Year levels.

Fact Table: A table in a star schema that contains facts and connected to dimensions. A fact table typically has two types of columns: those that contain facts and those that are foreign keys to dimension tables. The primary key of a fact table is usually a composite key that is made up of all of its foreign keys.

A fact table might contain either detail level facts or facts that have been aggregated (fact tables that contain aggregated facts are often instead called summary tables). A fact table usually contains facts with the same level of aggregation.

Example of Star Schema:

Star Schema Diagram

In the example sales fact table is connected to dimensions location, product, time and organization. It shows that data can be sliced across all dimensions and again it is possible for the data to be aggregated across multiple dimensions. “Sales Dollar” in sales fact table can be calculated across all dimensions independently or in a combined manner which is explained below.

  • Sales Dollar value for a particular product.
  • Sales Dollar value for a product in a location.
  • Sales Dollar value for a product in a year within a location.
  • Sales Dollar value for a product in a year within a location sold or serviced by an employee


Slowly Changing Dimensions

What are Slowly Changing Dimensions?

Dimensions that change over time are called Slowly Changing Dimensions. For instance, a product price changes over time; People change their names for some reason; Country and State names may change over time. These are  a few examples of Slowly Changing Dimensions since some changes are happening to them over a period of time.

Slowly Changing Dimensions are often categorized into three types namely Type1, Type2 and Type3. The following section deals with how to capture and handling these changes over time.

The “Product” table mentioned below contains a product named, Product1 with Product ID being the primary key. In the year 2004, the price of Product1 was $150 and over the time, Product1’s price changes from $150 to $350. With this information, let us explain the three types of Slowly Changing Dimensions.

Product Price in 2004:

Product ID(PK)YearProduct NameProduct Price

Type 1: Overwriting the old values.

In the year 2005, if the price of the product changes to $250, then the old values of the columns “Year” and “Product Price” have to be updated and replaced with the new values. In this Type 1, there is no way to find out the old value of the product “Product1” in year 2004 since the table now contains only the new price and year information.


Product ID(PK)YearProduct NameProduct Price

Type 2: Creating an another additional record.

In this Type 2, the old values will not be replaced but a new row containing the new values will be added to the product table. So at any point of time, the difference between the old values and new values can be retrieved and easily be compared. This would be very useful for reporting purposes.


Product ID(PK)YearProduct NameProduct Price

The problem with the above mentioned data structure is “Product ID” cannot store duplicate values of Product1  since “Product ID” is the primary key. Also, the current data structure doesn’t clearly specify the effective date and expiry date of Product1 like when the change to its price happened. So, it would be better to change the current data structure to overcome the above primary key violation.


Product ID(PK)Effective DateTime(PK)YearProduct NameProduct PriceExpiry DateTime
101-01-2004 12.00AM2004Product1$15012-31-2004 11.59PM
101-01-2005 12.00AM2005Product1$250

In the changed Product table’s Data structure, “Product ID” and “Effective DateTime” are composite primary keys. So there would be no violation of primary key constraint. Addition of new columns, “Effective DateTime” and “Expiry DateTime” provides the information about the product’s effective date and expiry date which adds more clarity and enhances the scope of this table. Type2 approach may need additional space in the data base, since for every changed record, an additional row has to be stored. Since dimensions are not that big in the real world, additional space is negligible.

Type 3: Creating new fields.

In this Type 3, the latest update to the changed values can be seen. Example mentioned below illustrates how to add new columns and keep track of the changes. From that, we are able to see the current price and the previous price of the product, Product1.


Product ID(PK)Current YearProduct NameCurrent Product PriceOld Product PriceOld Year

The problem with the Type 3 approach, is over years, if the product price continuously changes, then the complete history may not be stored, only the latest change will be stored. For example, in year 2006, if the product1’s price changes to $350, then we would not be able to see the complete history of 2004 prices, since the old values would have been updated with 2005 product information.


Product ID(PK)Current YearProduct NameCurrent Product PriceOld Product PriceOld Year


Time Dimension

In a relational data model, for normalization purposes, year lookup, quarter lookup, month lookup, and week lookups are not merged as a single table.  In a dimensional data modeling (star schema), these tables would be merged as a single table called TIME DIMENSION for performance and slicing data.

This dimensions helps to find the sales done on date, weekly, monthly and yearly basis. We can have a trend analysis by comparing this year sales with the previous year or this week sales with the previous week.

Example of Time Dimension

Time Dimension Diagram

Year Lookup:

Year IDYear NumberDateTimeStamp
120041/1/2005 11:23:31 AM
220051/1/2005 11:23:31 AM

Quarter Lookup:

Quarter NumberQuarter NameDateTimeStamp
1Q11/1/2005 11:23:31 AM
2Q21/1/2005 11:23:31 AM
3Q31/1/2005 11:23:31 AM
4Q41/1/2005 11:23:31 AM

Month Lookup:

Month NumberMonth NameDateTimeStamp
1January1/1/2005 11:23:31 AM
2February1/1/2005 11:23:31 AM
3March1/1/2005 11:23:31 AM
4April1/1/2005 11:23:31 AM
5May1/1/2005 11:23:31 AM
6June1/1/2005 11:23:31 AM
7July1/1/2005 11:23:31 AM
8August1/1/2005 11:23:31 AM
9September1/1/2005 11:23:31 AM
10October1/1/2005 11:23:31 AM
11November1/1/2005 11:23:31 AM
12December1/1/2005 11:23:31 AM

Week Lookup:

Week NumberDay of WeekDateTimeStamp
1Sunday1/1/2005 11:23:31 AM
2Monday1/1/2005 11:23:31 AM
3Tuesday1/1/2005 11:23:31 AM
4Wednesday1/1/2005 11:23:31 AM
5Thursday1/1/2005 11:23:31 AM
6Friday1/1/2005 11:23:31 AM
7Saturday1/1/2005 11:23:31 AM

Time Dimension:


Time Dim IdYear NoDay Of YearQuarter NoMonth NoMonth NameMonth Day NoWeek NoDay of WeekCal DateDate Time Stamp
120041Q11January1151/1/20041/1/2005 11:23:31 AM
2200432Q12February1512/1/20041/1/2005 11:23:31 AM
320051Q11January1171/1/20051/1/2005 11:23:31 AM
4200532Q12February1532/1/2001/1/2005 11:23:31 AM



Organization Dimension

In a relational data model, for normalization purposes, corporate office lookup, region lookup, branch lookup, and employee lookups are not merged as a single table. In a dimensional data modeling(star schema), these tables would be merged as a single table called ORGANIZATION DIMENSION for performance and slicing data.

This dimension helps us to find the products sold or serviced within the organization by the employees. In any industry, we can calculate the sales on region basis, branch basis and employee basis. Based on the performance, an organization can provide incentives to employees and subsidies to the branches to increase further sales.

Example of Organization Dimension:

Example of Organization Dimension

Corporate Lookup:

Corporate CodeCorporate NameDateTimeStamp
COAmerican Bank1/1/2005 11:23:31 AM

Region Lookup:

Region CodeRegion NameDateTimeStamp
SESouth East1/1/2005 11:23:31 AM
MWMid West1/1/2005 11:23:31 AM

Branch Lookup:

Branch CodeBranch NameDateTimeStamp
FLTMFlorida-Tampa1/1/2005 11:23:31 AM
ILCHIllinois-Chicago1/1/2005 11:23:31 AM

Employee Lookup:

Employee CodeEmployee NameDateTimeStamp
E1Paul Young1/1/2005 11:23:31 AM
E2Chris Davis1/1/2005 11:23:31 AM

Organization Dimension:

Organization Dimension IdCorporate NameRegion NameBranch NameEmployee NameDateTimeStamp
1American BankSouth EastFlorida-TampaPaul Young1/1/2005 11:23:31 AM
2American BankMid WestIllinois-ChicagoChris Davis1/1/2005 11:23:31 AM


Next⇒ Time Dimension


Product Dimension

In a relational data model, for normalization purposes, product category lookup, product sub-category lookup, product lookup, and and product feature lookups are are not merged as a single table. In a dimensional data modeling(star schema), these tables would be merged as a single table called PRODUCT DIMENSION for performance and slicing data requirements.

Example of Product Dimension:

Product Dimension Example Diagram

Product Category Lookup:

Product Category CodeProduct Category NameDateTimeStamp
1Apparel1/1/2005 11:23:31 AM
2Shoe1/1/2005 11:23:31 AM

Product Sub-Category Lookup:

Product Sub-Category CodeProduct Sub-Category NameDateTimeStamp
11Shirt1/1/2005 11:23:31 AM
12Trouser1/1/2005 11:23:31 AM
13Casual1/1/2005 11:23:31 AM
14Formal1/1/2005 11:23:31 AM

Product Lookup:

Product CodeProduct NameDateTimeStamp
1001Van Heusen1/1/2005 11:23:31 AM
1002Arrow1/1/2005 11:23:31 AM
1003Nike1/1/2005 11:23:31 AM
1004Adidas1/1/2005 11:23:31 AM

Product Feature Lookup:

Product Feature CodeProduct Feature DescriptionDateTimeStamp
10001Van-M1/1/2005 11:23:31 AM
10002Van-L1/1/2005 11:23:31 AM
10003Arr-XL1/1/2005 11:23:31 AM
10004Arr-XXL1/1/2005 11:23:31 AM
10005Nike-81/1/2005 11:23:31 AM
10006Nike-91/1/2005 11:23:31 AM
10007Adidas-101/1/2005 11:23:31 AM
10008Adidas-111/1/2005 11:23:31 AM

Product Dimension:

Product Dimension IdProduct Category NameProduct Sub-Category NameProduct NameProduct Feature DescDateTimeStamp
100001ApparelShirtVan HeusenVan-M1/1/2005 11:23:31 AM
100002ApparelShirtVan HeusenVan-L1/1/2005 11:23:31 AM
100003ApparelShirtArrowArr-XL1/1/2005 11:23:31 AM
100004ApparelShirtArrowArr-XXL1/1/2005 11:23:31 AM
100005ShoeCasualNikeNike-81/1/2005 11:23:31 AM
100006ShoeCasualNikeNike-91/1/2005 11:23:31 AM
100007ShoeCasualAdidasAdidas-101/1/2005 11:23:31 AM
100008ShoeCasualAdidasAdidas-111/1/2005 11:23:31 AM


Next⇒ Organization Dimension


1 2 3 6