Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:08,960 --> 00:00:09,728
Hi everyone
1
2
00:00:10,240 --> 00:00:11,264
In this section
2
3
00:00:11,520 --> 00:00:15,360
Will be discussing about the various types of string functions that we have
3
4
00:00:16,896 --> 00:00:20,224
So, when we are retrieving data or when we are storing data into tables
4
5
00:00:20,736 --> 00:00:22,784
Several times the data is of string type
5
6
00:00:23,296 --> 00:00:25,600
And you can process the data
6
7
00:00:25,856 --> 00:00:27,648
To make it more meaningful to
7
8
00:00:27,904 --> 00:00:29,440
Add value to that data
8
9
00:00:29,696 --> 00:00:34,304
either while retrieving or while saving it to the table using the string functions
9
10
00:00:36,608 --> 00:00:38,912
There are several types of string functions available
10
11
00:00:39,680 --> 00:00:40,960
Let us look at the first one
11
12
00:00:41,216 --> 00:00:42,752
The first is the length
12
13
00:00:43,008 --> 00:00:43,520
Function
13
14
00:00:44,800 --> 00:00:49,152
Length function is used to return the length of specified string
14
15
00:00:50,176 --> 00:00:53,248
So that you get the number of characters in that string
15
16
00:00:54,528 --> 00:01:00,672
This function can be put to use for example if you are a marketing head or you are planning to send out SMS
16
17
00:01:00,928 --> 00:01:02,976
or Emails to the customers
17
18
00:01:03,488 --> 00:01:09,632
And the agency that you are using is charging you on per character basis so you want to find out the
18
19
00:01:09,888 --> 00:01:13,984
Number of characters that will be part of your SMS or your email
19
20
00:01:15,008 --> 00:01:17,824
This is where this particular function will help you
20
21
00:01:18,592 --> 00:01:24,736
The syntax for length function is very simple you just write length and you give the string in the parenthesis
21
22
00:01:25,504 --> 00:01:27,040
And it will return you
22
23
00:01:27,296 --> 00:01:29,088
The number of characters in that string
23
24
00:01:29,856 --> 00:01:31,392
Let us look at an example
24
25
00:01:32,928 --> 00:01:34,464
We have the customer table
25
26
00:01:34,720 --> 00:01:38,560
We want to find out the length of name of each customer
26
27
00:01:39,840 --> 00:01:45,984
To do that we will write this simple query. select customer name against that we want the length of the
27
28
00:01:46,240 --> 00:01:46,752
Customer name
28
29
00:01:47,264 --> 00:01:48,032
In characters
29
30
00:01:49,312 --> 00:01:50,592
From the customer table
30
31
00:01:50,848 --> 00:01:56,736
And this condition I'll just put to show you that you can use conditions also you can write the where
31
32
00:01:56,992 --> 00:01:58,016
Statement also
32
33
00:01:58,528 --> 00:02:01,088
So let us go and write this in the PG admin
33
34
00:02:02,368 --> 00:02:08,512
We start typing select customer name against name
34
35
00:02:08,768 --> 00:02:10,816
we will be finding out the length. so length
35
36
00:02:15,680 --> 00:02:17,728
Customer name
36
37
00:02:18,240 --> 00:02:19,264
As
37
38
00:02:24,640 --> 00:02:25,664
as characters
38
39
00:02:25,920 --> 00:02:26,432
Number
39
40
00:02:26,944 --> 00:02:29,760
From
40
41
00:02:30,016 --> 00:02:31,552
Customer table
41
42
00:02:32,320 --> 00:02:35,904
And you can put the condition if you want to. so write where
42
43
00:02:36,160 --> 00:02:37,952
age is greater than 30
43
44
00:02:41,536 --> 00:02:43,584
When you run this you see that
44
45
00:02:43,840 --> 00:02:46,656
so for example this fourth name is Andrew Allen
45
46
00:02:47,424 --> 00:02:53,568
So Andrew is 6 characters there is a space in between which is one character and there is a Allen which is 5
46
47
00:02:53,824 --> 00:02:56,640
Characters so total its a string of 12 characters
47
48
00:02:59,200 --> 00:03:03,808
We use the length function in the select part of this query
48
49
00:03:04,064 --> 00:03:10,208
You can use length in the where part of this query also so you can just put a condition on length
49
50
00:03:10,464 --> 00:03:14,304
Length of characters is greater than probably 10
50
51
00:03:15,072 --> 00:03:16,864
or 15
51
52
00:03:19,168 --> 00:03:21,984
When you run this, Andrew will not be part of
52
53
00:03:22,752 --> 00:03:23,776
this data
53
54
00:03:25,568 --> 00:03:26,080
So
54
55
00:03:26,336 --> 00:03:30,176
Length function can be used in the select part also and the where part also
4686
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.