Lesson video

In progress...

Loading...

Hello, my name is Mr. Davidson.

I'm so excited to be learning with you today.

Today's lesson is called "Planning a Branching Database" from the unit, "Organising Data Using Databases." Sometimes learning can be a little challenging, but that is great as it means we can really work hard together and learn lots of fabulous new things.

By the end of today's lesson, you are going to be able to plan the structure of a branching database.

There are two key words I want you to look out for today.

The first is plan, which is a design to show what something will look like in the future, and compare, which is where we find similarities and differences.

Look out for how we use those keywords in the lesson.

We'll have two parts to our lesson today.

Our first is where we're going to create questions to use in a branching database.

What we are going to do firstly is plan a dinosaur identifier using a branching tree diagram.

If we create our diagram correctly, we'll be able to identify a dinosaur that we need to find based on the diagram and the questions that we ask.

Our dinosaurs are going to look like this large group here.

There's a lot to consider, and we need to think carefully about creating equal groups so that we can identify each of the dinosaurs without having to ask lots of different questions.

So let's start and have a think about how you could organise these dinosaurs.

So what attributes could we use to compare the dinosaurs? It helps to pick one of the objects or one of the dinosaurs, in this case, a velociraptor.

We can see that the velociraptor is green in colour.

Its diet attribute is labelled as carnivore.

The habitat that it lives on is land, and its length is typically two metres.

The velociraptor has all of those attributes in that way.

Now, considering one gives us an idea of what attributes we could use, but we need to also consider how they're different.

If we take the spinosaurus, the pterodactyl, we should look and see what the differences are.

If we consider the colour, we can see that, that for that attribute of the dinosaurs, they are two different properties.

Similarly, the habitat is also different, and in addition to that, so is the length.

That means we can use those differences to identify them differently and make them appear in different groups of data based on those attributes and the differences between them.

We should also consider in the interest of grouping early on how those dinosaurs are similar.

Well, there's the similarity of diet.

They are both carnivores.

So in the same way we can use differences to create different groups, we can use similarities to group them.

So our dinosaur attributes can either be colour, and I've made a list there of all the different colours that they could possibly be.

Blue, green, grey, brown, purple, and red.

Another attribute might be diet, where they're either a herbivore or a carnivore.

We could look at the attribute of habitat and looking at the set of data, we can see they either live in land, air, or sea.

And lastly, the attribute of length.

Our range of length starts from the smallest of two metres through to the biggest of 26 metres.

Knowing what the spread of attributes are and what the possibilities could be, we can then start considering the questions we could use to identify those dinosaurs.

If we consider three different dinosaurs, we've got to think about questions we could use to identify them.

Is there anything there that could identify those three? So if I ask, is it a carnival, that will mean that two of the three are selected, leaving one unselected.

It's important to think about the answers as well as the questions.

So let's think about a question, and I want you to say whether you think this question is good to include in a branching database by saying true or false if you don't think it's a good question.

The question is, is it bigger than 12 metres? Which do you think that is, true or false? I'd say that's a good question, so it's true, but why do I think that? Well, we can definitely answer that question with a yes or a no answer.

That's the first thing we need to do when we plan questions for branching databases.

The smallest dinosaur is two metres, and the biggest is 26 metres.

So the question is relevant to the dinosaurs being identified.

Let's do the same again with another question.

This time, do you think this is a good question? Does it live in the air, on land or in sea? Do you think it's true that that is a good question for a branching database, or do you think it's false? Yes, I agree it's false, but why? Yes, good.

The question is relevant to the dinosaurs being identified, which is good, but you can't answer it with a yes or a no.

That's actually three options that the answers could be in that question, which is not good for our branching database that groups in yes or no based on the attributes.

So I'm gonna let you have a go at that now and start planning some questions.

I want you to write your own yes/no questions.

I've given you all of the attributes from before, colour, diet, habitat and length.

I've also given you some examples of question starters.

I've given you those because they end up giving you yes/no answers, which are very important in branching databases.

Now bear in mind you will have lots of different questions that won't be similar to other people.

That's absolutely fine.

What we're thinking about at the moment is the questions that we could ask, so it helps to have as many as possible.

Pause the video, have a go at those now, and I'll show you which questions I've come up with in a little while.

Well done.

We've got lots of different possible questions.

Let's see some examples.

Jun, he had an example of, "Is it blue?" That's a really good question with a yes or a no answer.

Jacob is saying, "Is it a herbivore?" Again, we've got a nice straightforward question with only one or two options.

Andy, his question is, "Does it live in the air?" Again, perfect, a yes/no question.

And Aisha, "Is it bigger than 14 metres?" Again, perfect.

Your dinosaur will either be more than 14 metres, or it'll be 14 metres or less.

Let's get straight on to the second part of the lesson today where we're gonna plan the structure of a branching database.

Now, we are going to plan our branching database.

We're gonna use that tree structure, remember, to arrange the questions into a branching tree diagram, and it should look like the example I'm gonna show you on the next slide, but hopefully you'll put more questions in and maybe even more dinosaurs.

So in my example, I started at the root of the diagram with, is it grey? Nice, question is yes or no, and it gives us two possible paths, which gives us two possible groups.

There will be two dinosaurs, if I ask that, that are grey, and we can see that on the diagram on the left-hand side.

The ones that aren't grey where we follow the no branch, you can see again are on the right-hand side.

If I look at the left-hand side group as well, I can take those two dinosaurs and ask a second question about the attributes.

So I've chosen the attribute about, it flies.

In that group, there is only one dinosaur that does fly, and I put that under the yes heading.

The other dinosaur that was grey that doesn't fly, I've put in the no branch.

So we can see there that the left-hand side of the diagram works really well.

We have two questions at two different attributes to get dinosaurs to those groups.

On the right-hand side where we say, is it grey, there were two dinosaurs that aren't grey from our group of four.

We then ask a follow-up question, is it a carnivore, where we've got a yes and a no branch, and then we can see there the correct dinosaur is under the correct answer.

Our branching diagram works really well.

So there are gonna be 10 dinosaurs that you need to use.

I'm gonna show you those on the next slide.

You can use the same question more than once if needed.

It's better if you don't, but sometimes you might have to ask follow up questions that's similar to other questions.

Quite often they exist down different branches.

So we have our 10 dinosaurs and have listed all the attributes and what they are for those particular dinosaurs.

Just before you get started, let's just check, is it true that you cannot use the same question more than once in a branching database? Well done, that's false, and remember why that is.

We can use the same question more than once as you have a question that might be useful on both sides of the branching tree diagram.

Also, let's think about that in a little bit more detail.

Which of the following would be the most suitable first question to sort the cards.

Do you think it's A, is the dinosaur blue, B, is the dinosaur a carnival, or C, does the dinosaur have wings? What do You think? The correct answer is B, is the dinosaur a carnivore? If we look, we can see that there are only two options, carnivore and herbivore.

If we ask that as our first question, remember that we want to create equal groups, and because there's a nice equal split between them, we'll be able to create equal groups from that.

The other options such as is the dinosaur blue, well, unfortunately there is only one blue dinosaur.

If we use that as a first question, we're going to end up with a group of one and a group of five.

Similarly, does the dinosaur have wings? Well, in that one, I can only see one, and again, that's not good.

We want to make sure we get as equal groups as possible, but it might not always be possible to get an exact split.

So we would say B is a good one because questions A and C would not create an even split of dinosaurs.

So you're gonna create your groups.

You can think about the questions.

It helps if you can print some of these out and cut them and separate them and move them around.

You might change your mind quite often.

So it helps if you can move some of these around as you go along.

So for this second task today, I want you to create a question that will organise the dinosaurs into two roughly equal groups based on a common attribute.

Remember, if we do that at the start, it makes it easier later on, and it prevents our branching database becoming lopsided and long on one particular side.

Then I want you to create more questions to split the groups again.

At each point, try as far as possible to keep equal groupings from the answers.

It will make the tree diagram a lot easier to follow and mean that you ask less questions.

Then once you're done with that, I want you to think about what you've done.

It's really helpful if you can explain to someone else how you've structured your database and justify the choices you've made.

Sometimes when you end up justifying something and explaining what you've done, you spot that you might have made a mistake.

If that happens, don't worry about it, and feel free to go back and change.

Pause the video and think carefully about that.

When you come back, I'll show you how I've organised them into groups.

Well done, you worked really hard on that.

If we look at an example, Aisha's created this structure.

She started with, is it a carnival, which obviously gives a yes/no answer, which allows us to create groups.

We discussed before that there were different options, and in this one we've actually got three options, carnivore, omnivore, and herbivore.

However, you'll notice that there are four carnivores and four either omnivores or herbivores.

So by asking that question in that way, we create equal groups of four.

So a perfect starting answer.

If we take the carnivores and split them again, the second question Aisha came up with was, is it green? That was a great question to ask, because of the carnivores, two of the dinosaurs were green.

If we look at those two green dinosaurs as well, the third question she asked was, is it longer than nine metres? That was a great question to ask because it had one dinosaur that was two metres and one that was 15.

So we split them into even groups again, and I think that's the best way that we can get to those dinosaurs.

If we just go back up the diagram to, is it green, and we look at the ones that weren't green that were carnivores, one had wings, one didn't.

So Aisha's done really well and said, does it have wings, knowing that they would split evenly.

Aisha then carried on.

She thought about the group where they weren't carnivores.

Now remember I said that omnivores and herbivores will end up in that group.

She then asked, does it have arms? Two of the four did, and that meant that two of the four didn't.

Again, two equal groups.

Now, think back to when I said about not being a carnivore.

We could reuse part of that in a different way.

So we're asking a similar question, but changing what we're asking, knowing that the differences will allow us to split the groups more.

So the last question, is it an omnivore, finally gives us dinosaurs that are not carnivores that do have arms. One is an omnivore, one is not.

That left the last group of non-carnivores and those dinosaurs that don't have arms, one was blue, one was purple.

We could have asked either question.

She's chosen, is it blue? And then we end up with the dinosaur there with the one that isn't blue in another group entirely.

A really good answer.

You may have done it entirely differently, but you're trying to get those three levels of the diagram.

That will be the best way to organise those eight different dinosaurs.

Remember, I wanted you to explain why you designed it in the way that you had.

Aisha's telling us that she decided it on an initial question and then chose four dinosaurs that had the attribute and four that didn't, so she could get started with that, which was the exact right thing to do.

She then used the different attributes to organise the dinosaurs as she moved down the tree structure.

For one of her questions, she referenced what the dinosaur looked like rather than the written attributes.

She asked, does it have wings? On reflection, she probably thinks she could have asked, does it live in the air, instead.

But she realises it would've had the same outcome anyway.

Well done.

You had to be really organised with all of that today.

Let's just recap what we've learned.

We learned that branching database structures should be planned to ensure groups are split evenly to create a logical tree structure.

We also saw that a series of questions can be used to identify a unique object.

Remember that objects can be compared using attributes, and that an attribute is a feature of an object like its colour, size, whatever it eats.

If we are careful, methodical, and plan correctly, we can create a great branching database structure, but we also know when we're planning, we might have to move things around.

We might have to change what we've done.

That's a really good idea to do, and you should encourage yourself to do it more often when you are doing computing work.