1
00:00:00,700 --> 00:00:01,910
Hello, dear friends.

2
00:00:02,710 --> 00:00:08,100
So one of the important functions of Ezekial Server is math functions, right?

3
00:00:10,180 --> 00:00:14,980
So in this section, we're going to talk about and we're going to learn in greater detail the math functions.

4
00:00:16,170 --> 00:00:24,240
So I want to start with a B.S., which is a function that comes from the absolute key word, so the

5
00:00:24,240 --> 00:00:27,840
ABS function returns the absolute value of a number.

6
00:00:29,770 --> 00:00:33,790
This function will take only one parameter and it must be a number.

7
00:00:35,790 --> 00:00:40,350
So let's build the query and set minus 200 and two.

8
00:00:41,980 --> 00:00:48,310
And the ABC function will remove the minus from the number and then return the result as a positive

9
00:00:48,310 --> 00:00:48,700
number.

10
00:00:51,180 --> 00:00:51,960
Executed.

11
00:00:53,050 --> 00:00:55,930
And here is the absolute of this No.

12
00:00:59,390 --> 00:01:00,710
The average function.

13
00:01:02,350 --> 00:01:08,260
The average function is in aggregate that returns the average value of an expression.

14
00:01:09,810 --> 00:01:15,930
An aggregate function performs a calculation, one or more values and returns a single value.

15
00:01:17,740 --> 00:01:24,280
So the aggregate function is often used with the group by Claw's and the having clause of the select

16
00:01:24,280 --> 00:01:24,760
statement.

17
00:01:26,190 --> 00:01:28,620
And this function only takes one parameter.

18
00:01:29,920 --> 00:01:33,070
So in this example, we will find out the answer to the question.

19
00:01:34,340 --> 00:01:38,390
What is the average list price of all the product?

20
00:01:40,120 --> 00:01:47,170
So the list price column is in the product table and we will use the product table and here are all

21
00:01:47,170 --> 00:01:49,630
the list prices of the products in the list.

22
00:01:50,700 --> 00:01:57,990
Now, in order to find the average of these prices, the AVG function is used and this function returns

23
00:01:57,990 --> 00:02:04,590
the average value of an expression, and here is the average of the list price of all the product.

24
00:02:07,170 --> 00:02:13,830
Ceiling function now the ceiling function returns the smallest energy value that is greater than or

25
00:02:13,830 --> 00:02:15,810
equal to a particular number.

26
00:02:16,870 --> 00:02:19,270
This function takes only one parameter.

27
00:02:21,530 --> 00:02:26,990
So let's use 15 dots, seven five as the parameter of the ceiling function.

28
00:02:29,010 --> 00:02:33,450
And when we execute the query, we will get 16 as the result.

29
00:02:34,610 --> 00:02:39,710
Because his function returns the smallest integer value that is greater than or equal to the number.

30
00:02:42,820 --> 00:02:47,500
So using 15 dot zero one instead of 15 dot seven five.

31
00:02:48,520 --> 00:02:50,590
We'll also return 16.

32
00:02:53,490 --> 00:02:54,600
The count function.

33
00:02:55,810 --> 00:03:02,350
So the count function is an aggregate that returns the number of records returned by a select query.

34
00:03:03,650 --> 00:03:06,470
So it returns zero if there were no matching rose.

35
00:03:07,780 --> 00:03:10,090
And this function only takes one parameter.

36
00:03:13,320 --> 00:03:18,390
So let's say we want to find out how many products are in the product label.

37
00:03:19,920 --> 00:03:26,130
They can't function requires a parameter, so any column in the table can be used as a parameter.

38
00:03:27,280 --> 00:03:31,510
We can even use multiple columns or a star sign as well.

39
00:03:32,590 --> 00:03:38,840
And this query will get the number of all products from the product table and here it is.

40
00:03:39,340 --> 00:03:43,270
There are 504 products in the product table.

41
00:03:45,010 --> 00:03:45,910
Floor function.

42
00:03:47,560 --> 00:03:52,540
The floor function returns the biggest integer value that is less than or equal to a number.

43
00:03:55,000 --> 00:03:57,070
Here is a syntax of the floor function.

44
00:03:57,580 --> 00:03:59,350
It'll take only one parameter.

45
00:04:01,950 --> 00:04:08,430
So let's use fifteen point seven five as the parameter of the floor function and when we execute the

46
00:04:08,430 --> 00:04:15,990
query, we will get 15 as the result, because this function returns the biggest energy value that is

47
00:04:15,990 --> 00:04:19,320
less than or equal to that number.

48
00:04:20,130 --> 00:04:27,000
So using fifteen point ninety 99 instead of 15 to 25, that's also going to return 15.

49
00:04:29,890 --> 00:04:30,850
Max function.

50
00:04:32,160 --> 00:04:38,280
The max function is an aggregate, the returns, the maximum value in a set of values.

51
00:04:39,400 --> 00:04:45,220
And this is why the syntax looks like the max function, except only one parameter.

52
00:04:46,790 --> 00:04:51,770
So in this example, we will retrieve the biggest list price in the product table.

53
00:04:54,340 --> 00:05:00,820
Now, all we have to do is set a list price as a parameter of the max function and then retrieve it

54
00:05:00,820 --> 00:05:01,420
from the table.

55
00:05:02,900 --> 00:05:04,220
And there it is.

56
00:05:05,320 --> 00:05:12,370
Max function will check all the list prices in the table and then find out what the highest or biggest

57
00:05:12,370 --> 00:05:12,880
one is.

58
00:05:14,280 --> 00:05:17,220
And here is a highest list price in the product table.

59
00:05:20,140 --> 00:05:26,350
Main function, the main function is also an aggregate, the returns, the minimum value in a set of

60
00:05:26,350 --> 00:05:26,920
values.

61
00:05:28,010 --> 00:05:34,130
The main function accepts only one parameter, like the max function, so let's find out where the smallest

62
00:05:34,280 --> 00:05:36,620
this price in the product table is.

63
00:05:37,880 --> 00:05:39,580
So you might be miles ahead of me.

64
00:05:39,620 --> 00:05:46,730
All we have to do is set the list price is a barometer of the mind function and that and then function

65
00:05:46,730 --> 00:05:51,230
will check all the lowest prices in the table and find out the smallest one.

66
00:05:52,370 --> 00:05:55,070
Now, let's see if we can execute the men and max statement together.

67
00:05:57,060 --> 00:06:01,080
So here, the maximum and the minimum list prices in the periodic table.

68
00:06:02,730 --> 00:06:04,020
The power function.

69
00:06:04,940 --> 00:06:10,250
Now, the power function returns the value of a number raised to the power of another number.

70
00:06:11,450 --> 00:06:18,920
This function accepts two parameters, the first parameter is the base and the second parameter is the

71
00:06:18,920 --> 00:06:19,700
exponent.

72
00:06:20,240 --> 00:06:22,040
Both parameters are required.

73
00:06:22,280 --> 00:06:27,260
The number A is the base and the number B is the exponent.

74
00:06:29,280 --> 00:06:36,870
So in this example, we will use to as the base, which is the first parameter and two again is the

75
00:06:36,870 --> 00:06:41,040
exponent, which is the second parameter of this power function.

76
00:06:43,070 --> 00:06:46,430
So this means two to the power of two.

77
00:06:47,480 --> 00:06:51,260
And the result is two times two equals four.

78
00:06:52,770 --> 00:06:59,010
Now, if we change the exponent of five, it means two to the power of five and the result is.

79
00:07:01,290 --> 00:07:01,980
32.

80
00:07:07,470 --> 00:07:14,010
Rand function, the Rand function returns a random number or a random number within a range.

81
00:07:14,670 --> 00:07:22,110
So the RAND function will return a value between zero and one and they are not inclusive, so the value

82
00:07:22,110 --> 00:07:25,680
will be greater than zero and less than one.

83
00:07:26,130 --> 00:07:29,880
So this function takes a seed as a parameter.

84
00:07:31,010 --> 00:07:37,460
So the parameters optional, if a seat is specified, it returns a repeatable sequence of random numbers.

85
00:07:37,740 --> 00:07:43,220
If no seat is specified, it returns a completely random number between zero and one.

86
00:07:43,910 --> 00:07:46,400
And of course, zero and one are not inclusive.

87
00:07:47,280 --> 00:07:51,030
So whenever the query is executed, any random number will be returned.

88
00:07:54,230 --> 00:07:59,900
If the RAND function is used with a number as the parameter, it will return the same random number.

89
00:08:05,360 --> 00:08:09,200
And whenever the query is executed, the same number will be returned.

90
00:08:22,070 --> 00:08:27,500
Now, if we want to get the random decimal numbers, we should multiply it by 10.

91
00:08:30,150 --> 00:08:38,370
So in this case, the random decimal number will be returned between zero and 10 and zero and 10 are

92
00:08:38,370 --> 00:08:39,270
not inclusive.

93
00:08:41,560 --> 00:08:43,480
Now, what about integer numbers?

94
00:08:45,050 --> 00:08:51,500
So if we want to get the random integer numbers, we should multiply the RAND function by 10.

95
00:08:52,510 --> 00:08:55,360
Said it is the parameter of the floor function.

96
00:08:56,310 --> 00:09:00,390
Because you remember that the floor function returns, the energy numbers.

97
00:09:01,980 --> 00:09:08,820
So in this case, the random integer number will be returned between zero and 10 and zero and 10 are

98
00:09:09,630 --> 00:09:10,830
inclusive this time.

99
00:09:15,120 --> 00:09:16,170
Round function.

100
00:09:17,090 --> 00:09:21,740
So the round function rounds a number to a specified number of decimal places.

101
00:09:22,710 --> 00:09:29,790
And this function will take three parameters, the first parameter is the number to be rounded in decimals.

102
00:09:30,730 --> 00:09:31,780
It is required.

103
00:09:32,700 --> 00:09:39,540
The second parameters, a number of decimal places to round the number two, it is required.

104
00:09:40,980 --> 00:09:47,730
And the last parameter is the operation, and that's going to be optional if it's a zero, it rounds

105
00:09:47,730 --> 00:09:54,330
a result to the number of decimals, if it's another value than zero than it truncates, the result

106
00:09:54,390 --> 00:09:59,010
to the number of decimals and the default value is zero.

107
00:10:01,950 --> 00:10:08,340
Great, so let's use one, two, three, three, two, one as the first parameter and three for the

108
00:10:08,340 --> 00:10:10,620
second parameter of the round function.

109
00:10:11,900 --> 00:10:17,330
So the number three, which is the second parameter, is rounded to the number three decimal places.

110
00:10:18,440 --> 00:10:22,490
Now, if we execute the query, we will get all numbers.

111
00:10:23,680 --> 00:10:26,920
If we change the second parameter from three to two.

112
00:10:29,100 --> 00:10:33,360
In this case, it will be rounded to the number to two decimal places.

113
00:10:34,460 --> 00:10:38,180
The numbers, three and two will be returned as the decimal result.

114
00:10:40,920 --> 00:10:47,310
If we use zero as a second parameter in this case, it will be rounded to the number to zero decimal

115
00:10:47,310 --> 00:10:47,760
places.

116
00:10:50,550 --> 00:10:57,360
And if we use minus one, well, a negative number as a second parameter in this case, it will be rounded

117
00:10:57,360 --> 00:10:58,800
one digit to the left.

118
00:11:02,120 --> 00:11:03,910
Security function.

119
00:11:05,230 --> 00:11:09,220
So the rescue party function returns the square root of a number.

120
00:11:10,610 --> 00:11:16,490
So the function takes only one required parameter and the parameter must be a positive number in order

121
00:11:16,490 --> 00:11:20,180
to calculate the square root of whatever the number is.

122
00:11:22,010 --> 00:11:29,390
So the escort is used to find the square root of the specified expression or numeric number.

123
00:11:30,650 --> 00:11:36,770
So if the No.9 is used as a parameter of this function, it will calculate the square root of and it

124
00:11:36,770 --> 00:11:38,090
will return the number three.

125
00:11:40,120 --> 00:11:44,350
The root of number 36 is six.

126
00:11:48,150 --> 00:11:53,010
Square function, so the square function returns the square of a number.

127
00:11:54,040 --> 00:12:00,400
So the function accepts only one required parameter, and it must be a positive number in order to calculate

128
00:12:00,400 --> 00:12:01,450
the square of it.

129
00:12:03,830 --> 00:12:10,670
If the number three is used as the parameter of the square function, it means three times three equals

130
00:12:10,940 --> 00:12:11,420
nine.

131
00:12:17,080 --> 00:12:22,060
And if the number five is the parameter, it means five times five equals 25.

132
00:12:26,100 --> 00:12:30,030
Now, the last function that we're going to learn here is the sum function.

133
00:12:31,620 --> 00:12:36,660
Some function is an aggregate function that calculates the sum of a set of values.

134
00:12:39,140 --> 00:12:41,450
The sum function takes only one parameter.

135
00:12:43,030 --> 00:12:47,980
So let's find out the total of the list prices in the product table, shall we?

136
00:12:49,770 --> 00:12:55,380
All we have to do is set the list price column as a parameter of the sum function and then retrieve

137
00:12:55,380 --> 00:12:56,120
it from the table.

138
00:12:57,430 --> 00:13:01,600
Then the sum function will calculate the sum of the list prices.

139
00:13:03,440 --> 00:13:06,410
And here is the sum of all the list prices in the product table.

140
00:13:08,280 --> 00:13:09,240
That's pretty cool, huh?

141
00:13:10,020 --> 00:13:13,800
So we have now learned the math functions in this section.

142
00:13:15,340 --> 00:13:21,190
We're going to continue, though, because in the following section, we're going to learn you transaction's.

143
00:13:22,290 --> 00:13:23,220
All right, lots of fun.

144
00:13:23,340 --> 00:13:23,940
We'll see you there.
