[oracle] 비만도 계산 create, insert, update, case when
*조건
1. 표준체중계산
(신장cm-100) X 0.9=표준체중, 표준체중에서 -5Kg~ +5Kg 는 정상입니다.
2. 비만도 측정방법
비만도(%) = 현재체중(kg) / 표준체중(kg)
*90~110% = 정상
*110~120% = 과체중으로 분류합니다.
*120~140% = 비만으로 분류합니다.
*140% 이상 = 저체중입니다
create table weight_info (
height number(3, 0),
c_weight number(3, 0),
s_weight number(3, 0),
bimando number(3, 0),
bigo varchar2(10)
);
insert into weight_info values (160, 50, 0, 0, '');
insert into weight_info values (170, 80, 0, 0, '');
insert into weight_info values (180, 75, 0, 0, '');
insert into weight_info values (190, 90, 0, 0, '');
insert into weight_info values (200, 85, 0, 0, '');
update weight_info set s_weight = ((height - 100) * 0.9);
update weight_info set bimando = (c_weight / s_weight) * 100;
update weight_info set bigo = (
case
when (bimando>=90) and (bimando<110) then '정상'
when (bimando>=110) and (bimando<120) then '과체중'
when (bimando>=120) and (bimando<140) then '비만'
when bimando>=140 then '저체중'
end
);