WEBVTT

00:00.090 --> 00:01.760
So let's see the answers here.

00:01.800 --> 00:04.910
Feel free to skip forward if you feel like you got them right.

00:05.490 --> 00:08.220
So the first one write the sequel that selects the following.

00:08.250 --> 00:11.340
We only want the cat ladies but we want all of the results.

00:11.340 --> 00:13.420
All the cats so that will be.

00:13.440 --> 00:18.360
Select cat ID from cats.

00:18.360 --> 00:21.620
So we want all cats but only the cat Id returned.

00:21.630 --> 00:23.550
And that's what we get.

00:24.920 --> 00:31.070
Next up write the sequel query that selects the following name and breed for all cats.

00:31.400 --> 00:38.120
So it's similar to the last one except we want name and breed from all cats.

00:38.490 --> 00:39.150
There we go.

00:39.200 --> 00:42.550
Name and breed.

00:42.870 --> 00:45.810
OK so let's talk about the solution to this one here.

00:45.920 --> 00:51.710
We need to use both these select expression and the WHERE clause we want to select name and age from

00:52.040 --> 00:56.250
cats where breed equals tabby.

00:56.530 --> 00:57.640
So let's do that.

00:57.650 --> 01:05.320
Select name Khama age from cats where breed equals tabby.

01:05.390 --> 01:06.950
Just like that.

01:07.430 --> 01:13.280
And we get Ringo who's four and Misty who is 13 and that's exactly what we wanted to see.

01:13.280 --> 01:19.970
Now the final one is a little trickier as I mentioned we didn't know exactly how to do this but hopefully

01:19.970 --> 01:25.730
you were able to figure it out because it's exactly the same syntax but we're just checking slightly

01:25.730 --> 01:26.060
different.

01:26.060 --> 01:27.200
Where clause.

01:27.440 --> 01:28.520
So we'll start with the first part.

01:28.550 --> 01:39.770
We want to select cat ID and age so that's a select cat ID comma age from cats where and we want where

01:39.770 --> 01:43.150
cat ID is the same as age.

01:43.170 --> 01:50.750
So we've been doing things like where age equals to or we could do were cat ID equals one but we can

01:50.750 --> 01:55.250
also just do or cat D equals age because we're both going to be numbers.

01:55.370 --> 02:00.050
And my sequel I'm sorry my as well is smart enough to figure that out.

02:00.110 --> 02:06.890
So it's going to compare cat idea and age and see where they're equal as you can see we get what we

02:06.890 --> 02:07.350
want.

02:07.430 --> 02:10.060
Cat ID and age and they're equal.

02:10.220 --> 02:14.060
So let's go back and revise this a bit and do a show like Star

02:18.100 --> 02:20.680
just so you can see exactly what we're working with.

02:20.680 --> 02:22.420
We have egg in Jackson.

02:22.550 --> 02:26.480
We're ages for ideas for ages seven and idea seven.

02:26.800 --> 02:27.380
OK.

02:27.490 --> 02:33.910
So in addition to having some practice there we also learned that you can compare columns and the values

02:34.390 --> 02:38.680
rather than just picking at an exact value like four or 10.

02:38.680 --> 02:44.790
We can compare two different columns and select based off of when they're equal to another.

02:44.800 --> 02:45.420
All right.
