PostgreSQL TRUNC() function
TRUNC() function
The PostgreSQL trunc() function is used to truncate a number to a particular decimal places. If no decimal places are provided it truncate toward zero(0).
Syntax:
trunc()
PostgreSQL Version: 9.3
Pictorial presentation of PostgreSQL TRUNC() function

Example 1: PostgreSQL TRUNC() function
Code:
SELECT TRUNC(67.456) AS "Truncate";
Sample Output:
Truncate ---------- 67 (1 row)
Example 2: PostgreSQL TRUNC() function
Code:
SELECT TRUNC(67.456,1) AS "Truncate upto 1 decimal";
Sample Output:
Truncate upto 1 decimal ------------------------- 67.4 (1 row)
Example 3: PostgreSQL TRUNC() function
Code:
SELECT TRUNC(67.456,2) AS "Truncate upto 2 decimal";
Sample Output:
Truncate upto 2 decimal ------------------------- 67.45 (1 row)
Previous: TAN function
Next: PostgreSQL ARRAY functions ARRAY_APPEND function
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework