Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove digits after decimal in a table in SQLite database

I have a database but in one column there are floating numbers. I want to remove the digits after the decimal point in a table in SQLite database. What query should be used to remove the digits after the decimal?

like image 582
Navdeep Avatar asked Dec 16 '22 08:12

Navdeep


1 Answers

For round value: (2.34 = 2, 2.89 = 3)

SELECT round(column) FROM sample

For Floor value: (2.34 = 2, 2.89 = 2)

SELECT cast(column as int) FROM sample

Is this what you want ?

like image 161
Vrashabh Irde Avatar answered Jun 06 '23 03:06

Vrashabh Irde