I am new to SQLite. When I use MySQL, it's reasonable to use count(*)/5. However, in SQLite, I try to calculate count(Name)/5 but the result shows zero.

I don't know why this won't work. Is there any way to calculate this?
CodePudding user response:
Because COUNT returns an integer, and 5 is an integer. As seen here: You will have to either cast it, or simply add a decimal to /5.0. Now it will no longer be limited to integers.
Cheers!
CodePudding user response:
If the operands are both integers, SQLite does integer division. So, just make one operand a float:
SELECT COUNT(name)/5. FROM demo

