Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:02,048 --> 00:00:04,352
Next we are going to discuss the Replace function
1
2
00:00:04,864 --> 00:00:06,400
Replace function is used
2
3
00:00:06,656 --> 00:00:07,424
To replace
3
4
00:00:07,680 --> 00:00:08,960
Occurrences of
4
5
00:00:09,216 --> 00:00:13,056
a set of characters within a particular string to some other set of characters
5
6
00:00:14,080 --> 00:00:20,224
So it is just like the find and replace in your Microsoft word or any other text
6
7
00:00:20,480 --> 00:00:23,040
Editor where you will find a particular string
7
8
00:00:23,296 --> 00:00:25,856
Within your document and it'll change
8
9
00:00:26,112 --> 00:00:26,880
Every
9
10
00:00:27,648 --> 00:00:29,952
Occurrence of that string to a new string
10
11
00:00:30,208 --> 00:00:31,744
in the syntax also you can see
11
12
00:00:32,256 --> 00:00:33,792
So you write replace
12
13
00:00:34,048 --> 00:00:38,144
and then you mention the string. So this will be a string or column in your database
13
14
00:00:38,400 --> 00:00:41,728
After that you mention the string to be replaced
14
15
00:00:42,496 --> 00:00:44,544
And after that you mention the string
15
16
00:00:44,800 --> 00:00:47,360
Which will come in place of that earlier string
16
17
00:00:49,408 --> 00:00:51,968
Remember that replace function is case sensitive
17
18
00:00:52,480 --> 00:00:58,624
What I mean by that is not this part of replace is case sensitive this you can write in any case but
18
19
00:00:59,392 --> 00:01:05,536
The string that you are mentioning here and the string your mentioning here whatever case you mention in this
19
20
00:01:06,048 --> 00:01:06,560
Part
20
21
00:01:06,816 --> 00:01:10,400
It will check the string in that particular case only
21
22
00:01:11,424 --> 00:01:16,800
and whatever case you mention in this string it will replace it with that same string
22
23
00:01:17,056 --> 00:01:18,336
If you have upper case
23
24
00:01:18,592 --> 00:01:19,104
All
24
25
00:01:19,360 --> 00:01:22,176
Replacements will be uppercase
25
26
00:01:24,736 --> 00:01:25,760
So for example
26
27
00:01:26,272 --> 00:01:29,600
In the country list we have United States
27
28
00:01:30,112 --> 00:01:33,440
If you want to replace United States with US
28
29
00:01:34,208 --> 00:01:35,488
This is how we can do it
29
30
00:01:36,000 --> 00:01:37,536
We will select customer name
30
31
00:01:37,792 --> 00:01:40,352
We have selected country also so that we can
31
32
00:01:40,608 --> 00:01:42,656
Check that earlier it was United States
32
33
00:01:43,424 --> 00:01:44,704
And we'll replace
33
34
00:01:45,472 --> 00:01:45,984
Country
34
35
00:01:46,240 --> 00:01:50,336
This is the column name country from United States
35
36
00:01:50,592 --> 00:01:51,616
To US
36
37
00:01:52,384 --> 00:01:55,200
And this new column will be named as country new
37
38
00:01:55,712 --> 00:01:58,784
and this is from the customer table. let's go and write this
38
39
00:02:06,720 --> 00:02:12,096
select customer name, the country
39
40
00:02:12,608 --> 00:02:14,144
and replace
40
41
00:02:16,960 --> 00:02:19,008
Column name
41
42
00:02:22,592 --> 00:02:25,152
Previous string which is United States
42
43
00:02:25,408 --> 00:02:27,456
and the new string which is US
43
44
00:02:35,392 --> 00:02:37,952
This column will be named as country new
44
45
00:02:46,144 --> 00:02:47,168
Run this query
45
46
00:02:48,960 --> 00:02:49,728
And you can see
46
47
00:02:49,984 --> 00:02:51,520
The third column
47
48
00:02:52,544 --> 00:02:55,616
We have US everywhere there is United States
48
49
00:02:56,896 --> 00:03:00,736
Just to check that this is case sensitive we will replace the
49
50
00:03:00,992 --> 00:03:01,760
U
50
51
00:03:02,016 --> 00:03:04,064
The capital U of United States to
51
52
00:03:04,320 --> 00:03:09,952
Lower U and we will run this query
52
53
00:03:10,464 --> 00:03:14,816
You can see that it has not been able to replace the column
53
54
00:03:15,072 --> 00:03:18,400
The column was supposed to contain US after replacing United States
54
55
00:03:18,656 --> 00:03:22,496
But it was not able to replace it so it has given just United States to us
55
56
00:03:23,264 --> 00:03:26,592
This is where you can also use upper and lower functions
56
57
00:03:26,848 --> 00:03:32,992
So if you are not sure about the case of the column that you are mentioning you just right lower
57
58
00:03:33,248 --> 00:03:36,064
On this column name
58
59
00:03:36,320 --> 00:03:42,464
So all the values of this column name will become lowercase and you mention here the
59
60
00:03:42,720 --> 00:03:47,328
String in lowercase. So this will help you replace all the United States
60
61
00:03:47,584 --> 00:03:49,120
in whichever case it is
61
62
00:03:49,632 --> 00:03:50,912
to US
62
63
00:03:51,168 --> 00:03:57,312
You can see that we have successfully replaced United States with US
63
64
00:03:58,080 --> 00:03:59,104
However this is
64
65
00:03:59,616 --> 00:04:05,760
only in the resultset this has not replaced the values in the table if you want to replace the value in the
65
66
00:04:06,016 --> 00:04:08,576
table, you have to use update table command
66
67
00:04:10,880 --> 00:04:11,648
That's all about replace function
5587
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.