- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of MySQL TRUNCATE() function?
MySQL TRUNCATE() function is used to return the value of X truncated to D number of decimal places. If D is 0, then the decimal point is removed. If D is negative, then D number of values in the integer part of the value is truncated. Its syntax can be as follows −
Syntax
TRUNCATE(X, D)
Here
- X is a number which is to be truncated.
- D is the number up to which decimal places the number X has to be truncated.
Example
In the example below, it will truncate the given number up to 2 decimal places.
mysql> Select TRUNCATE(10.7336432,2); +-----------------------+ | TRUNCATE(10.736432,2) | +-----------------------+ | 10.73 | +-----------------------+ 1 row in set (0.00 sec)
Advertisements