WEBVTT

00:00:01.729 --> 00:00:04.369 align:middle line:84%
Now, what happens if you
want to sort or filter

00:00:04.369 --> 00:00:05.639 align:middle line:90%
or do other things?

00:00:05.639 --> 00:00:08.199 align:middle line:84%
So this is where
you can do ORDER BY.

00:00:08.199 --> 00:00:10.299 align:middle line:84%
And I'm going to show
you some examples here.

00:00:10.299 --> 00:00:12.819 align:middle line:84%
In the left, we
are saying, OK, we

00:00:12.819 --> 00:00:15.219 align:middle line:84%
want to ORDER BY
ZTIMESTAMP ascending.

00:00:15.219 --> 00:00:18.279 align:middle line:84%
We want to ORDER BY
ZTIMESTAMP ascending.

00:00:18.279 --> 00:00:20.589 align:middle line:84%
And we can see message
received, and then we

00:00:20.589 --> 00:00:22.889 align:middle line:90%
can see our timestamps.

00:00:22.889 --> 00:00:25.669 align:middle line:84%
So it's going to sort in
ascending or descending.

00:00:25.669 --> 00:00:27.834 align:middle line:84%
So you can change
asc to descending.

00:00:27.834 --> 00:00:29.209 align:middle line:84%
Something else
that's interesting

00:00:29.209 --> 00:00:32.479 align:middle line:84%
is, if you change the column
names, ZTIMESTAMP to Message

00:00:32.479 --> 00:00:34.189 align:middle line:84%
Received, you can
put that in quotes,

00:00:34.189 --> 00:00:37.469 align:middle line:84%
and it will still filter by
it, which is pretty awesome.

00:00:37.469 --> 00:00:39.739 align:middle line:84%
What happens if you
had to say where

00:00:39.739 --> 00:00:42.229 align:middle line:84%
a message contained
Heather or where

00:00:42.229 --> 00:00:45.679 align:middle line:90%
the date is like 1/1/2022.

00:00:45.679 --> 00:00:47.179 align:middle line:90%
You can do that.

00:00:47.179 --> 00:00:52.749 align:middle line:84%
So you say where, the column
of interest, like, single tick

00:00:52.749 --> 00:00:53.349 align:middle line:90%
quote--

00:00:53.349 --> 00:00:56.559 align:middle line:84%
or single tick parenthese,
the word or date,

00:00:56.559 --> 00:00:58.551 align:middle line:90%
parenthese single tick.

00:00:58.551 --> 00:01:00.009 align:middle line:84%
Now, I want to show
you how to know

00:01:00.009 --> 00:01:01.899 align:middle line:90%
if your wild cards are wrong.

00:01:01.899 --> 00:01:06.979 align:middle line:84%
So let's say we want to search
very similar to how I did oil.

00:01:06.979 --> 00:01:17.034 align:middle line:84%
So what we could do is
say, where "warning" like--

00:01:17.034 --> 00:01:19.409 align:middle line:84%
now I'm going to do this wrong
because I want to show you

00:01:19.409 --> 00:01:21.209 align:middle line:90%
what it looks like to be wrong.

00:01:21.209 --> 00:01:24.649 align:middle line:84%
Do you notice right away how
it's black font/red font?

00:01:24.649 --> 00:01:27.529 align:middle line:84%
If I change it, single take
parenthese, it's red/red.

00:01:27.529 --> 00:01:28.519 align:middle line:90%
That's what we want.

00:01:28.519 --> 00:01:31.959 align:middle line:84%
Oil-- and again, I'm
going to mess it up.

00:01:31.959 --> 00:01:34.119 align:middle line:84%
The black and the
red look weird--

00:01:34.119 --> 00:01:35.979 align:middle line:90%
Parenthese, single tick.

00:01:35.979 --> 00:01:39.969 align:middle line:84%
So you want to make sure
the color of the wild card

00:01:39.969 --> 00:01:40.524 align:middle line:90%
makes sense.

00:01:43.417 --> 00:01:45.709 align:middle line:84%
And then you can see it just
shows us those same things

00:01:45.709 --> 00:01:46.339 align:middle line:90%
I filtered for.

00:01:46.339 --> 00:01:49.006 align:middle line:84%
It's saying, hey,
there's oil or roadkill,

00:01:49.006 --> 00:01:50.089 align:middle line:90%
reporting oil on the road.

00:01:50.089 --> 00:01:51.631 align:middle line:84%
I have no idea what
this database is.

00:01:51.631 --> 00:01:54.379 align:middle line:84%
It's very strange,
but it looks like it's

00:01:54.379 --> 00:01:59.019 align:middle line:84%
doing something associated
with traffic reports.

00:01:59.019 --> 00:02:04.269 align:middle line:84%
If you wanted to clear
this, you could do Clear it.

00:02:04.269 --> 00:02:05.559 align:middle line:90%
Bring everything back.

00:02:05.559 --> 00:02:08.209 align:middle line:84%
Maybe you want to
filter by datetime.

00:02:08.209 --> 00:02:16.899 align:middle line:84%
So order by, "Update time"
descending or ascending--

00:02:16.899 --> 00:02:19.789 align:middle line:90%
boom, sorts it by that.

00:02:19.789 --> 00:02:23.979 align:middle line:84%
You could also do-- if you
wanted a specific date,

00:02:23.979 --> 00:02:44.129 align:middle line:84%
you could do where "update time"
like parentheses single tick.

00:02:44.129 --> 00:02:45.849 align:middle line:90%
So many things you can do.

00:02:45.849 --> 00:02:46.739 align:middle line:90%
You can do count.

00:02:46.739 --> 00:02:50.399 align:middle line:84%
There are so many things you
can do in SQLite, it's amazing.

00:02:50.399 --> 00:02:52.822 align:middle line:84%
If you mess up, or if you
want to keep practicing--

00:02:52.822 --> 00:02:54.239 align:middle line:84%
you're, like, OK,
that one worked,

00:02:54.239 --> 00:02:55.799 align:middle line:90%
but now I want to branch out.

00:02:55.799 --> 00:02:57.689 align:middle line:84%
Press this little
button right here,

00:02:57.689 --> 00:03:00.069 align:middle line:90%
and it brings you a new one.

00:03:00.069 --> 00:03:02.739 align:middle line:84%
So you can always keep
your old and go back.

00:03:02.739 --> 00:03:03.849 align:middle line:90%
You can keep it open.

00:03:03.849 --> 00:03:05.739 align:middle line:84%
What I do is, when
I have success,

00:03:05.739 --> 00:03:08.019 align:middle line:84%
I will save this
out to a text file.

00:03:08.019 --> 00:03:17.219 align:middle line:84%
And I would call this tts.db
Android Version 12 and Copy

00:03:17.219 --> 00:03:17.969 align:middle line:90%
and Paste this in.

00:03:17.969 --> 00:03:21.509 align:middle line:84%
And I have a whole text
repository of queries.

00:03:21.509 --> 00:03:23.709 align:middle line:90%
But this is just one example.

00:03:23.709 --> 00:03:26.069 align:middle line:84%
The more you practice,
the better you will get.
