I will come back to module to databases. This is lesson to skim a design. And this is the last sub lesson in skim A design which is defining the many too many relationship using the diagramming software. So in this lesson, we will discuss so many too many relations relationship. And in the previous lessons we had looked at implementing a
1 to 1 and a one too many,
and this lesson, we're gonna pretend that employees can have multiple jobs and that a job can be assigned multiple employees.
So let's go ahead and get started with that. So I'm gonna right click on the software. The diagram software area. A select table.
We're going to drag this back down on the first table I'm going to create is the job table.
So I'm just gonna call it jobs.
comes good. Call it. I d
I'm gonna make that an imager. Gonna say that's a primary key and in increments.
And then I'm gonna add another field. I'm gonna call it a job. Job name
Gonna make that of our char
on. We're going to save. We're gonna turn off auto increment. That won't work for us.
next I'm gonna add a field, and we're just going to, ah,
So the building that the job occurs in
and we don't leave that as 34 Bar char again.
so and realistically on these tables, you probably have many more fields,
and we'll get into some of those fields further on in this Siri's. But for now, we're just gonna have a very simple job stable.
Now we need to add our pivot table.
Now, remember, the pivot table is a combination of
to one too many relationships that, when combined, create the many too many relationship.
So let's go then, right click again in the area, Select table,
and we're gonna title this one.
I am underscored jobs.
We're gonna save that.
We're gonna add a field.
We're going to call this field. The
employee I D or amp. Underscore idea
were indicate that that is an imager,
and we're going to leave that alone right now. And we're gonna add another field.
We call this one the job I d
job underscore. I d.
I can make it an energy er
and then on the impiety, we're going to
indicate that this is a foreign key
and it's on the employees table
with a reference field of I D, which is correct. So we're not going an upgrade. Update that,
And then we're gonna select the pencil for the job i d.
And we're going to say that this is a flooring key
And again, the reference field. His idea. We'll update that.
And there we have it. We have our pivot table,
table being referenced by the amp. Underscored jobs
with an EMP i D. And a job idea.
So, for example, in this table, we could say that we had a job of one that was maybe, I don't know, programmer.
And in this employees table, we had an employee with the idea of
to, which was, say is me Maybe Kit Parker so and the pivot table. We might see the EMP i d. Of two with a job idea of one, and we would know that followed by following this relationship that that was Kim Parker and he works as a programmer.
And then again, we could have another entry in there where I mentioned again
with a different job, I d, which would then indicate that I had multiple jobs on then. Also, that programmer job could be assigned to multiple employees because it is common for companies to have,
you know, many programmers working for them.
And that completes this lesson. That was the many too many relationship. I hope you got that working. I hope you see how that works. And in the next lesson, three will be going over the basic administration off
databases, and I hope to see you there. Thank you.