I will call you back again to another video lecture in MySQL.
And in this video lecture, let's go ahead and look at order by clause.
So this is unlike clause in MySQL just like having a Where clause.
So we are going to have order by clause.
So this order by clause helps us to sort the order of a query either in descending order or ascending
order based on the column we are just listing.
So let's go ahead and use this students table, which we have written here.
And let's go ahead and say maybe what to select from select all from students.
And I want to check for the last name and I want to check this last name.
Then I'll go ahead and see what thereby you can see that is a keyword.
As I entered there it gave me order by because this is a keyword.
So let's go ahead and say last On this coil.
Name a semicolon at the end and this hit and run the query.
And now you can check.
The last name is Taylor from a, C, g, H, j, r, and s.
You see that?
And you can see that, uh, we have, uh, these where here.
The ID has changed because it did this based on ascending order.
So that is a default which is always there by ascending order.
So if you want to do that by descending or you need to do is to go ahead and put the s c.
And once you add this it means descending order.
Uh let's go ahead and run this and check it out.
So it's a query and check it out.
So we can see that we have started from here.
And the s then moved down to C.
So in this way you can either do the order will be ascending or descending order based on anyone.
So if you want to change this to ascending order it is to go ahead and say a, s c.
So you can see that that is a keyword.
And if I is a key cutest query.
It considered it has gone back to ascending order, but you don't actually need this because any time
you is a query, you go ahead and get that to be in ascending order, except you want to change that
to descending order.
So you can see that.
So by default it goes to a ascending order.
And that is the default.
So if you want to change that to descending order put just DSQ.
All right let's go ahead and check.
Maybe the let's check the first name.
And let's see first underscore name and press semicolon at the end and execute the query.
And you can see we have Barack then Mike, Oscar, Peter Queen Sarah and Zenda.
And that is it.
Now you can also check the GP okay.
Let's go ahead and check the GP and see how it's been arranged.
So GP and let's go ahead and check it out so we can see it's from one two, 3.5, 3.7, 3.8, 4.7 and
4.0.
So that is it.
That is the way it's arranged this.
You can also do that for the enrolled date.
So for the enrolled date, all you need to do is to go ahead and say enroll underscore dates and then
you execute the query and check it out so you can see it.
Now set it from 28 to 8 because that is the list and move down to 2099.
So you see it was able to reach that and ascending order.
And then you should check the department is also descending square and see departments.
And then you go ahead and execute the query and check it out.
So you can see that it's always arranged in ascending or descending order based on any one he wants.
And if you want to alter that, you go ahead and put uh, this and then execute the query and see your
query.
And that is it.
So it's a quick one and kind of pull it down.
But to set it and if you have any questions under these core head and 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.