Relational Database Design: Data Modeling for Beginners Part 1 of 2

Accelerate Computer Training
10 Apr 202321:15

Summary

TLDRIn this two-part video series, Tim Jones from Accelerate Computer Training introduces beginners to relational database design and data modeling. The focus is on planning the structure of databases, emphasizing the importance of understanding entities, attributes, and relationships to avoid data inconsistencies and redundancy. Key concepts like primary and foreign keys are discussed, and the necessity of a blueprint for database construction is highlighted. The video aims to equip non-technical users with the skills to model real-world scenarios into effective data structures, setting the stage for part two where an Entity-Relationship Diagram will be created.

Takeaways

  • 📚 The video series focuses on teaching relational database design and data modeling for beginners, emphasizing the structure rather than the interface.
  • 👨‍🏫 Tim Jones from Accelerate Computer Training is the instructor, aiming to help non-technical users understand relational database architecture.
  • 🔍 The agenda includes defining the need for relational databases, learning to plan a database, and understanding key concepts like entities, attributes, and relationships.
  • 📊 The importance of using an Entity-Relationship Diagram (ERD) is highlighted as a blueprint for planning a database's structure.
  • 🔑 Key fields like primary and foreign keys are crucial for linking tables and ensuring data integrity in relational databases.
  • 🏗️ The video stresses the importance of planning before building a database, comparing it to a construction crew needing a blueprint.
  • 📈 The benefits of using multiple tables in a relational database are explained, such as avoiding inconsistent data entry and eliminating redundant storage.
  • 🎓 The process of data modeling is introduced as the method for translating real-world scenarios into structured data within a database.
  • 🔍 The video provides a practical example of identifying entities and attributes using the process description of a classical music compositions database.
  • 📝 The script guides viewers through the process of creating a process description and identifying potential entities and attributes within it.

Q & A

  • What is the main focus of the video series 'Relational Database Design, Data Modeling for Beginners'?

    -The main focus of the video series is to teach the skills and strategies used to plan the structure of new relational database systems, emphasizing on the structure of what the database will contain rather than its interface or appearance.

  • Who is the target audience for the video series?

    -The target audience for the video series is non-technical users who need to track related sets of information and wish to improve their understanding of relational database architecture.

  • What are the key skills that will be taught in the video series?

    -The video series will teach skills such as identifying entities and attributes in real-world scenarios, identifying relationships between entities and determining their cardinality, and drawing an Entity-Relationship Diagram (ERD).

  • Why is it important to use multiple tables in a relational database?

    -Multiple tables in a relational database are important to avoid inconsistent data entry, eliminate redundant data storage, and ensure data consistency by storing each value only once and referencing it multiple times.

  • What is the role of primary and foreign keys in relational databases?

    -Primary keys play a role in automatically assigning a unique identifier to each record in a table, while foreign keys are used to reference the primary key of another table, which helps in relating records of data to each other.

  • Why is planning a relational database before building it crucial?

    -Planning a relational database before building it is crucial because it provides a blueprint to follow, ensuring that the database is structured correctly to avoid issues with data inconsistency and redundancy, much like a construction crew needs a blueprint to build a structure.

  • What is the difference between an entity and an attribute in the context of database design?

    -An entity is a thing or idea about which data is stored, while an attribute is a characteristic or descriptor of an entity. An entity has multiple attributes that describe it, whereas an attribute is a single value.

  • What is the purpose of creating a separate table for Composer, Era, and Style in the example of the Classical Music Compositions database?

    -Creating separate tables for Composer, Era, and Style ensures that each value is entered and stored only once, which guarantees consistency and avoids redundancy. It also allows for easier updates and references in the main Composition table.

  • How does the video series define the term 'relational database'?

    -A relational database is defined as a collection of related data about entities, organized into separate tables, where each table is made of columns and rows, with each column being a field and each row being a record.

  • What is the significance of the term 'Data Modeling' as used in the video series?

    -Data Modeling, as used in the video series, refers to the process of turning real-world scenarios into sound data structures, which involves identifying entities, attributes, and their relationships to create a blueprint for a database.

  • What is the importance of a process description in the database planning phase?

    -A process description is important in the database planning phase as it provides a clear goal and a finish line for the database development, ensuring that all stakeholders agree on what the database needs to address and store.

Outlines

00:00

📚 Introduction to Relational Database Design

Tim Jones introduces a two-part video series on relational database design for beginners. The focus is on the structure of databases rather than their interface. The target audience is non-technical users who need to manage related sets of information. The session aims to define the need for relational databases and teach skills like identifying entities and attributes, determining relationships and cardinality, and drawing an Entity-Relationship Diagram (ERD). The importance of primary and foreign keys is discussed, and the necessity of planning before building a database is emphasized, comparing it to a construction project needing a blueprint.

05:00

🔑 The Power of Multi-Table Structure in Relational Databases

The video explains the concept of a relational database, which organizes related data into separate tables to avoid inconsistent and redundant data entry. It uses the example of a 'Classical Music Compositions' table to illustrate the problem of inconsistent data and the solution of using multiple tables for entities like Composer, Era, and Style. Each entity is stored once with a unique identifier (primary key), and these IDs are referenced in other tables to ensure data consistency. The video also addresses the potential concern of users seeing only numbers instead of actual names, assuring that a well-designed database would present user-friendly interfaces while maintaining the underlying structure.

10:01

🎓 Data Modeling: From Real-World Scenarios to Data Structures

The paragraph delves into the process of data modeling, which involves converting real-world scenarios into structured data models. It discusses the two phases of database development: the virtual (planning) phase and the physical (building) phase. During the planning phase, items to be tracked are called entities, and their characteristics are attributes. The paragraph emphasizes the importance of starting with a process description, which outlines the purpose of the database. It then guides viewers through identifying entities and attributes from a process description, using the example of a classical music collection database. The video teaches how to differentiate between entities and attributes, and how to optimize data structure by normalizing data and using ID numbers to link related records.

15:02

👶 Entity Identification in Educational Database Design

This section continues the data modeling process with a new process description focused on an educational setting. It involves identifying potential entities such as Student, Class, Teacher, and Incidents. The paragraph discusses the decision-making process for naming entities and attributes, emphasizing the importance of choosing understandable and consistent terminology. It also covers the strategy of creating separate tables for entities that have many related records to avoid redundancy and ensure data consistency. The video provides a practical approach to entity-relationship mapping, showing how to link entities like Student to Class, Teacher, and Incident through unique identifiers.

20:03

🏫 Streamlining Data with Entity-Relationship Diagrams

The final paragraph summarizes the process of identifying entities and their relationships in the context of an educational database. It touches on the entities of Classroom and Grade, explaining the rationale for treating them as separate entities to maintain data integrity and facilitate updates. The paragraph reinforces the principle of 'One fact, one field' in database design and the benefits of creating a comprehensive Entity-Relationship Diagram (ERD). It sets the stage for Part 2 of the series, where the ERD will be constructed, providing a clear blueprint for the database's structure.

Mindmap

Keywords

💡Relational Database

A relational database is a type of database that organizes data into tables with rows and columns, where each row represents a record and each column represents a field. The video emphasizes the importance of relational databases for organizing related sets of information efficiently. It is used as the central theme of the video, with the speaker teaching how to plan the structure of new relational database systems.

💡Data Modeling

Data modeling is the process of creating a blueprint for a database by defining its structure, including the tables, fields, and relationships between data. In the video, data modeling is presented as a crucial skill for planning a relational database, involving the identification of entities and attributes, and the creation of an Entity-Relationship Diagram (ERD).

💡Entity

An entity in the context of the video refers to a thing or concept about which data is stored, such as 'Composition' or 'Composer'. Entities are represented as tables in a relational database, and each table contains records (rows) that represent instances of that entity. The video discusses how to identify entities in a real-world scenario and how they are used to structure the database.

💡Attribute

An attribute is a characteristic or descriptor of an entity. In the video, attributes are discussed as the individual pieces of data that describe an entity, such as the 'Title' or 'Year' of a 'Composition'. Attributes are represented as columns in a database table and are used to define the fields within each table.

💡Primary Key

A primary key is a unique identifier for each record in a database table. The video explains that primary keys, such as 'ID', are used to automatically assign a unique number to each record, ensuring that each entry is distinct and can be accurately referenced.

💡Foreign Key

A foreign key is a field in a database table that refers to the primary key of another table, creating a link between the two tables. The video discusses how foreign keys are used to establish relationships between entities, such as using a 'Composer ID' in the 'Composition' table to reference the 'Composer' entity.

💡Cardinality

Cardinality refers to the type of relationship between entities in a database, indicating the number of records in one table that can be associated with a record in another table. The video mentions cardinality in the context of identifying relationships between entities and designing the database structure accordingly.

💡Entity-Relationship Diagram (ERD)

An Entity-Relationship Diagram is a visual representation of the structure of a database, showing the entities, their attributes, and the relationships between them. The video highlights the importance of ERDs in planning and illustrating the proposed structure of a database before building it.

💡Normalization

Normalization is the process of organizing data in a database to minimize redundancy and dependency. The video explains how normalization is achieved by splitting data into separate tables and using primary and foreign keys to link them, ensuring data consistency and efficiency.

💡Inconsistent Data Entry

Inconsistent data entry refers to the issue of different users entering the same information in various ways, leading to discrepancies in the database. The video uses examples, such as different spellings of a composer's name, to illustrate the problems caused by inconsistent data entry and how a relational database structure can help avoid this issue.

💡Process Description

A process description is a written statement that outlines the purpose and requirements of a proposed database. In the video, the speaker emphasizes the importance of creating a process description as a starting point for planning a database, involving stakeholders and ensuring a clear understanding of the database's goals.

Highlights

Introduction to Relational Database Design for Beginners

Focus on database structure rather than interface

Target audience is non-technical users needing to track related information sets

Agenda includes defining relational databases, planning databases, and drawing ERDs

Importance of key fields like primary and foreign keys in relational databases

Comparison of database creation to construction without a blueprint

Definition of a relational database as a collection of related data about entities

Explanation of tables, fields, records, and entities in a database

Advantages of using multiple tables to avoid inconsistent and redundant data

Example of inconsistent data entry in a single-table database

Strategy to store data once and reference it many times using multiple tables

Use of primary key fields to assign unique identifiers to records

Elimination of long text entries and storage through normalization

Discussion on the importance of unique names in databases

Introduction to Data Modeling as the process of turning real-world scenarios into data structures

Differentiation between virtual phase entities and physical phase tables

Process of creating a process description for database planning

Technique of identifying entities and attributes from a process description

Example of entity identification with 'Classical Music Compositions'

Explanation of how to differentiate between entities and attributes

Importance of starting database planning with a clear process description

Practical exercise of identifying entities and attributes in a new scenario

Discussion on the decision-making process for entity naming

Detailing the attributes of the 'Student' entity and its relationship with 'Class'

Strategy for handling 'Incident' data through separate tables for better control

Advantages of creating a separate 'Classroom' entity for data consistency

Normalization strategy for the 'Grade' attribute to avoid redundant data

Conclusion and预告 of Part 2 focusing on building the Entity-Relationship Diagram (ERD)

Transcripts

play00:00

Hello, and welcome to Relational Database Design, Data Modeling for Beginners, part

play00:05

1 of 2.

play00:07

My name is Tim Jones from Accelerate Computer Training in Long Beach, California.

play00:11

In this two-part video series, we are going to teach you the skills and strategies used

play00:16

to plan the structure of new relational database systems.

play00:21

The emphasis here is on structure, what the database will contain, not interface, or what

play00:26

it will look like.

play00:27

Our target audience for this session is the non-technical user who needs to track related

play00:32

sets of information but wishes to improve their understanding of relational database

play00:37

architecture.

play00:39

On the agenda for these two sessions we will Define and defend the need for relational

play00:44

databases Learn the skills needed to plan a database,

play00:48

including how to: Identify entities and attributes in a real-world

play00:52

scenario Identify relationships between entities and

play00:56

determine their cardinality (or type of relationship) , and

play01:00

Draw an Entity-Relationship Diagram, or ERD, that clearly illustrates the plan for a proposed

play01:07

database.

play01:08

We will also discuss the role that key fields, both primary and foreign keys, play in relational

play01:15

databases.

play01:16

We will not build any databases today, because how you create tables, fields, and relationships

play01:21

will depend on the database development platform you use.

play01:25

Whether you build in AirTable, FileMaker, MySQL, or another platform, you need to construct

play01:32

a plan before you start to build.

play01:34

Can you imagine a construction crew showing up on the jobsite without a blueprint to follow?

play01:40

How would they know where to dig, where to cut, how much to pour?

play01:44

As the saying goes, “If you fail to plan, you plan to fail” so we are going to learn

play01:50

how to plan a relational database.

play01:53

But before we start that, there are some terms and definitions we all need to understand,

play01:58

starting with relational database.

play02:00

A relational database, called simply a base in AirTable, and a solution or app in FileMaker,

play02:08

is a collection of related data about entities, organized into separate tables.

play02:15

What is a table?

play02:16

A table is the structure in which data describing an entity is stored.

play02:21

It is is made of columns and rows, like a spreadsheet.

play02:24

Each column is a field, and each row is a record.

play02:28

An entity is a thing or idea about which we want to store data.

play02:33

As an example, a table storing data about the entity classical music compositions might

play02:40

be structured like this.

play02:43

Note that in a relational database system, we create one table per entity.

play02:48

“Why not just store everything in one big list?”

play02:52

you might ask.

play02:53

“Why use multiple tables?”

play02:54

I am so glad you asked!

play02:57

We use multiple tables To avoid inconsistent data entry, and to eliminate redundant entry

play03:03

and storage.

play03:04

Let’s look at our Classical Music Compositions table again, this time with only records of

play03:10

some of Bach's compositions.

play03:13

Notice the inconsistent data entry.

play03:15

In the Composer field, we have three different renditions of his name, which, to a database,

play03:20

looks like three different Composers.

play03:23

In the Era field, we have two different entries for the Classical era.

play03:27

There were obviously no restrictions on what users were allowed to enter in these fields,

play03:32

and as a result, we get inconsistency, which will cause trouble when we try to search or

play03:37

report on this data.

play03:40

Not only are we asking our users to type the same data values over and over, which eventually

play03:45

leads to inconsistency, but we are also asking the database to store those values repeatedly,

play03:51

which makes the database big and slow.

play03:54

If only there was a way to store an entry once and reference it many times.

play04:00

Well, there is!

play04:02

Using multiple tables in a relational database.

play04:06

Splitting entities out into separate tables for Composer, Era, and Style, lets us enter

play04:16

and store each value only once, which guarantees consistency.

play04:21

How many times would we enter Mozart's name in a system structured like this?

play04:26

Only once.

play04:27

Likewise, each era and each style is entered and stored only once in its own table.

play04:36

We use a primary key field, called ID here, to automatically assign a unique identifier

play04:44

like 1, 2, or 3, to each record when it is created.

play04:49

Then in the Composition table, we'll enter a Composer's ID number instead of their name,

play04:56

like a one for Mozart, a two for Bach, and so on.

play05:00

Likewise, we enter an Era ID number instead of typing the Era name, and a Style ID instead

play05:07

of typing the Style name like Fugue or Concerto.

play05:11

It eliminates typing and storing long text entries, which always lead to inconsistent

play05:15

data, and it also resolves the dilemma of two composers, for example, having the same

play05:21

name.

play05:22

Unlikely, you say?

play05:25

Did you know that there were two famous classical composers named Johann Sebastian Bach?

play05:31

Take it from a guy named Tim Jones, names are not guaranteed to be unique.

play05:36

Now, I know you are probably thinking that this will never work for you because you could

play05:40

not bear to see numbers in place of the actual composer's name, era, style, or whatever.

play05:46

Don't worry!

play05:47

A well-designed database would never make users view the data like this.

play05:52

You would see the composer's name, referenced from the Composer table where it lives.

play05:57

Its the ID numbers that are the key to relating records of data to each other which lets us

play06:03

view that data anywhere we want.

play06:06

If I have convinced you that the multi-table structure of a relational database system

play06:10

is reasonable and prudent, let’s learn how to the plan them.

play06:14

The skills I am about to teach you are generally referred to as Data Modeling, which is the

play06:20

process of turning real-world scenarios into sound data structures.

play06:26

When we talk about database development, there are often two sets of terms we use during

play06:31

the different phases of development: virtual phase and physical phase.

play06:37

During the virtual, or planning stage, we call each thing we are going to track an entity,

play06:43

but when we start to build the database, we will create a table for each entity.

play06:48

Similarly, while in the virtual or planning stage, we call each characteristic of an entity

play06:53

an attribute, knowing that each attribute will become a field in the actual table.

play06:59

And lastly, we might talk of an instance of an entity being the same as a record of data

play07:05

in a table.

play07:07

Having defined our terms, we are ready to begin planning.

play07:10

You should always start with a process description.

play07:14

This is a written statement describing the proposed database.

play07:18

It could be as simple as “We want to store information about the classical compositions

play07:23

in our collection, including title, composer, era, year, and style or genre.”

play07:30

Try to involve as many of your stakeholders as you can when drafting the process description

play07:35

and get agreement from them on what needs the database must address.

play07:40

This gives you a goal, a finish line to cross, even if only for Phase One of the database.

play07:46

Once the process description is ready, we can identify entities and attributes.

play07:51

I call this going on a hunt for nouns, because the nouns in the process description are usually

play07:57

entities, attributes, or both.

play08:00

You will recall from earlier that an entity is a thing or idea about which we want to

play08:06

store data.

play08:08

An attribute is a characteristic or descriptor of each entity, or of an entity.

play08:14

For each noun, here’s how to tell the difference: an entity has multiple attributes that describe

play08:20

it, while an attribute is only one value.

play08:24

Let's practice.

play08:26

Here again is our process description, or real-world scenario.

play08:29

Let’s list the nouns, the relevant nouns, as we read it.

play08:34

We want to store information (okay, information is a noun, but not relevant to the database)

play08:40

about the classical compositions in our collection, including title, composer, era, year, and

play08:55

style or genre.

play08:56

Okay, we got them all.

play08:58

Now let’s figure out whether each one is an entity (a thing or idea about which we

play09:03

want to store data) or an attribute (a characteristic or descriptor of an entity).

play09:09

To determine the difference, remember an entity has multiple attributes that describe it,

play09:15

while an attribute is only one value.

play09:18

Some nouns may be both an entity and an attribute of another entity; keep that in mind.

play09:24

First up is composition.

play09:27

When you think about a specific classical music composition, like Beethoven's Fifth

play09:31

Symphony, for example, are there multiple attributes that come to mind that describe

play09:35

it, or just one value?

play09:38

There are multiple data values that describe a composition: its title, its composer, the

play09:43

year it was written, etc.

play09:46

Therefore, composition is an entity, and will deserve its own table in the database.

play09:52

We create a box for each entity; these boxes will ultimately become our Entity-Relationship

play09:57

Diagram, our blueprint for the database.

play10:00

Earlier, we learned the value of automatically assigning a unique identifier to each instance

play10:06

of an entity, so we will add ID as the first attribute of each entity.

play10:12

OK, one down.

play10:14

Let's move on to Collection.

play10:16

This word appeared in the process description, so we added it to our list of nouns, or potential

play10:21

entities, but the term Collection could refer either to a specific person's music collection

play10:27

or the entire body of work that we call classical music and it would not affect the structure

play10:32

of our database, so we can scratch that one off the list.

play10:37

Next is Title.

play10:39

When you think about the title of a composition, are there multiple attributes that come to

play10:43

mind, or just one value?

play10:45

A title is series of words, yes, but it makes up one single value, so Title is an attribute.

play10:53

Which entity does it describe?

play10:55

A composition, of course, so we add Title as an attribute to the Composition entity

play11:01

and mark it as managed on the list.

play11:05

Next up, Composer.

play11:07

Does composer bring to mind multiple attributes that describe it?

play11:10

Certainly!

play11:11

A composer has a first name, a last name, a birthplace, and many other interesting characteristics.

play11:17

That means Composer is an entity, so we make a box for it and list its attributes.

play11:24

But Composer, while being an entity itself, is also an attribute of Composition.

play11:30

We track that by adding Composer ID under Composition, and now we can mark it off the

play11:37

list.

play11:38

If you are wondering, "How are my users going to know the unique ID number of the composer

play11:43

who wrote Piano Sonata No. 2 in B flat minor?"

play11:46

don't worry.

play11:48

Every database platform provides a means of entering an ID number by choosing from a drop-down

play11:53

menu or pick list that shows the name or title of the thing.

play11:58

Next, we have Era.

play12:01

Music historians have divided classical music into three eras: Baroque, Classical, and Romantic.

play12:06

They actually use these eras to describe composers, not compositions.

play12:11

For example, Bach lived during the Baroque era; thus, every one of his compositions was

play12:17

a Baroque composition because he was a Baroque-era composer.

play12:22

So era is an attribute of Composer, not Composition.

play12:27

By the guidelines we have used so far, Era would seem like an attribute.

play12:32

For any given composer, we would need to store only one value to describe their era.

play12:37

However, there is something else to consider.

play12:40

We do not want to force, or even allow users to enter the same values over and over in

play12:46

the same field across many records.

play12:48

It leads to inconsistent data entry and makes the database big and slow.

play12:54

We need to optimize, or normalize, this attribute, by giving it its own table , where we will

play13:00

create a record for the three eras, each with its own ID number and Title.

play13:07

And then we will define an Era ID attribute in the Composer entity.

play13:12

We have dealt with Era.

play13:14

Now I know this is detailed work, but stay with me; you are going to have to do this

play13:17

on your own soon.

play13:19

Only two more.

play13:21

Year Written; is it an entity or an attribute?

play13:24

Are there multiple attributes that describe the idea of the year when a composition was

play13:29

written?

play13:30

No, it is a simple attribute of a composition that users will type freeform into a Year

play13:36

field.

play13:37

Lastly, Style.

play13:39

It is obviously an attribute of Composition where we will enter whether a piece of music

play13:44

was an opera, a concerto, a symphony, etc.

play13:48

But there are only so many distinct entries we would ever make in this field, so to avoid

play13:54

inconsistent entries and with the goal of normalizing our data, we should create a separate

play14:00

Style table with at least these two attributes: ID and Title.

play14:06

In the Composition entity, we need a Style ID attribute where we will implement a drop-down

play14:12

menu fed by the records in the Style table to help users enter the ID number that identifies

play14:18

the style of each composition.

play14:20

There, we have accounted for all the nouns in the process description.

play14:25

and now its your turn.

play14:27

Here is a new process description.

play14:30

Read it and write down every potential entity you see.

play14:34

I recommend phrasing entity names in the singular rather than the plural form, as in person

play14:41

rather than people.

play14:42

Okay, go hunt for those nouns; you have one minute, or for as long as you want to pause

play14:48

the video.

play14:53

Now let's go through it together.

play14:55

The first relevant noun is Child, or Student.

play14:58

The next one is Class.

play15:01

Now did anyone write down Year as a potential entity?

play15:04

I would agree with that, but for the last sentence, which says we do not need to track

play15:10

year-over-year history of each student, but rather only a snapshot of where each student

play15:15

is right now.

play15:18

After that we come to Teacher.

play15:21

And then behavioral incidents.

play15:24

If you think we should just store incident data in an open-ended notes field, we'll get

play15:29

more control by storing it in a separate table.

play15:32

Next, to notify the parents, we'll need to store parent or family contact details.

play15:39

Next, there are several classrooms, so that may be an entity.

play15:44

And then Pre-K and Kindergarten, which are grades.

play15:48

The last two sentences do not introduce any nouns that are not already on the list, so

play15:53

now we move on to inspecting our candidate entities more closely to determine which are

play15:58

entities, which are attributes, and which may be neither.

play16:04

The first potential entity is child or student.

play16:07

It is definitely an entity because there are many attributes that describe it.

play16:12

But should we call it child or student?

play16:14

Well, there is often more than one word that could be used for the same noun, so this is

play16:19

the time to decide what you want to call each entity.

play16:22

Eliminate all synonyms and choose entity names your whole team will understand and adopt.

play16:29

Let's go with student.

play16:30

Each student will need an ID, but what other attributes describe a student?

play16:35

First name, last name, date of birth, good.

play16:39

How are we going to keep track of which class a student is in?

play16:43

Well, Class is next on our list to consider.

play16:46

Is class an entity?

play16:48

Yes, a class has several attributes that describe it: an ID, a Title like Miss Johnson's Pre-K

play16:55

Class.

play16:57

And although that title makes clear both the teacher and the grade of that class, it would

play17:02

still be wise to store both the ID# of the teacher who teaches the class, and the ID#

play17:08

of the Grade of each class.

play17:11

I know we haven't even dealt with Teacher or Grade as candidate entities yet, but we

play17:17

will, and we probably know already that they are entities in and of themselves, as well

play17:21

as being attributes of the Class entity.

play17:25

The ID# of the room where a class is held would also be an attribute of each class.

play17:30

And now that we have Class as an entity, we can add Class ID as an attribute of Student.

play17:37

Anything else about Student?

play17:39

A student has a parent or family, which is on our list, so we will add a box for Family,

play17:45

with some attributes, and then add Family ID to the Student entity.

play17:52

And now we have dealt with Student, so we'll cross it off as managed.

play17:55

We have also managed Class and Parent/Family, so we can move on to teacher.

play18:05

Are there multiple attributes about a teacher?

play18:08

Yes, a teacher has a First name, a Last name, a Date of hire, a Phone number, and perhaps

play18:15

more.

play18:16

And we have already noted that Teacher ID is one of the attributes of a Class.

play18:23

Next up is incidents of good or bad behavior.

play18:26

I included this not to bring up any painful memories of your own childhood misdeeds, but

play18:31

because I thought it would give us another vantage point from which to consider an important

play18:35

strategy in data modeling, that of asking yourself "How many of those could relate to

play18:41

one of these?"

play18:42

In this case, "How many Incidents could any one Student have?"

play18:47

If it is many, then you should almost always make a table (or entity) for the many thing.

play18:55

There is a principle in database design: One fact, one field.

play19:00

That is, if you have a data value to store, store it in its own field.

play19:05

Don't store two facts in one field, or three facts in one field.

play19:09

One fact, one field.

play19:12

So to keep track of these incidents, we are not going to make a Notes field in the Student

play19:17

table and just keep a running text log for each student.

play19:20

We are going to create an Incident table, giving each incident a unique identifier value,

play19:26

along with the ID# of the student and the Date and Description of the incident.

play19:33

Let's move on to Classroom.

play19:35

You may think it over-complicates the system to create a table for something so simple

play19:39

as classroom, but I promise you, if we put in the extra effort to design the structure

play19:44

properly, it will save time and avoid frustration for the life of this database.

play19:49

I look at creating Classroom, or just Room as an entity as another victory in the fight

play19:56

against inconsistent and redundant data entry.

play19:59

Store it once, reference it many times, right?

play20:03

There is another benefit, too: if we ever rename a room in our school, we will only

play20:08

have to edit its name in one record of the database, and because we referred to that

play20:13

room in the related tables by its ID number, the name change will not break any relationships,

play20:21

and the new name will appear in place of the old name in all screens and reports.

play20:26

We'll want each room to have a descriptive Title, like Room A or Room 11, and the capacity,

play20:32

or number of students a room can accommodate, would be appropriate here.

play20:36

That takes care of Classroom, and we are almost done.

play20:39

Grade, like Room, is an attribute of Class, but since we may have many classes of the

play20:45

same grade, we do not want to store the grade name over and over, so we will put it in its

play20:51

own table with fields for ID and Title.

play20:56

Now that we have addressed all the nouns we found in the process description, we are well

play21:00

on our way to a complete Entity – Relationship Diagram, or ERD, which we will build in Part

play21:07

2 of this two-part series.

play21:09

See you there!

Rate This

5.0 / 5 (0 votes)

Связанные теги
Database DesignData ModelingBeginners GuideRelational DatabasesEntity-RelationshipData StructuresInformation TrackingDatabase PlanningNon-Technical UsersERD Tutorial
Вам нужно краткое изложение на английском?