Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:01,792 --> 00:00:03,840
Let us look at the sum function
1
2
00:00:04,608 --> 00:00:06,144
Sum function as you can guess
2
3
00:00:06,656 --> 00:00:12,032
Returns the sum value or the aggregate value of the expression that you have given it as an input
3
4
00:00:13,312 --> 00:00:15,872
The syntax for sum function is select
4
5
00:00:16,128 --> 00:00:18,176
Sum mention the column name
5
6
00:00:18,944 --> 00:00:21,504
Then you can give additional column names if you want to
6
7
00:00:22,272 --> 00:00:23,296
From table name
7
8
00:00:23,808 --> 00:00:25,856
Then you can give conditions
8
9
00:00:26,112 --> 00:00:28,928
Specify condition using the where statement
9
10
00:00:29,184 --> 00:00:29,952
If you want to
10
11
00:00:33,024 --> 00:00:34,304
Let us look at some example
11
12
00:00:35,072 --> 00:00:38,144
Suppose you want to find out the total profit you have earned
12
13
00:00:38,656 --> 00:00:41,472
So if you go to the sales table
13
14
00:00:42,240 --> 00:00:44,032
There is a separate column named
14
15
00:00:44,288 --> 00:00:44,800
Profit
15
16
00:00:45,312 --> 00:00:48,640
I want to get the total sum of all the profit values
16
17
00:00:49,408 --> 00:00:50,176
How to do that
17
18
00:00:50,432 --> 00:00:51,712
Select sum
18
19
00:00:52,224 --> 00:00:53,504
Of the profit column
19
20
00:00:53,760 --> 00:00:57,344
As total profit this is the alias I am providing to this column
20
21
00:00:57,856 --> 00:00:59,136
From sales table
21
22
00:00:59,392 --> 00:01:00,672
Let us go and write this
22
23
00:01:02,464 --> 00:01:04,256
Now I will write the sum Query
23
24
00:01:04,512 --> 00:01:05,536
Query
24
25
00:01:05,792 --> 00:01:06,816
Select
25
26
00:01:07,584 --> 00:01:11,168
Sum
26
27
00:01:11,680 --> 00:01:14,240
The profit column so profit
27
28
00:01:15,008 --> 00:01:18,592
Name this column as total profit
28
29
00:01:23,456 --> 00:01:29,600
And I'll mention the table name from sales
29
30
00:01:37,280 --> 00:01:40,352
The query has return the result, the total profit
30
31
00:01:40,608 --> 00:01:41,632
I have earned is
31
32
00:01:41,888 --> 00:01:43,936
nearly 286,000
32
33
00:01:45,728 --> 00:01:46,752
Not let us look at
33
34
00:01:47,008 --> 00:01:52,128
Using the sum function along with a specified condition that is using where
34
35
00:01:53,408 --> 00:01:54,944
If I want to find out
35
36
00:01:55,200 --> 00:01:59,296
What is the total quantity of a particular product that I have sold
36
37
00:02:00,064 --> 00:02:03,904
To find that out, I will write select sum of quantity
37
38
00:02:04,672 --> 00:02:05,952
As total quantity
38
39
00:02:06,208 --> 00:02:06,976
From
39
40
00:02:07,488 --> 00:02:13,376
Orders where product ID is this particular product ID, so how many of this particular product
40
41
00:02:13,632 --> 00:02:14,400
I have sold
41
42
00:02:14,656 --> 00:02:15,936
Let us go and find out
42
43
00:02:20,800 --> 00:02:21,824
Select sum
43
44
00:02:22,336 --> 00:02:24,640
Of quantity
44
45
00:02:25,152 --> 00:02:30,784
As total quantity
45
46
00:02:35,392 --> 00:02:40,768
From tablename where
46
47
00:02:41,024 --> 00:02:43,328
Product ID
47
48
00:02:55,104 --> 00:02:56,896
This one
48
49
00:03:07,392 --> 00:03:07,904
So
49
50
00:03:08,416 --> 00:03:13,536
The total quantity of this particular product ID sold is 29
50
51
00:03:14,816 --> 00:03:19,680
So that is how sum function is used, to find out aggregate or totals
51
52
00:03:20,192 --> 00:03:21,984
Next we'll look at how to use
52
53
00:03:22,240 --> 00:03:23,264
Average functions
3847
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.