mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Add truncate and trunc functions usage
This commit is contained in:
parent
d613a1d623
commit
2d6c51578a
@ -26,6 +26,37 @@ Returns the smallest round number that is greater than or equal to `x`. In every
|
||||
|
||||
Returns the round number with largest absolute value that has an absolute value less than or equal to `x`‘s. In every other way, it is the same as the ’floor’ function (see above).
|
||||
|
||||
**Syntax**
|
||||
|
||||
```sql
|
||||
trunc(input, precision)
|
||||
```
|
||||
|
||||
Alias: `truncate`.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `input`: A float type [Float](/docs/en/sql-reference/data-types/float.md).
|
||||
- `precision`: A decimal type [Decimal](/docs/en/sql-reference/data-types/decimal.md).
|
||||
|
||||
**Returned value**
|
||||
|
||||
- A [Float64](/docs/en/sql-reference/data-types/float.md) value.
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
SELECT trunc(123.45, 1) as res;
|
||||
```
|
||||
|
||||
```response
|
||||
┌───res─┐
|
||||
│ 123.4 │
|
||||
└───────┘
|
||||
```
|
||||
|
||||
## round(x\[, N\])
|
||||
|
||||
Rounds a value to a specified number of decimal places.
|
||||
|
Loading…
Reference in New Issue
Block a user