WEBVTT

00:07.760 --> 00:10.370
I will call you back again to another video lecture in MySQL.

00:10.370 --> 00:14.810
And in this video lecture, let's go ahead and look at order by clause.

00:14.810 --> 00:18.740
So this is unlike clause in MySQL just like having a Where clause.

00:18.740 --> 00:21.380
So we are going to have order by clause.

00:21.380 --> 00:27.860
So this order by clause helps us to sort the order of a query either in descending order or ascending

00:27.860 --> 00:32.210
order based on the column we are just listing.

00:32.210 --> 00:37.490
So let's go ahead and use this students table, which we have written here.

00:37.490 --> 00:46.670
And let's go ahead and say maybe what to select from select all from students.

00:46.670 --> 00:52.340
And I want to check for the last name and I want to check this last name.

00:52.340 --> 00:57.590
Then I'll go ahead and see what thereby you can see that is a keyword.

00:57.620 --> 01:02.960
As I entered there it gave me order by because this is a keyword.

01:02.960 --> 01:08.060
So let's go ahead and say last On this coil.

01:08.090 --> 01:14.330
Name a semicolon at the end and this hit and run the query.

01:14.330 --> 01:15.590
And now you can check.

01:15.590 --> 01:22.220
The last name is Taylor from a, C, g, H, j, r, and s.

01:22.790 --> 01:23.510
You see that?

01:23.510 --> 01:28.430
And you can see that, uh, we have, uh, these where here.

01:28.940 --> 01:34.400
The ID has changed because it did this based on ascending order.

01:34.400 --> 01:36.920
So that is a default which is always there by ascending order.

01:36.920 --> 01:43.430
So if you want to do that by descending or you need to do is to go ahead and put the s c.

01:43.460 --> 01:47.150
And once you add this it means descending order.

01:47.240 --> 01:49.040
Uh let's go ahead and run this and check it out.

01:49.040 --> 01:51.620
So it's a query and check it out.

01:51.620 --> 01:54.890
So we can see that we have started from here.

01:54.890 --> 01:59.150
And the s then moved down to C.

01:59.150 --> 02:05.780
So in this way you can either do the order will be ascending or descending order based on anyone.

02:05.780 --> 02:10.880
So if you want to change this to ascending order it is to go ahead and say a, s c.

02:10.910 --> 02:12.500
So you can see that that is a keyword.

02:12.500 --> 02:14.910
And if I is a key cutest query.

02:14.940 --> 02:20.070
It considered it has gone back to ascending order, but you don't actually need this because any time

02:20.070 --> 02:26.880
you is a query, you go ahead and get that to be in ascending order, except you want to change that

02:26.880 --> 02:28.080
to descending order.

02:28.080 --> 02:29.100
So you can see that.

02:29.100 --> 02:33.030
So by default it goes to a ascending order.

02:33.030 --> 02:34.650
And that is the default.

02:34.650 --> 02:38.610
So if you want to change that to descending order put just DSQ.

02:39.150 --> 02:40.380
All right let's go ahead and check.

02:40.380 --> 02:44.280
Maybe the let's check the first name.

02:44.280 --> 02:50.190
And let's see first underscore name and press semicolon at the end and execute the query.

02:50.190 --> 02:56.670
And you can see we have Barack then Mike, Oscar, Peter Queen Sarah and Zenda.

02:56.670 --> 02:57.720
And that is it.

02:57.750 --> 03:00.690
Now you can also check the GP okay.

03:00.720 --> 03:04.350
Let's go ahead and check the GP and see how it's been arranged.

03:04.350 --> 03:15.090
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

03:15.300 --> 03:16.890
4.0.

03:16.890 --> 03:17.670
So that is it.

03:17.670 --> 03:19.830
That is the way it's arranged this.

03:20.280 --> 03:22.860
You can also do that for the enrolled date.

03:22.890 --> 03:28.590
So for the enrolled date, all you need to do is to go ahead and say enroll underscore dates and then

03:28.620 --> 03:32.010
you execute the query and check it out so you can see it.

03:32.010 --> 03:38.370
Now set it from 28 to 8 because that is the list and move down to 2099.

03:38.730 --> 03:41.970
So you see it was able to reach that and ascending order.

03:42.060 --> 03:47.940
And then you should check the department is also descending square and see departments.

03:47.940 --> 03:51.150
And then you go ahead and execute the query and check it out.

03:51.150 --> 03:57.090
So you can see that it's always arranged in ascending or descending order based on any one he wants.

03:57.090 --> 04:03.480
And if you want to alter that, you go ahead and put uh, this and then execute the query and see your

04:03.480 --> 04:03.870
query.

04:03.870 --> 04:04.890
And that is it.

04:05.490 --> 04:07.740
So it's a quick one and kind of pull it down.

04:07.740 --> 04:12.030
But to set it and if you have any questions under these core head and use the question and answer section.

04:12.030 --> 04:14.610
And I'm going to get back to you as soon as possible.

04:14.640 --> 04:15.600
Thank you so much.

04:15.600 --> 04:18.570
And I'm going to see you in the next video lecture.
