I will call you back again tonight after the lecture in Moscow.
And in this video lecture.
Let's go ahead and look at index and MySQL.
So index is known as a B-tree data structure.
And it is used to find values within a specific column easily and fast because MySQL actually searches
the data sequentially through a column.
So this is going to be a quick lecture because we don't have a very large list.
So this is just a few of our just like seven rows under here.
So it's going to be a quick one.
But it's very important if you are dealing with a very large set of data.
So imagine you have like millions of these employees and we have just several right here.
So that is why you're not going to take much time.
So that's why I don't show the current index of our table.
So to show the current index of this table we go ahead and say show index six.
So should index six from then employees.
So place semicolon and go ahead and run this race.
Check it out.
And now we can see we have this uh index curl.
And now you can see it is a B3 or B3 and all new colors and is visible.
And now.
That is the supervisor of the index is home.
And the first name is key.
You can see the key name is first name.
And the column name is first name.
The coalition is a and the cardinality is six.
Oh and now let's go ahead and create index for this first name.
That is it.
Right in here you can actually create index.
And if you help us to actually speed up the search of our database.
But one thing is that the database we have is just a smaller database.
So the search might not be that visible to you because it's just seven rows.
But if you have millions of it, it's going to make more sense to us.
So that's why I said it's going to be a quick lecture.
Now let's go ahead and create index for the first name.
So go ahead and remove this and I'll go ahead and say create index.
And uh for the first name.
So first underscore name.
So that is going to be the name of the index.
So we just created the first underscore index on employee.
So employees and the index want to create this for the column this column called first name.
So go ahead and insert that first underscore name and go ahead and put a semicolon at the end of this.
Go ahead and execute this query.
And you can see that our index is created.
So now let's go ahead and show this index that we just created.
So I'll go ahead and say show index six show index six.
So from the employees table so employees for a semicolon at end.
And let's go ahead.
And as a kid that so you can see we have our employees one and the index that we just created which
is first underscore name underscore ADX.
And I can see it sequentially.
And uh that is it right here.
Now if you go ahead and uh check out we want to search your table.
So let's go ahead and say you want to search the employee table by the first name, which you have us
to speed our search for a name under employee, maybe Peter, Mark, global, Steve, Michael or anyone.
You go ahead and say select uh, all from the employee.
And then we go ahead and we are close.
So we are the first underscore name is equal to.
Let me go ahead and say press semicolon.
So you can go ahead and insert in maybe George anyone.
So let me say George and go ahead and check it out.
And uh, this is George.
Now you might not make sense to us.
That is why I said that, uh, this is a smaller table, and the search is very fast because we're not
dealing with a large set of data, but we are dealing with a large set of data like millions of that.
And imagine companies that have like six millions, uh, maybe students and so on.
And you are trying to create the database.
The index will actually help you to do it, to be fast.
All right.
But because you have a smaller database which you are using in this lecture, the search is always fast
and you might not actually see the results.
So this is about indexing.
We're not going to talk much on that because I dealt with like a small data set here.
But you can go deep into that and check more about it.
So for now we're going to stop at index.
And uh you go ahead and look more into that with large data set and see what it gives you.
So at the end that is it for now.
So go ahead and check it out.
Done with it.
And if you have any questions please use the question and answer section.
And I'm going to get back to you as soon as possible.
Thank you so much.
And I'm going to see you in the next video lecture.