데이타베이스/SQLite

sqlite 나누기 연산시 무조건 정수로만 나오는 문제점

유키공 2018. 10. 27. 13:30

sqlite3 에서 연산시 Decimal 로 나오는 문제.

select foreigner,volume from stockInfo where name='웅진씽크빅';
--foreigner : 83939
--volume : 541140
select foreigner/volume from stockInfo where name='웅진씽크빅';
--0
--해결책
select (foreigner+0.00)/(volume+0.00) from stockInfo where name='웅진씽크빅';
--0.155115127323798