Relational Database Design - Data Model Basics

Data Model

A Data Model is a graphical representation of your data and it's relationships. The good news is that there only two things you can have on a Data Model - Entities and Relationships.

Entities

Entities will one day grow up to be tables in your database. Don't make the mistake of thinking that entities are tables - they might be one day , but in a data model entities are just containers, or groupings of things. Things are known as attributes and at this stage we don't care about them.

An entity is a logical group of things. Ie: a People Entity would store... yep, People!

Relationships

A stick with a Crow's foot on one end shows the cardinality of the relationship between entities. So, the end with the Crow's Foot shows that there MAY be many of theses things, while the stick end shows that there can only be one thing at this end.

There are MANY data modelling applications and ways of representing relationships. In this "Real World Database Design Tutorial" we will only ever allow one - One To Many. In fact this is one of Simon's Rule's :

Simon's Rule : Data Models will only show one to many relationships

A Data Model Entity

Here is what an entity looks like on a Data Model:

Data Model Entity

Just a box - easy!

A Data Model Relationship

Here is what an relationship looks like on a Data Model:

Data Mdeol Relationship

A stick with a 'Crow's foot at one end.

A Real Life Example

To model the relationship between say, me and my collection of Interestingly shaped vegetables. We could say that there is only one of me and many vegetables, so the Data Model would look like this:

Data Model Example

I must point out that I do not have a collection of interestingly shaped vegetables - this was just an example.

The next section of this tutorial will cover the basics of Normalisation, we shall return to Data Modelling after we have been normalised!

Atomicity

Have a look at the Database Design Atomicity section.