Identifying Entities
Episode #3 of the course Relational database design by Ben Brumm
Welcome to the third lesson.
Last lesson, we learned how to gather the requirements for our database, which will help us to work out what we need to store and what we don’t need to store.
In this lesson, we’ll start identifying what we need to store.
First, we’ll look at how we want to capture and document our database.
Tools for Documenting Your Database Design
Database designs are usually captured in a diagram form. The diagram is called an Entity Relationship Diagram, and it represents the entities in our database and how they relate to each other.
I’ll show you an example of this diagram in a few lessons’ time, when we start to create one.
To create these diagrams, we can use different programs. You can use Microsoft Visio, which allows you to create these diagrams with built-in templates. You can use Lucidchart, an online diagramming tool similar to Visio. You can also use different types of IDEs (Integrated Development Environments) that are used for developing database code, such as MySQL Workbench. You can use pen and paper. This is often how I like to start, as it allows me to quickly write things down without having to use software. Or you can use a word processor such as Microsoft Word, Notepad, or Google Docs.
During this course, we’ll design our database using a word processor, and I’ll represent it to you in a text format as well as a diagram. This makes it easier for you to get started.
Now, let’s get on to our design.
Identifying Entities
Our database needs to capture information about entities.
What is an entity?
It’s something you want to store data about. We’ll use entities to create our database tables and eventually build the design to allow an application or website to use it.
First, we need to work out what the database needs to store. How do we do this?
We do this by analyzing the requirements of our database and working out the nouns in the sentences. For example, let’s use our student enrollment database from last lesson.
Goal: to help universities keep track of the students who have enrolled, what subjects they are taking, and the teachers of those subjects.
What are our nouns? (Nouns are things or objects.)
I’ll repeat the sentence and bold the nouns.
Goal: to help universities keep track of the students who have enrolled, what subjects they are taking, and the teachers of those subjects.
So, our nouns for this database are:
• University
• Student
• Subject
• Teacher
We have four entities. I have used the singular version of the word to be consistent and because a record of one of those entities is a singular item.
So, with the database you need to design, list the nouns you have in your goal statement. It doesn’t need to be a full list now, because you can add to it later.
Now that we’ve completed the identification of entities, we need to work out what needs to be stored against each of those entities. That’s what we’ll cover next lesson.
Until next time,
Ben
Recommended book
Share with friends