jamespakorn / jamespakorn/hdc-sql

create function

Open
#11 0 comments 0 reactions 0 assignees View on GitHub
build
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

---Function nutri_cal()---
BEGIN
DECLARE chkrs int(1) DEFAULT 0;
DECLARE ay int(3) DEFAULT 0;
DECLARE am int(2) DEFAULT 0;

SET chkrs=NULL;
SET ay=truncate(agem/12,0);
SET am=MOD(agem,12);

IF ntype=1 THEN
SELECT nutri_level INTO chkrs FROM cwhpa_referen WHERE year=ay AND month=am AND sex=isex AND nutri_type='1' AND (w BETWEEN low AND hi)=1;
END IF;

IF ntype=2 THEN
SELECT nutri_level INTO chkrs FROM cwhpa_referen WHERE year=ay AND month=am AND sex=isex AND nutri_type='2' AND (h BETWEEN low AND hi)=1;
END IF;

IF ntype=3 THEN
SELECT nutri_level INTO chkrs FROM cwh_referen WHERE (ay BETWEEN age_low AND age_max)=1 AND sex=isex AND h=height AND (w BETWEEN weight_low AND weight_max)=1;
END IF;

RETURN chkrs;
END

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue defines the SQL function nutri_cal() and references the cwhpa_referen and cwh_referen tables. Start by locating the schema or SQL entry point for these tables, then verify the function's inputs and its nutri_level result for ntype values 1, 2, and 3.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
database
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.