WEBVTT

00:00.120 --> 00:02.660
Moving on along to our next topic.

00:02.820 --> 00:03.760
Yes that's OK.

00:03.780 --> 00:06.760
Moving on along I'll keep using that.

00:06.930 --> 00:09.690
Our next topic here is ORDER BY.

00:09.690 --> 00:14.820
So as the subtitle tells you it's how we can sort our results which is something that we all want to

00:14.820 --> 00:15.240
do.

00:15.240 --> 00:18.700
Hopefully you see why that's useful when you're trying to understand things.

00:18.720 --> 00:20.570
It's good to be able to sort your data.

00:20.700 --> 00:24.780
So with our books for instance right now we're getting them all in the order that they were inserted

00:24.780 --> 00:31.350
in and maybe we want to do things like find the best selling books or the worst selling books or find

00:31.350 --> 00:35.270
the most active users on our Web site at least active users or something similar.

00:35.280 --> 00:40.260
Find the most uploaded posts or the post that has the most comments on our blog or whatever we're working

00:40.260 --> 00:40.770
with.

00:40.770 --> 00:42.730
It's important to be able to sort things.

00:42.810 --> 00:46.100
And again the way we do that is by using ORDER BY.

00:46.440 --> 00:48.360
So let's take a look at an example.

00:48.840 --> 00:53.830
Here's a query that's going to select all the author last names from books.

00:53.970 --> 00:56.610
So up until this point nothing is new.

00:56.610 --> 00:59.400
So like the author last name from book books.

00:59.730 --> 01:02.670
But after that we add on this little thing.

01:02.670 --> 01:04.380
Order space by.

01:04.410 --> 01:07.280
That's something that trips me up by the way that there is a space.

01:07.350 --> 01:11.250
Sometimes it feels like it should be one word or there should be an underscore but there is a space

01:11.610 --> 01:17.580
or space by and then what do we want to order it by by the last name.

01:17.580 --> 01:18.990
So let me show you if you.
