Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:08,448 --> 00:00:09,472
Hi everyone
1
2
00:00:10,240 --> 00:00:14,592
Welcome to this new section. In this section we will be covering the mathematical functions
2
3
00:00:15,360 --> 00:00:18,944
We have already covered 5 important mathematical functions
3
4
00:00:19,456 --> 00:00:21,760
Those were also called aggregate functions
4
5
00:00:22,272 --> 00:00:27,136
If you remember we covered sum count average min and max
5
6
00:00:27,392 --> 00:00:28,928
Before covering group by
6
7
00:00:29,440 --> 00:00:32,768
And we used all those five functions while doing group by
7
8
00:00:34,048 --> 00:00:36,096
There are other mathematical functions also
8
9
00:00:37,632 --> 00:00:39,680
These functions have Limited use cases
9
10
00:00:40,192 --> 00:00:46,336
But it is better to know these so that you know the capabilities of SQL in terms of mathematical functions also
10
11
00:00:47,872 --> 00:00:49,920
so let us cover them quickly
11
12
00:00:50,176 --> 00:00:51,200
First is the
12
13
00:00:51,456 --> 00:00:53,248
Ceil and floor functions
13
14
00:00:54,016 --> 00:00:55,296
So ceil function
14
15
00:00:55,552 --> 00:01:00,672
Returns the smallest integer value that is greater than or equal to the number that you have input
15
16
00:01:01,440 --> 00:01:04,512
For example if you input a number like 4.5
16
17
00:01:05,280 --> 00:01:09,888
The smallest integer value which is greater than this 4.5 will be 5
17
18
00:01:10,144 --> 00:01:12,192
So ceil function gives you the
18
19
00:01:12,704 --> 00:01:16,800
Ceiling of that decimal number that you have input
19
20
00:01:18,080 --> 00:01:20,384
Any number 9.9 will be 10
20
21
00:01:20,640 --> 00:01:22,432
11.1 will be 12
21
22
00:01:22,688 --> 00:01:24,736
That is the ceiling of that decimal number
22
23
00:01:25,504 --> 00:01:27,808
Floor of the same decimal number will be the
23
24
00:01:28,576 --> 00:01:31,136
The largest integer value which is lower
24
25
00:01:31,392 --> 00:01:32,672
or equal to that number
25
26
00:01:32,928 --> 00:01:36,768
11.1 will have floor of 11
26
27
00:01:37,024 --> 00:01:38,048
And ceiling of 12
27
28
00:01:38,816 --> 00:01:40,096
4.5 will have
28
29
00:01:40,352 --> 00:01:41,376
Floor of 4
29
30
00:01:41,632 --> 00:01:43,680
And ceiling of 5
30
31
00:01:44,192 --> 00:01:46,496
So these ceiling and floor values
31
32
00:01:47,008 --> 00:01:50,336
Can be taken out using the ceil and floor function
32
33
00:01:52,640 --> 00:01:54,176
Let us look at an example
33
34
00:01:55,456 --> 00:01:59,808
So we have decimal values in the sales column of the sales table
34
35
00:02:00,320 --> 00:02:02,880
If you want to round this up
35
36
00:02:03,392 --> 00:02:08,000
To say the lower integer or the higher integer then that decimal value
36
37
00:02:08,256 --> 00:02:10,304
You can use the ceil or floor functions
37
38
00:02:10,816 --> 00:02:11,328
Let us
38
39
00:02:11,584 --> 00:02:17,728
Write this query where we will select the order line and the sales value in another column we will put the ceiling
39
40
00:02:17,984 --> 00:02:19,776
Ceiling value of that sales value
40
41
00:02:20,032 --> 00:02:22,592
And in another column will put the floor value
41
42
00:02:23,360 --> 00:02:25,152
Let us go and write this query
42
43
00:02:26,688 --> 00:02:29,248
We will select order Line
43
44
00:02:29,504 --> 00:02:34,112
the Sales value
44
45
00:02:35,392 --> 00:02:37,952
Ceiling of sales
45
46
00:02:38,208 --> 00:02:39,744
this is Ceil function
46
47
00:02:40,768 --> 00:02:42,048
And the
47
48
00:02:42,304 --> 00:02:46,144
Floor of sales
48
49
00:02:46,656 --> 00:02:51,264
This is from the sales table
49
50
00:02:51,520 --> 00:02:53,312
That's it. Let us
50
51
00:02:53,568 --> 00:02:54,336
Run this query
51
52
00:02:57,920 --> 00:02:58,688
So you can see
52
53
00:02:58,944 --> 00:03:03,040
For order value of 261.96
53
54
00:03:03,552 --> 00:03:05,344
Ceiling is 252
54
55
00:03:05,600 --> 00:03:07,392
And floor is 261
55
56
00:03:09,184 --> 00:03:10,976
For 731.94
56
57
00:03:11,232 --> 00:03:13,024
Ceil is 732
57
58
00:03:13,536 --> 00:03:14,560
Floor is 731
58
59
00:03:15,072 --> 00:03:16,096
So you get the idea
59
60
00:03:17,376 --> 00:03:18,912
This is the ceiling and floor function
60
61
00:03:20,192 --> 00:03:21,216
Also note that
61
62
00:03:21,472 --> 00:03:26,592
The function name is coming as the column name if you want to use some other name for this column
62
63
00:03:26,848 --> 00:03:27,872
Use aliases
63
64
00:03:28,128 --> 00:03:32,736
Which are covered in a separate class called AS
4923
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.