1 00:00:00,090 --> 00:00:03,240 One more quick note about working with the like operator. 2 00:00:03,270 --> 00:00:09,030 There may be times you actually want to match a percent sign a book with a percent sign in it. 3 00:00:09,030 --> 00:00:14,010 I know there's one in there because I had this insert it for this exact example or maybe some table 4 00:00:14,010 --> 00:00:16,410 row that has an underscore in it. 5 00:00:16,410 --> 00:00:20,250 But if those characters have a special meaning, it's not going to work, right? 6 00:00:20,250 --> 00:00:27,120 I know that there's 10% happier in here, but if I try and select a book where title is like a percent 7 00:00:27,120 --> 00:00:32,910 sign, that's just going to give me every single title, every single row, because percent sign matches. 8 00:00:32,910 --> 00:00:33,540 It's a wild card. 9 00:00:33,540 --> 00:00:34,560 It matches anything. 10 00:00:34,770 --> 00:00:39,650 So instead of that, what I can do is escape it with a backslash. 11 00:00:39,660 --> 00:00:46,260 If I put a backslash percent sign, all of a sudden that two character sequence, that means a literal 12 00:00:46,260 --> 00:00:47,400 percentage sign. 13 00:00:47,790 --> 00:00:49,590 This percent sign is a wild card. 14 00:00:49,590 --> 00:00:50,720 That's a wild card. 15 00:00:50,730 --> 00:00:56,520 These two combine to mean one in exactly one actual percent sign. 16 00:00:56,730 --> 00:01:03,570 So let's try that where the title is like a percent sign backslash in front of it. 17 00:01:03,570 --> 00:01:04,920 But that's not going to work. 18 00:01:04,920 --> 00:01:05,700 Why not? 19 00:01:05,700 --> 00:01:12,720 Because we would have to match something exactly named percent sign, but instead we want a percent 20 00:01:12,720 --> 00:01:15,810 line in the middle of our title or at the beginning of the title or at the end. 21 00:01:15,810 --> 00:01:16,680 We don't care. 22 00:01:16,680 --> 00:01:18,360 We just want it somewhere. 23 00:01:18,900 --> 00:01:22,280 Imagine that we had this example here, right? 24 00:01:22,290 --> 00:01:25,080 This is saying the letter A somewhere within a string. 25 00:01:25,080 --> 00:01:31,200 But when I do a backslash percent sign, we're saying a percent sign character somewhere within a string 26 00:01:31,200 --> 00:01:33,390 and we get 10% happier. 27 00:01:33,600 --> 00:01:34,350 Perfect. 28 00:01:34,980 --> 00:01:40,980 I don't think I have anything with an underscore in it, but I have the exact same syntax to escape 29 00:01:40,980 --> 00:01:41,880 an underscore. 30 00:01:41,910 --> 00:01:48,090 I use a backslash underscore and SQL knows that we're actually looking for the exact character. 31 00:01:48,090 --> 00:01:48,900 Underscore. 32 00:01:49,200 --> 00:01:50,970 It doesn't mean a wild card anymore. 33 00:01:51,000 --> 00:01:52,200 Oh, right. 34 00:01:52,200 --> 00:01:53,330 We have fake book. 35 00:01:53,340 --> 00:01:57,390 How did I forget we inserted fake book, so fake underscore book. 36 00:01:57,390 --> 00:02:01,590 We can now match that using that underscore escape character. 37 00:02:01,770 --> 00:02:03,420 And that's it for like.