1 00:00:00,150 --> 00:00:01,740 So let's see the answers here. 2 00:00:01,770 --> 00:00:04,590 Feel free to skip forward if you feel like you got them right. 3 00:00:05,400 --> 00:00:10,230 So the first one, right, the SQL that selects the following we only want the cat IDs, but we want 4 00:00:10,230 --> 00:00:12,300 all of the results, all the cats. 5 00:00:12,540 --> 00:00:17,790 So that will be select cat ID from cats. 6 00:00:18,210 --> 00:00:22,680 So we want all cats, but only the cat ID returned and that's what we get. 7 00:00:24,800 --> 00:00:31,040 Next up, write the SQL query that selects the following name and breed for all cats. 8 00:00:31,250 --> 00:00:37,970 So it's similar to the last one, except we want name and breed from all cats. 9 00:00:38,480 --> 00:00:39,160 There we go. 10 00:00:39,170 --> 00:00:40,640 Name and breed. 11 00:00:43,220 --> 00:00:45,680 So let's talk about the solution to this one here. 12 00:00:45,710 --> 00:00:49,180 We need to use both the select expression and the where clause. 13 00:00:49,190 --> 00:00:55,460 We want to select name and age from cats where breed equals tabby. 14 00:00:56,420 --> 00:00:57,560 So let's do that. 15 00:00:57,560 --> 00:01:05,330 Select name, comma, age from cats where breed equals tabby. 16 00:01:05,360 --> 00:01:06,320 Just like that. 17 00:01:07,310 --> 00:01:10,640 And we get Ringo, who's four, and Misty who is 13. 18 00:01:10,640 --> 00:01:12,590 And that's exactly what we wanted to see. 19 00:01:13,190 --> 00:01:16,190 Now, the final one is a little trickier. 20 00:01:16,190 --> 00:01:21,230 As I mentioned, we didn't see exactly how to do this, but hopefully you were able to figure it out 21 00:01:21,470 --> 00:01:24,080 because it's exactly the same syntax. 22 00:01:24,140 --> 00:01:27,140 But we're just checking a slightly different where clause. 23 00:01:27,290 --> 00:01:28,520 So we'll start with the first part. 24 00:01:28,520 --> 00:01:30,680 We want to select cat ID in age. 25 00:01:30,680 --> 00:01:42,680 So that's a select cat ID comma age from cat where and we want where cat ID is the same as age. 26 00:01:43,010 --> 00:01:50,600 So we've been doing things like we're age equals two or we could do where cat ID equals one, but we 27 00:01:50,600 --> 00:01:53,620 can also just do where cat ID equals age. 28 00:01:53,630 --> 00:01:56,360 Those are both going to be numbers and my SQL. 29 00:01:56,630 --> 00:01:59,360 Sorry, my SQL is smart enough to figure that out. 30 00:01:59,960 --> 00:02:04,190 So it's going to compare cat ID and age and see where they're equal. 31 00:02:05,180 --> 00:02:09,860 As you can see, we get what we want cat ID in age and they're equal. 32 00:02:10,100 --> 00:02:14,270 So let's go back and revise this a bit and do a select star. 33 00:02:18,060 --> 00:02:20,530 Just so you can see exactly what we're working with. 34 00:02:20,550 --> 00:02:26,370 We have egg in Jackson, where age is for ID is for age seven and ID is seven. 35 00:02:27,390 --> 00:02:33,360 So in addition to having some practice there, we also learned that you can compare columns and the 36 00:02:33,360 --> 00:02:38,310 values rather than just picking an exact value like four or ten. 37 00:02:38,520 --> 00:02:44,040 We can compare two different columns and select based off of when they're equal to another. 38 00:02:44,790 --> 00:02:45,480 All right.