1 00:00:00,530 --> 00:00:02,620 Awesome, and one more thing. 2 00:00:02,620 --> 00:00:05,010 The printer ran out of ink when printing sign-in sheets for 3 00:00:05,010 --> 00:00:06,800 the first half of our students. 4 00:00:06,800 --> 00:00:10,830 If you could get a list of students with last names from A to M, 5 00:00:10,830 --> 00:00:11,960 that would be really helpful. 6 00:00:13,180 --> 00:00:17,020 For this query, let's start by selecting a list of all the students. 7 00:00:17,020 --> 00:00:19,730 SELECT* FROM STUDENTS. 8 00:00:19,730 --> 00:00:21,720 Then, lets add a WHERE clause. 9 00:00:21,720 --> 00:00:22,860 And in this WHERE clause, 10 00:00:22,860 --> 00:00:27,450 we need to limit our students to only the ones with last names from A to M. 11 00:00:27,450 --> 00:00:31,190 But before we do that, I'm gonna real quick add the ORDER BY and 12 00:00:31,190 --> 00:00:34,300 we want to do it by LAST_NAME ASCENDING. 13 00:00:34,300 --> 00:00:36,830 Okay, getting back to the WHERE clause, if you google for 14 00:00:36,830 --> 00:00:40,130 this answer, one thing you might come across is this. 15 00:00:40,130 --> 00:00:43,438 So using the LIKE keyword we can do something like this. 16 00:00:43,438 --> 00:00:48,511 A to M, and then the % sign, and what these brackets mean, 17 00:00:48,511 --> 00:00:54,412 is that the first character in the last name needs to be between A to M. 18 00:00:54,412 --> 00:00:59,170 And then the % sign again which know means, whatever comes after this is fine. 19 00:00:59,170 --> 00:01:02,560 So this is saying, the first character needs to be between A to M, and 20 00:01:02,560 --> 00:01:05,040 all the remaining characters we don't care about. 21 00:01:05,040 --> 00:01:09,807 However, if we try to run this, It doesn't work. 22 00:01:09,807 --> 00:01:13,440 And that's because the syntax doesn't work with SQLite. 23 00:01:13,440 --> 00:01:17,920 It works with most SQL implementations, it just doesn't work with this one. 24 00:01:17,920 --> 00:01:20,320 So we'll have to take a different approach. 25 00:01:20,320 --> 00:01:24,580 So, what we are going to do, is instead of using the LIKE keyword, we're just going 26 00:01:24,580 --> 00:01:31,800 to see if the last name is after, or equal to, the letter A, and before the letter N. 27 00:01:31,800 --> 00:01:35,420 And to do that, we can chose greater than and equal to signs. 28 00:01:35,420 --> 00:01:41,392 So, let's do LAST_NAME, and let's make sure it comes after or 29 00:01:41,392 --> 00:01:47,593 is equal to the letter A, and let's make sure, so AND LAST_NAME. 30 00:01:47,593 --> 00:01:50,677 We wanna make sure its less than the letter N. 31 00:01:50,677 --> 00:01:53,670 And if we run this, there we go. 32 00:01:53,670 --> 00:01:54,770 Last names with A. 33 00:01:54,770 --> 00:01:57,371 If we scroll all the way down to the bottom, 34 00:01:57,371 --> 00:01:59,699 we get this very last one with Murray.