All language subtitles for 3. LIKE

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 0 1 00:00:01,280 --> 00:00:02,816 So we have seen how to use 1 2 00:00:03,072 --> 00:00:04,864 In condition and between condition 2 3 00:00:05,632 --> 00:00:07,936 Now let us learn how to use the like condition 3 4 00:00:08,704 --> 00:00:11,520 Like condition is used to perform pattern matching 4 5 00:00:12,032 --> 00:00:14,080 Between string using wildcards 5 6 00:00:15,104 --> 00:00:21,248 But by pattern matching I mean you can find if a string is starting with a particular character or is ending with 6 7 00:00:21,504 --> 00:00:23,040 a particular set of characters 7 8 00:00:23,552 --> 00:00:26,880 That kind of pattern matching can be done using the like condition 8 9 00:00:27,904 --> 00:00:29,696 The syntax of like condition is 9 10 00:00:30,464 --> 00:00:33,024 Select the columns you want from the table name 10 11 00:00:33,792 --> 00:00:36,608 And when you specify the condition using where condition 11 12 00:00:37,632 --> 00:00:39,168 You use like 12 13 00:00:39,424 --> 00:00:41,216 And then you specify the pattern 13 14 00:00:41,728 --> 00:00:43,264 To specify the pattern 14 15 00:00:43,520 --> 00:00:45,056 We'll be using wildcards 15 16 00:00:47,872 --> 00:00:51,456 As told earlier also, wild card is a special character, it is a symbol 16 17 00:00:51,968 --> 00:00:54,528 And this symbol means something to SQL 17 18 00:00:55,040 --> 00:00:59,392 For example when you are using wildcards with Like, there are two particular wildcard used 18 19 00:00:59,648 --> 00:01:01,184 One is the percent symbol 19 20 00:01:01,952 --> 00:01:05,536 Percent symbol allows you to match any string of any length 20 21 00:01:06,048 --> 00:01:10,400 Whereas this underscore wildcard, it allows you to match only single character 21 22 00:01:10,912 --> 00:01:11,936 For example 22 23 00:01:12,704 --> 00:01:14,496 If you write A percent 23 24 00:01:14,752 --> 00:01:15,520 It means 24 25 00:01:15,776 --> 00:01:18,080 Any string with starting with A 25 26 00:01:18,592 --> 00:01:21,152 There can be any number of characters in that string 26 27 00:01:22,432 --> 00:01:23,712 Percent A will mean 27 28 00:01:23,968 --> 00:01:25,760 That the string is ending with A 28 29 00:01:26,272 --> 00:01:28,320 In front of A there can be any number of 29 30 00:01:28,576 --> 00:01:29,088 Characters 30 31 00:01:30,880 --> 00:01:33,440 A percent B will mean, it is starting with A 31 32 00:01:33,696 --> 00:01:34,464 Ending with b 32 33 00:01:34,720 --> 00:01:36,512 And between A and B there are 33 34 00:01:36,768 --> 00:01:40,608 Any number of charachters, do note that a space is considered as a character 34 35 00:01:41,120 --> 00:01:41,632 And 35 36 00:01:41,888 --> 00:01:43,168 Even 0 36 37 00:01:43,424 --> 00:01:46,752 I mean to say no character will also be acceptable 37 38 00:01:47,008 --> 00:01:50,592 So, A percent B will also include AB 38 39 00:01:51,360 --> 00:01:53,664 That is, there is no charachter between a and b 39 40 00:01:55,712 --> 00:01:58,784 IN the fourth example I am showing you the use of underscore symbol 40 41 00:01:59,296 --> 00:02:01,600 AB underscore C will mean 41 42 00:02:02,112 --> 00:02:04,416 The string is starting with A and B 42 43 00:02:05,184 --> 00:02:07,488 And it is ending with C and between these 43 44 00:02:08,000 --> 00:02:10,560 B and C there is only one single character 44 45 00:02:10,816 --> 00:02:11,584 So it is a 45 46 00:02:11,840 --> 00:02:12,864 Four character string 46 47 00:02:14,400 --> 00:02:16,448 Let us use this in examples 47 48 00:02:16,960 --> 00:02:18,240 Try to find out 48 49 00:02:18,496 --> 00:02:19,008 Pattern 49 50 00:02:19,520 --> 00:02:23,360 Suppose we want to find out the customers 50 51 00:02:23,616 --> 00:02:24,896 Whose name start with 51 52 00:02:25,152 --> 00:02:25,920 J 52 53 00:02:28,224 --> 00:02:28,992 To do that 53 54 00:02:29,760 --> 00:02:30,784 This is the syntax 54 55 00:02:31,808 --> 00:02:32,320 Select 55 56 00:02:32,576 --> 00:02:34,368 Everything from the customer table where 56 57 00:02:35,136 --> 00:02:36,160 Customer name 57 58 00:02:36,672 --> 00:02:37,440 Is like 58 59 00:02:37,696 --> 00:02:38,208 J 59 60 00:02:38,720 --> 00:02:44,864 Anything after j, So it is J percent, let us go and write this query in SQL 60 61 00:02:46,912 --> 00:02:49,472 select star 61 62 00:02:49,984 --> 00:02:56,128 From customer 62 63 00:02:58,176 --> 00:03:03,040 Where customer name like 63 64 00:03:05,600 --> 00:03:06,368 GJ 64 65 00:03:08,416 --> 00:03:08,928 Percent 65 66 00:03:09,696 --> 00:03:13,024 Note that this J is in capitals 66 67 00:03:13,536 --> 00:03:17,632 Names which are starting with capital J will be selected 67 68 00:03:23,520 --> 00:03:27,104 So when I run this query you can see all the 68 69 00:03:27,616 --> 00:03:29,408 Customers that I have now 69 70 00:03:29,664 --> 00:03:31,200 Have there names starting with J 70 71 00:03:32,992 --> 00:03:34,528 That is capital J 71 72 00:03:35,808 --> 00:03:37,088 Now if you want to select 72 73 00:03:37,600 --> 00:03:38,368 Customers 73 74 00:03:39,136 --> 00:03:41,184 Who has Nelson in their name 74 75 00:03:41,440 --> 00:03:45,280 Maybe their first name is Nelson, maybe their last name is Nelson 75 76 00:03:45,536 --> 00:03:46,048 Or 76 77 00:03:46,560 --> 00:03:48,608 Within their name this string 77 78 00:03:49,120 --> 00:03:50,144 Nelson appears 78 79 00:03:50,656 --> 00:03:52,448 How to find such customer 79 80 00:03:53,216 --> 00:03:54,240 To do that 80 81 00:03:55,008 --> 00:03:56,800 We'll go to PG admin and write 81 82 00:03:57,824 --> 00:04:03,968 Select star from customer 82 83 00:04:04,224 --> 00:04:09,856 Where customer name like 83 84 00:04:14,208 --> 00:04:15,488 I will have 84 85 00:04:15,744 --> 00:04:16,256 Percent 85 86 00:04:17,791 --> 00:04:19,071 Nelson % 86 87 00:04:24,703 --> 00:04:27,519 Run this query 87 88 00:04:29,823 --> 00:04:31,359 There is only one customer 88 89 00:04:32,127 --> 00:04:33,663 whose last name is Nelson 89 90 00:04:34,687 --> 00:04:35,455 And that 90 91 00:04:35,711 --> 00:04:37,759 Record we have found using this query 91 92 00:04:39,551 --> 00:04:41,855 Now suppose you want to find out 92 93 00:04:42,111 --> 00:04:43,135 Customers 93 94 00:04:43,391 --> 00:04:45,951 Whose first name consists of four characters 94 95 00:04:46,719 --> 00:04:50,047 And after that there can be any number of characters 95 96 00:04:50,815 --> 00:04:52,607 How to find such a customer 96 97 00:04:53,119 --> 00:04:55,679 We need to use the underscore wildcard 97 98 00:04:56,191 --> 00:04:59,519 For the first name will use four underscore characters 98 99 00:05:01,055 --> 00:05:02,079 We need a space 99 100 00:05:02,591 --> 00:05:04,895 After that there will be a percent symbol 100 101 00:05:06,175 --> 00:05:10,271 This percent symbol will ensure that there can be any number of characters 101 102 00:05:10,527 --> 00:05:11,807 After the first name 102 103 00:05:12,575 --> 00:05:18,463 So Let us do this write this query to find out the customers who is first name has 4 characters 103 104 00:05:21,279 --> 00:05:27,423 Select Star from customer where 104 105 00:05:27,679 --> 00:05:30,239 customer name 105 106 00:05:33,567 --> 00:05:35,103 Like 106 107 00:05:38,943 --> 00:05:39,967 one underscore 107 108 00:05:40,223 --> 00:05:44,575 2nd underscore, 3rd underscore, 4th underscore and now a space 108 109 00:05:44,831 --> 00:05:48,415 This will ensure that the first name ends after four characters 109 110 00:05:49,183 --> 00:05:49,951 Now 110 111 00:05:50,463 --> 00:05:51,743 A percent symbol 111 112 00:05:53,791 --> 00:05:55,839 Let us run this 112 113 00:05:58,143 --> 00:06:00,447 You can see we have got 113 114 00:06:00,703 --> 00:06:03,775 All the customers whose first name is of four characters 114 115 00:06:04,031 --> 00:06:06,847 And after that there can be any number of characters 115 116 00:06:09,151 --> 00:06:10,687 In the fourth example 116 117 00:06:11,711 --> 00:06:13,503 I'm showing the use of like 117 118 00:06:14,015 --> 00:06:16,831 Condition along with the not condition 118 119 00:06:17,343 --> 00:06:22,719 So if you want to find out all the cities which are not starting with the letter S 119 120 00:06:23,999 --> 00:06:25,023 How to do that 120 121 00:06:26,559 --> 00:06:30,399 In this condition will also be using the distinct 121 122 00:06:30,911 --> 00:06:37,055 Keyword, distinct will ensure that the city names are not a repeating, since a lot of customers are residing 122 123 00:06:37,311 --> 00:06:39,359 In the same city if I just write select 123 124 00:06:39,615 --> 00:06:40,383 I'll get the 124 125 00:06:40,639 --> 00:06:42,431 City names repetitively 125 126 00:06:42,943 --> 00:06:45,503 So to get unique city name 126 127 00:06:45,759 --> 00:06:49,343 I'll write distinct also so select distinct City from customer 127 128 00:06:49,599 --> 00:06:51,391 Where city not like 128 129 00:06:51,647 --> 00:06:54,975 And it is not starting with S so let's go and write this condition 129 130 00:06:55,487 --> 00:06:59,071 Select distinct 130 131 00:06:59,327 --> 00:07:05,471 City this is the column name from table 131 132 00:07:05,727 --> 00:07:11,871 Customer where City 132 133 00:07:12,127 --> 00:07:15,199 not like 133 134 00:07:15,455 --> 00:07:21,599 That is not starting with S so S percent. Remember to put S in capital 134 135 00:07:21,855 --> 00:07:25,439 Since our city names are starting with capital letters 135 136 00:07:27,231 --> 00:07:30,559 So you can see, we have all the city and none of the city is 136 137 00:07:30,815 --> 00:07:32,863 Starting with the S character 137 138 00:07:36,447 --> 00:07:37,727 The last example 138 139 00:07:38,239 --> 00:07:40,031 Is Using the escape character 139 140 00:07:40,799 --> 00:07:42,591 This backslash 140 141 00:07:42,847 --> 00:07:45,919 That we have here is called an escape character 141 142 00:07:46,175 --> 00:07:47,199 It is used 142 143 00:07:47,967 --> 00:07:51,039 To escape the meaning of percent as a wildcard 143 144 00:07:51,551 --> 00:07:52,831 What I mean by that is 144 145 00:07:53,087 --> 00:07:55,903 If you want to actually find out a percent symbol 145 146 00:07:56,159 --> 00:07:56,927 In your data 146 147 00:07:57,951 --> 00:08:01,535 How do you do that if you write the percent symbol it will be considered as a wildcard 147 148 00:08:02,047 --> 00:08:07,679 If you want this percent symbol to be considered as a percent symbol. You'll need to use this backslash 148 149 00:08:08,447 --> 00:08:10,751 Which is called an escape character, so if you 149 150 00:08:11,007 --> 00:08:17,151 Run this query select star from customer where customer name like the backlash percent. It will actually 150 151 00:08:17,407 --> 00:08:18,431 Find a customer 151 152 00:08:18,943 --> 00:08:20,479 Which have a name of G% 152 153 00:08:20,735 --> 00:08:21,503 G% 153 154 00:08:22,783 --> 00:08:25,343 Since we do not have any customer like that 154 155 00:08:25,599 --> 00:08:30,207 I just wanted to show you this example so will not be running this query that's all with this 155 156 00:08:30,463 --> 00:08:34,303 Like condition, in the next video will learn how to order the 156 157 00:08:34,559 --> 00:08:35,839 Retrieve data set 157 158 00:08:36,095 --> 00:08:40,959 So For example, when we retrieve customer name it was coming in the random order 158 159 00:08:41,471 --> 00:08:44,799 I want to get the customer names ordered in the alphabetical order 159 160 00:08:45,311 --> 00:08:48,127 As Starting from A and ending with Z 160 161 00:08:48,383 --> 00:08:49,151 How to do that, we willl learn that in the next chapter 12553

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.