Skip to content
Advertisement

Find floating-point numbers

I have a table Balance with a column Coins of double type in my MySql database. However, in fact, I store int values there. So, I want to change the type from double to int. But before, I want to be 100% sure that there are no floating-point numbers in this column.

What kind of SQL request should I write to achieve this?

Advertisement

Answer

You can use:

select coins
from balance
where coins <> floor(coins);
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement