WEBVTT

00:07.730 --> 00:10.670
I will call you back again to another lecture in MySQL.

00:10.670 --> 00:15.740
And in this video lecture let's go ahead and look at wildcard characters.

00:15.740 --> 00:19.910
So in MySQL we have the percentage and we have the underscore.

00:19.910 --> 00:27.740
And both of these characters helps us a lot in order to do some important job in our queries.

00:27.740 --> 00:35.480
So in MySQL you want to be able to find maybe a specific character or a character that started with

00:35.480 --> 00:37.820
a this or that.

00:37.850 --> 00:40.610
Then you go ahead and use the wildcard characters.

00:40.610 --> 00:46.370
So the wildcard characters helps us to substitute one or more characters in a string.

00:46.610 --> 00:46.910
All right.

00:46.910 --> 00:50.780
So I'm using the word characters and most of us will be like, what is going on?

00:50.780 --> 00:51.770
What is happening?

00:51.800 --> 00:54.710
Let's go ahead and give an example of this.

00:54.740 --> 00:58.790
Let me say I want to check the first name or the last name.

00:58.790 --> 01:01.790
Then I want the name that started with P.

01:01.820 --> 01:10.240
Every name that does similar with P or names that start with A or B, S, m, Q, or z for the first

01:10.270 --> 01:11.650
name or for the last name.

01:11.650 --> 01:18.040
I want the names that started with a, j, C, R, S, or g.

01:18.190 --> 01:20.560
Now how can you be able to do this?

01:20.560 --> 01:26.830
So I know as a beginner you might be like, okay, I can be able to select that maybe row and say select

01:26.830 --> 01:29.710
all from your students table.

01:30.640 --> 01:30.940
But why?

01:30.940 --> 01:32.770
So at this point just t correct.

01:32.800 --> 01:34.210
Then let's move ahead and check it out.

01:34.240 --> 01:37.000
Now let's add a Y or a week class.

01:37.000 --> 01:41.800
And most of us would be like okay, let's go here and see where the first name or the last name is the

01:41.800 --> 01:43.030
one you want to check out.

01:43.060 --> 01:47.440
Maybe the first name is equal and let me see.

01:47.470 --> 01:51.760
Want to check for the one that starts with Z.

01:51.790 --> 01:54.850
So if I go ahead and insert Z right in there.

01:54.880 --> 02:00.340
So if you ever do that it means that you want to return nothing.

02:00.400 --> 02:01.360
Let's go ahead and check that out.

02:01.360 --> 02:01.540
No.

02:01.540 --> 02:07.770
If something would be printed out for us Now, if I execute the query and you can see the tables are

02:07.770 --> 02:08.310
empty.

02:08.340 --> 02:09.300
Why?

02:09.690 --> 02:14.490
Now what you need to do is when you're using the white characters, you don't use the equal sign.

02:14.490 --> 02:17.760
You use what is called the keyword known as like.

02:18.000 --> 02:25.860
And when you use like, then you go ahead and use one of these characters, the percentage or the underscore.

02:25.860 --> 02:33.780
And if you want to get the names that started with Z, you go ahead and use the percentage.

02:33.780 --> 02:41.130
So and because we want to understand with Z and not the one that ends with Z, go ahead and put the

02:41.130 --> 02:43.080
percentage at the back.

02:43.080 --> 02:47.430
Because if z comes first, it will return the one that started with z.

02:47.460 --> 02:51.840
What is z comes last, it will return the one that starts with that ends with z.

02:51.870 --> 02:53.010
Go ahead and check it out.

02:53.640 --> 02:58.440
So I have gender and you can see Z started with a z.

02:58.740 --> 03:02.610
And let's go ahead and check out maybe Peter.

03:02.610 --> 03:06.420
And let's go ahead and run this and check it out Peter.

03:06.440 --> 03:09.440
know if I want to check out.

03:09.470 --> 03:13.760
Maybe I want the one that stay with R if I run this.

03:13.790 --> 03:16.580
Let's go ahead and put R here and check out this.

03:16.610 --> 03:22.340
We don't have any first name associated with R, but let's go ahead and place this R at the back of

03:22.340 --> 03:28.220
this and check out what we need to get now is the ones that ends with R.

03:28.220 --> 03:31.760
So it's going to be the one that ends and no one hit wonder status.

03:31.760 --> 03:36.140
So if your R goes at the back of the percentage it means one at ends.

03:36.140 --> 03:40.040
But if the R comes in the front, it means the one that started with R.

03:40.070 --> 03:42.950
But now I want to check for the ones that ends with R.

03:42.980 --> 03:45.230
Then go ahead and run this and check it out.

03:45.410 --> 03:49.790
We have pizza, Oscar and Lucinda in that same way.

03:49.820 --> 03:58.550
I'll go ahead and change this to last name and let's check if we have last name that ends with R, and

03:58.550 --> 03:59.870
go ahead and execute this query.

03:59.900 --> 04:01.040
We don't have anyone.

04:01.070 --> 04:07.070
Well let's go ahead and change that to E and check if we have last name that ends with R.

04:07.670 --> 04:08.990
And this is the cutest query.

04:09.040 --> 04:09.580
we have.

04:09.610 --> 04:11.470
Jude and Grace.

04:12.190 --> 04:17.920
Now let's go ahead and, uh, place this, uh, right in here.

04:17.950 --> 04:21.640
I don't even know if we have the first name that started with E.

04:21.820 --> 04:23.290
The last name does start with E.

04:23.440 --> 04:24.280
I have to check.

04:24.310 --> 04:25.660
We don't have anyone.

04:25.660 --> 04:30.790
Well, let's go ahead and put that something like H because I believe we have H and check out this.

04:30.790 --> 04:32.650
So we have last name.

04:32.680 --> 04:33.400
Hillary.

04:33.430 --> 04:34.840
Hillary center with H.

04:34.870 --> 04:37.810
What if we go back and place this at the back?

04:37.840 --> 04:41.350
It means we're looking for the last name that ends with H.

04:41.380 --> 04:43.120
Go ahead and check it out.

04:43.150 --> 04:44.620
We have Smith.

04:44.650 --> 04:47.080
So Smith ends with H.

04:47.110 --> 04:50.740
So it is in a way it's a wild card in MySQL.

04:50.740 --> 04:53.920
And uh I hope that is very, very cool.

04:53.950 --> 04:58.330
Now what if we go ahead and add more characters.

04:58.360 --> 04:59.500
Let's go ahead and see.

04:59.500 --> 05:05.020
We want the one, maybe the last name that started with, uh, p a.

05:05.170 --> 05:05.950
I don't even know.

05:05.980 --> 05:07.120
What if we have that?

05:07.150 --> 05:08.770
Let's go ahead and check this out.

05:08.980 --> 05:10.240
We don't ever have that.

05:10.270 --> 05:12.270
But let's say we have James G.

05:12.360 --> 05:14.250
So let's go ahead and check it out.

05:14.880 --> 05:22.950
So oh we don't have anyone that started with a let's go ahead and show our table again so we can start

05:22.950 --> 05:23.670
from there.

05:23.700 --> 05:24.060
Okay.

05:24.060 --> 05:25.710
We have Jude and not James.

05:25.710 --> 05:27.690
So go ahead and place this back again.

05:27.690 --> 05:29.760
And let's go ahead and change this to Jew.

05:29.760 --> 05:31.200
And let's check it out.

05:31.200 --> 05:32.340
So we have Jude.

05:32.340 --> 05:35.670
And Jude starts with a j u.

05:35.670 --> 05:37.410
So now we can add more.

05:37.410 --> 05:39.810
And that go ahead and print out for you.

05:40.230 --> 05:40.620
All right.

05:40.620 --> 05:48.210
Let's go ahead and check in Roman dates that enroll within 2092 or 2091.

05:48.210 --> 05:54.150
What we need to do is go over here and change this last name and change the last name a while and see

05:54.930 --> 05:57.420
a row underscore date.

05:57.810 --> 06:06.480
Uh, I want to leave the percentage, and I'm going to say this is a 2092 and go ahead and check it

06:06.480 --> 06:07.080
out.

06:07.320 --> 06:12.330
So Oscar enrolled in 2092 out of 2091.

06:12.360 --> 06:13.610
Go ahead and check it out.

06:14.690 --> 06:20.240
So we have a Barack and Sarah in row in 2091.

06:20.240 --> 06:22.610
So this is the way you use the white cat character.

06:22.610 --> 06:27.500
So there's another character that is remaining and that is the underscore the underscore white character

06:27.530 --> 06:30.710
we use to return any random character.

06:30.710 --> 06:35.780
So let's go ahead and find any department with random character length.

06:35.780 --> 06:38.540
So number here and see where department.

06:38.540 --> 06:40.790
So I'm going to use the underscore right now.

06:42.200 --> 06:52.580
So department and uh go right in here and see underscore then length.

06:52.610 --> 06:58.160
Then let's go ahead and execute this query and check if that will get anything for us.

06:58.160 --> 07:04.730
And then what happens here is we have electrical we have electronics.

07:04.760 --> 07:05.360
All right.

07:05.360 --> 07:11.930
So all I need to do is I'll go over and let's say maybe electronics.

07:11.990 --> 07:12.620
All right.

07:12.650 --> 07:14.870
Now go ahead and execute this query.

07:15.140 --> 07:16.490
and the electronics.

07:16.490 --> 07:22.190
So if you want to remove the last one, because the reason why I removed it is that you're going to

07:22.190 --> 07:26.300
replace the ones you didn't show with white characters on the score.

07:26.330 --> 07:33.740
Let's go ahead and say, if I want to just show this, I'm going to say I will have a one, two, three,

07:33.740 --> 07:35.030
four, five, six.

07:35.030 --> 07:41.510
So I'm going to replace these six characters with underscore, say one, two, three, four, five,

07:41.510 --> 07:41.990
six.

07:41.990 --> 07:44.510
Then go ahead and execute this query and check it out.

07:44.870 --> 07:45.740
Electronics.

07:45.740 --> 07:54.440
So if I remove one of it and run this code I have electric car because the electric car is five after

07:54.590 --> 07:55.820
after the length.

07:55.880 --> 08:01.190
So this is how this works because I want to take it one step at a time if I want to check out.

08:01.190 --> 08:05.480
So go ahead and say I want maybe Silverstone I will see.

08:05.510 --> 08:08.750
I'm going to say s underscore.

08:08.780 --> 08:14.300
The first underscore is for C and the second underscore is for I, then VI.

08:14.510 --> 08:17.470
Then if I should run this code let's go ahead and check it out.

08:17.800 --> 08:18.670
Civil.

08:18.880 --> 08:21.550
Then if I should remove l I have to replace that with.

08:21.580 --> 08:23.890
Underscore in order to get civil.

08:23.920 --> 08:25.960
What if I should remove the L?

08:25.990 --> 08:27.490
I'm not going to get anything.

08:27.520 --> 08:28.390
Check it out.

08:28.630 --> 08:30.820
So this is the way you use the underscore.

08:30.850 --> 08:38.140
You're going to also always replace any of the values which you don't want to show with underscore in

08:38.140 --> 08:39.040
order to get that.

08:39.070 --> 08:41.410
Let's go ahead and check in raw date.

08:42.460 --> 08:52.000
So in raw underscore date maybe I want to check out maybe people that enroll on November.

08:52.000 --> 09:01.480
So I'm going to check out the EDA is going to be four characters 2019 or 2018 is A1234.

09:01.510 --> 09:04.330
Then I want to check the error in November.

09:04.480 --> 09:11.290
And I don't want to mind the date they got on the president to underscore one two.

09:11.320 --> 09:13.780
Then go ahead and run this code and check it out.

09:14.080 --> 09:17.830
So now I got the people that enrolled in November and I can see that.

09:17.830 --> 09:26.460
So I have replaced 2091 with our, uh, the full underscores, and I replaced 18 with the two underscore.

09:26.490 --> 09:31.410
Now, if I should go ahead and replace the months with double underscore, then I'll go ahead and say,

09:31.410 --> 09:33.630
maybe I want people to enroll in zero two.

09:33.630 --> 09:35.010
And I don't know if we have that.

09:35.010 --> 09:37.500
Let's go ahead and take it out so we don't have that.

09:37.530 --> 09:39.330
I'll go ahead and cut off these.

09:39.360 --> 09:43.080
Then let's go ahead and run this and check maybe any of the dates.

09:43.080 --> 09:49.620
So we have our date was six 2418 zero one and zero three.

09:49.650 --> 09:55.740
Now if I should go ahead and put this back again I want people that enroll in 24.

09:55.770 --> 09:56.910
Then go ahead and run this.

09:56.910 --> 09:57.810
I check it out.

09:58.470 --> 10:06.690
So I have an Oscar Electrical enroll in 2022, zero seven, 2024.

10:06.720 --> 10:12.720
And if I change that to zero three, I think we have that and we have Zendaya Grace.

10:13.620 --> 10:17.610
So this is a way this, uh, stuff actually works.

10:17.610 --> 10:20.670
And you can actually also combine the two.

10:20.810 --> 10:24.170
Let's let's go ahead and combine the two and see how the two works.

10:24.200 --> 10:26.690
I'm going to say I want a department.

10:26.720 --> 10:28.610
Let's go ahead and put this as a department.

10:30.800 --> 10:33.350
And I'll go ahead and remove this.

10:33.830 --> 10:39.050
So and that department is going to start with anything else.

10:39.050 --> 10:41.900
And then put an L.

10:41.990 --> 10:44.330
Then it starts.

10:46.400 --> 10:47.660
L precede that.

10:47.690 --> 10:48.620
Go ahead and check this out.

10:48.620 --> 10:50.180
Let us know if we have that L.

10:50.180 --> 10:54.410
So the very first one I replaced that with a e, which is the underscore.

10:54.410 --> 11:01.760
And then the anything that comes behind I don't want to put a underscore maybe in it number of times

11:01.760 --> 11:06.950
because it's not going to either return uh, electronics or electrical, because if I should do that,

11:06.980 --> 11:13.190
I have to put seven underscores or six underscores for electronics and five underscore for electrical.

11:13.190 --> 11:14.840
So you can see how this works.

11:14.870 --> 11:21.920
Now what if we have uh, let's go ahead and say I put this to be maybe civil.

11:21.920 --> 11:23.470
And let's go ahead and check this out.

11:23.500 --> 11:25.420
We don't have anything right in here.

11:25.420 --> 11:31.360
So if I should do that, let's go ahead and, uh, put another one maybe.

11:31.390 --> 11:31.780
See.

11:31.810 --> 11:40.420
And I that is then you can go ahead and replace this with a V, then just go ahead and run this and

11:40.420 --> 11:41.140
check it out.

11:41.170 --> 11:42.490
We have civil.

11:42.490 --> 11:48.640
So in that way I was able to replace the PSI with double underscore, then the V then anything that

11:48.670 --> 11:49.450
comes on.

11:49.450 --> 11:51.520
And I want to put that with the underscore.

11:51.550 --> 11:54.640
That is a way to combine these two wild cards.

11:54.640 --> 11:56.050
So go ahead and practice with that.

11:56.050 --> 11:56.920
I hope that is cool.

11:56.920 --> 12:02.410
So to help you to query your table and when you work in large organizations, you can actually use all

12:02.410 --> 12:04.090
these things and see how good they are.

12:04.120 --> 12:05.290
So proud with it.

12:05.320 --> 12:09.130
And if you have any question, please go ahead and use the question and answer section.

12:09.130 --> 12:11.620
And I'm going to get back to you as soon as possible.

12:11.650 --> 12:12.550
Thank you so much.

12:12.550 --> 12:15.430
And I'm going to see you in the next video lecture.
