Wrong datatype on generated column

There are five INTEGER columns in my database. I am trying to add a generated column by doing this:
myDB.executeSQL("ALTER TABLE tblMain ADD avgValue REAL GENERATED ALWAYS AS ((col1 + col2 + col3 + col4 + col5)/10);")

I can put whatever I want as the datatype, REAL or DOUBLE or anything else, it doesn’t matter, the generated column always ends up as an INTEGER. Why is that?

Edit: sorry, forgot to mention it’s a SQLite Database.

Have you looked here:

https://www.sqlite.org/lang_altertable.html

Yes, I don’t find any hints what the problem could be though.

The final operation is divide by integer so SQLite leaves it that way.
Try like this:
((col1 + col2 + col3 + col4 + col5)/10.0)

1 Like

You could ask on the SQLite Users’ forum:

https://www.sqlite.org/forum/

Awesome, that’s the solution. Thank you!