integer - Restricting floating point values in sqlite3 -
i using sqlite3 , came across strange issue. example, have following table.
create table demo (effort integer); insert demo values (10.5); - works fine insert demo values (10.5); - works fine insert demo values (10.5555); - works fine
i have 2 concerns:
1.why allowing float values when have declared datatype integer not real ? 2.is there way, can restrict upto 2 decimal places?
is there workaround can restrict integer values(strictly no floating values).
please suggest.
sqlite uses dynamic typing.
to enforce column type, add constraint:
create table demo( effort integer not null check(typeof(effort) = 'integer') )