You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/14-reference/03-taos-sql/10-function.md
+53-2Lines changed: 53 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,6 +190,7 @@ ROUND(expr[, digits])
190
190
-`digits` less than zero means discarding the decimal places and rounding the number to the left of the decimal point by `digits` places. If the number of places to the left of the decimal point is less than `digits`, returns 0.
191
191
- Since the DECIMAL type is not yet supported, this function will use DOUBLE and FLOAT to represent results containing decimals, but DOUBLE and FLOAT have precision limits, and using this function may be meaningless when there are too many digits.
192
192
- Can only be used with regular columns, selection (Selection), projection (Projection) functions, and cannot be used with aggregation (Aggregation) functions.
193
+
-`digits` is supported from version 3.3.3.0.
193
194
194
195
**Example**:
195
196
@@ -249,6 +250,8 @@ TAN(expr)
249
250
250
251
**Function Description**: Obtains the tangent result of the specified field.
251
252
253
+
**Version**: ver-3.3.3.0
254
+
252
255
**Return Result Type**: DOUBLE.
253
256
254
257
**Applicable Data Types**: Numeric types.
@@ -297,6 +300,8 @@ TRUNCATE(expr, digits)
297
300
298
301
**Function Description**: Gets the truncated value of the specified field to the specified number of digits.
299
302
303
+
**Version**: ver-3.3.3.0
304
+
300
305
**Return Type**: Consistent with the original data type of the `expr` field.
301
306
302
307
**Applicable Data Types**:
@@ -340,6 +345,8 @@ EXP(expr)
340
345
341
346
**Function Description**: Returns the value of e (the base of natural logarithms) raised to the specified power.
342
347
348
+
**Version**: ver-3.3.3.0
349
+
343
350
**Return Type**: DOUBLE.
344
351
345
352
**Applicable Data Types**: Numeric type.
@@ -370,6 +377,8 @@ LN(expr)
370
377
371
378
**Function Description**: Returns the natural logarithm of the specified parameter.
372
379
380
+
**Version**: ver-3.3.3.0
381
+
373
382
**Return Type**: DOUBLE.
374
383
375
384
**Applicable Data Types**: Numeric type.
@@ -401,6 +410,8 @@ MOD(expr1, expr2)
401
410
402
411
**Function Description**: Calculates the result of expr1 % expr2.
403
412
413
+
**Version**: ver-3.3.3.0
414
+
404
415
**Return Type**: DOUBLE.
405
416
406
417
**Applicable Data Types**: Numeric type.
@@ -437,6 +448,8 @@ RAND([seed])
437
448
438
449
**Function Description**: Returns a uniformly distributed random number from 0 to 1.
439
450
451
+
**Version**: ver-3.3.3.0
452
+
440
453
**Return Result Type**: DOUBLE.
441
454
442
455
**Applicable Data Types**:
@@ -484,6 +497,8 @@ SIGN(expr)
484
497
485
498
**Function Description**: Returns the sign of the specified parameter.
486
499
500
+
**Version**: ver-3.3.3.0
501
+
487
502
**Return Result Type**: Consistent with the original data type of the specified field.
488
503
489
504
**Applicable Data Types**: Numeric types.
@@ -527,6 +542,8 @@ DEGREES(expr)
527
542
528
543
**Function Description**: Calculates the value of the specified parameter converted from radians to degrees.
529
544
545
+
**Version**: ver-3.3.3.0
546
+
530
547
**Return Result Type**: DOUBLE.
531
548
532
549
**Applicable Data Types**: Numeric types.
@@ -558,6 +575,8 @@ RADIANS(expr)
558
575
559
576
**Function Description**: Calculates the value of the specified parameter converted from degrees to radians.
560
577
578
+
**Version**: ver-3.3.3.0
579
+
561
580
**Return Type**: DOUBLE.
562
581
563
582
**Applicable Data Types**: Numeric types.
@@ -729,6 +748,8 @@ TRIM([remstr FROM] expr)
729
748
730
749
**Function Description**: Returns the string expr with all prefixes or suffixes of remstr removed.
731
750
751
+
**Version**: ver-3.3.3.0
752
+
732
753
**Return Result Type**: Same as the original type of the input field expr.
733
754
734
755
**Applicable Data Types**:
@@ -807,6 +828,8 @@ SUBSTRING/SUBSTR(expr FROM pos [FOR len])
807
828
- If `len` is less than 1, returns an empty string.
808
829
-`pos` is 1-based; if `pos` is 0, returns an empty string.
809
830
- If `pos` + `len` exceeds `len(expr)`, returns the substring from `pos` to the end of the string, equivalent to executing `substring(expr, pos)`.
831
+
- Function `SUBSTRING` is equal to `SUBSTR`, supported from ver-3.3.3.0.
832
+
- Syntax `SUBSTRING/SUBSTR(expr FROM pos [FOR len])` is supported from ver-3.3.3.0.
-`expr1`: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 standard date-time format.
1320
1355
-`expr2`: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 standard date-time format.
1321
1356
-`time_unit`: See usage instructions.
1357
+
-`timediff` return the absolute value of the difference between timestamp `expr1` and `expr2` before ver-3.3.3.0.
1322
1358
1323
1359
**Nested Subquery Support**: Applicable to both inner and outer queries.
1324
1360
@@ -1423,6 +1459,8 @@ WEEK(expr [, mode])
1423
1459
1424
1460
**Function Description**: Returns the week number of the input date.
1425
1461
1462
+
**Version**: ver-3.3.3.0
1463
+
1426
1464
**Return Result Type**: BIGINT.
1427
1465
1428
1466
**Applicable Data Types**:
@@ -1490,6 +1528,8 @@ WEEKOFYEAR(expr)
1490
1528
1491
1529
**Function Description**: Returns the week number of the input date.
1492
1530
1531
+
**Version**: ver-3.3.3.0
1532
+
1493
1533
**Return Type**: BIGINT.
1494
1534
1495
1535
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
@@ -1521,6 +1561,8 @@ WEEKDAY(expr)
1521
1561
1522
1562
**Function Description**: Returns the weekday of the input date.
1523
1563
1564
+
**Version**: ver-3.3.3.0
1565
+
1524
1566
**Return Type**: BIGINT.
1525
1567
1526
1568
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
@@ -1552,6 +1594,8 @@ DAYOFWEEK(expr)
1552
1594
1553
1595
**Function Description**: Returns the weekday of the input date.
1554
1596
1597
+
**Version**: ver-3.3.3.0
1598
+
1555
1599
**Return Type**: BIGINT.
1556
1600
1557
1601
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
@@ -1707,6 +1751,9 @@ STDDEV/STDDEV_POP(expr)
1707
1751
1708
1752
**Applicable to**: Tables and supertables.
1709
1753
1754
+
**Description**:
1755
+
- Function `STDDEV_POP` equals `STDDEV` and is supported from ver-3.3.3.0.
1756
+
1710
1757
**Example**:
1711
1758
1712
1759
```sql
@@ -1733,6 +1780,8 @@ VAR_POP(expr)
1733
1780
1734
1781
**Function Description**: Calculates the population variance of a column in a table.
1735
1782
1783
+
**Version**: ver-3.3.3.0
1784
+
1736
1785
**Return Data Type**: DOUBLE.
1737
1786
1738
1787
**Applicable Data Types**: Numeric types.
@@ -1975,7 +2024,8 @@ MAX(expr)
1975
2024
1976
2025
**Applicable to**: Tables and supertables.
1977
2026
1978
-
**Usage Instructions**: The max function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value.
2027
+
**Usage Instructions**:
2028
+
- The max function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value(supported from ver-3.3.3.0, function `max` only accept numeric parameter before ver-3.3.3.0).
1979
2029
1980
2030
### MIN
1981
2031
@@ -1991,7 +2041,8 @@ MIN(expr)
1991
2041
1992
2042
**Applicable to**: Tables and supertables.
1993
2043
1994
-
**Usage Instructions**: The min function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value.
2044
+
**Usage Instructions**:
2045
+
- The min function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value(supported from ver-3.3.3.0, function `min` only accept numeric parameter before ver-3.3.3.0).
0 commit comments