so I'm currently learning SQL and one of the exercies was to:
Show patient_id, weight, height, isObese from the patients table. Display isObese as a boolean 0 or 1. Obese is defined as weight(kg)/(height(m)2) >= 30. Weight is in units kg and height in units cm.
I managed to do it this way:
SELECT patient_id, weight, height,
CASE
WHEN weight/POWER(height/100,2) >= 30 then '1'
ELSE '0' END AS isObese
FROM patients
and it was incorrect. The correct solution was to write: weight/POWER(height/100.0,2). So my question is why I have to divide by 100.0 instead of 100 to change from centimeters to meters? What is the difference? In this table every height value was an int type, without decimal numbers.