I welcome you back again to another video lecture in MySQL.
And in this video lecture we go ahead and look at functions in MySQL.
So MySQL we have some functions that are available.
And let's go ahead and take a look at uh this uh stuff right in here.
So under here under MySQL workbench we can see that we have some of these uh functions available.
But as a beginner, if you begin to go through these functions, you might get lost.
All right.
So we're going to implement some of them.
Then you can check out more on the documentations and read them the reader for you to always check out.
Now we have the student table we created at the beginning of this course.
And it's still right in there with us.
So you can see the student table right in here we have the student ID, we have the firstName, we have
the last name, the GPA and enroll date.
Let's go ahead and say we want to concatenate the first name and last name.
I want to join first name and last name.
What I'm going to do is go ahead and select and I will have a function called concat.
So the concat function will help us to actually concat this.
Now let's go ahead and go right in here and specify that we want to the first underscore name.
And I'll put a comma and then last underscore name.
So these are the two we want to concatenate.
And we identify the table known as students.
All right so a semicolon at the end.
And let's go ahead and execute this query.
So you can see we have our the first name and last name joined together.
And it is not looking good at all.
So let's go ahead and give a nickname to these, because we have this name right in the first name and
last name.
You see that.
So let's go ahead and give it a nickname.
So I'm going to say s full underscore name.
All right.
So that is what I want to get.
The nickname is full name.
Go ahead and execute this code again.
And you can see that it has changed to full name.
But there is one thing that is still remaining.
You can see that I have the first name and last name joined together to do Oscar, and nobody knows
that these are different names.
So what I'm going to do is we'll go to move right inside the concat function, and we're going to add
this.
So space is a character in even programming and even on database design.
So go inside the double quotation mark and give a space.
And let's go ahead and execute this query.
So you can see that Peter Jude has been separated.
And I should continue to give a space.
Let's say I give three presses and I execute this query.
You can see that we have enough space right in here.
So first name is not different from the last name.
And you can see that boldly right in there.
So this is just one of the functions that we have.
Let's go ahead and calculate let's say the GP.
Let's go ahead and say I have different GP and want to know how many GP a day.
And let's calculate the number of GP that is there.
So I'll go over here and first of all say check out this query and we have seven 1 to 7.
So how come we are we to do that.
Let's go ahead I use what is called a count function.
So I'll go ahead and say count and I'll ahead and pass in the GP right in there.
So go ahead and execute this query.
And we have seven and that is count GP.
You can also give that a nickname.
So we can go ahead and say uh this is a as saw students underscore GP or number of GP.
Go ahead and say this is as then you go ahead and remove this and this is Non-vowel GP and go ahead
and check it out.
Number GP or student GP or anything.
All right.
So count is another function in MySQL.
We have other functions.
Again we can actually use.
And before we go ahead I will also let you know that whenever I want to give a nickname, you can also
go ahead and give that as a string.
So go ahead and pass a string data type.
And I can name this to be students GP.
And if I run this check it out students GP and this looks a little bit better off.
Can you see that student GP and that is seven.
All right.
So you can name that give it a nickname or go ahead and put the nickname in a string format.
And it used to work out fine.
Hi.
And now let's go ahead and check out the GP racing the Maximo of the GP.
Go ahead and put in max function and then you can name this to be maximum GP.
All right.
So maximum GP and go ahead and execute the query and have maximum GP to be 4.800.
In that way we can also check for minimum GP by putting a mean.
And then we go ahead and change this to be the minimum.
So go ahead and execute this query and you have the minimum GP to be 1.0.
You see that.
So that is really very good.
Now you can check the average of the GP.
This guy has to say the average of the GP is going to be Avg.
And we go ahead and change this to average GP and go ahead and execute the query and check it out.
So the average is 3.485.
We also have a sum you can actually sum all the OD GP, and I don't know if that is actually being used
in schools.
Go ahead and say the song and we'll go ahead and say addition.
Or LGBT.
Okay.
Let's say add GP and go ahead and execute the query.
And you have GP to be equal to 2.400.
Okay.
24.400.
That is what it is.
So these are some of the basic functions we use in MySQL.
So go ahead and practice them.
You can check out the MySQL documentation to play around with them and try out other uh functions.
And there are many more functions out there to check out.
So this is just the basics for now for beginners.
And uh, I hope you start from here and you move on.
Thank you so much.
And I'm going to see you in the next video lecture.