TUTORIALS POINT
Simply Easy Learning
| 7 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
FORMAT(X,D)
The FORMAT() function is used to format the number X in the following format: ###,###,###.## truncated to D
decimal places. The following example demonstrates the use and output of the FORMAT() function:
SQL>SELECT FORMAT(423423234.65434453,2);
+---------------------------------------------------------+
| FORMAT(423423234.65434453,2) |
+---------------------------------------------------------+
| 423,423,234.65 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
GREATEST(n1,n2,n3,..........)
The GREATEST() function returns the greatest value in the set of input parameters (n1, n2, n3, a nd so on). The
following example uses the GREATEST() function to return the largest number from a set of numeric values:
SQL>SELECT GREATEST(3,5,1,8,33,99,34,55,67,43);
+---------------------------------------------------------+
| GREATEST(3,5,1,8,33,99,34,55,67,43) |
+---------------------------------------------------------+
| 99 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
INTERVAL(N,N1,N2,N3,..........)
The INTERVAL() function compares the value of N to the value list (N1, N2, N3, and so on ). The function returns 0
if N < N1, 1 if N < N2, 2 if N <N3, and so on. It will return -1 if N is NULL. The value list must be in the form N1 <
N2 < N3 in order to work properly. The following code is a simple example of how the INTERVAL() function works:
SQL>SELECT INTERVAL(6,1,2,3,4,5,6,7,8,9,10);
+---------------------------------------------------------+
| INTERVAL(6,1,2,3,4,5,6,7,8,9,10) |
+---------------------------------------------------------+
| 6 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
INTERVAL(N,N1,N2,N3,..........)
The INTERVAL() function compares the value of N to the value list (N1, N2, N3, and so on ). The function returns 0
if N < N1, 1 if N < N2, 2 if N <N3, and so on. It will return -1 if N is NULL. The value list must be in the form N1 <
N2 < N3 in order to work properly. The following code is a simple example of how the INTERVAL() function works:
SQL>SELECT INTERVAL(6,1,2,3,4,5,6,7,8,9,10);
+---------------------------------------------------------+
| INTERVAL(6,1,2,3,4,5,6,7,8,9,10) |
+---------------------------------------------------------+
| 6 |
+---------------------------------------------------------+