Entity Relationship Diagrams

In this weeks seminar we were introduced to Entity Relationship Modelling (ERM), a way of planning tables to be created and the relationships between them. This is a very important step in regards to creating a database, as it is important to plan ahead. If the tables were created without a plan, then many changes would have to be made to them, so planning ahead saves a lot of time in creating a database. ERM involves deciding on important entities, as well as what attributes each entity will hold. An entity is a distinct thing which has data stored about it, and an attribute is a piece of data about an entity.

For homework we were tasked with creating an ERM for a cookbook website, where recipe book contributors can store their personal data (relevant to a cookbook application), and where all contributors are optionally able to create 1 or many recipes. Within this each recipe has a title, contributor and description, as well as at least one photo, and each photo is accompanied by a description. Below you can see my entities (in capitals) each followed by the attributes I think each one should hold.

Screen Shot 2015-02-16 at 16.44.53
This is then converted into an ERM, showing the relationship between each entity in my database. The crows foot indicates many, whereas a single line indicates one, so for example each contributor can make many recipes, but each recipe can only be contributed by one person.

Screen Shot 2015-02-16 at 16.40.24

This is obviously a very simple ERM, as in a larger database it would be much more complex, with many more entities, but I believe this has solved the problem presented to us.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s