June 2017
Beginner to intermediate
576 pages
15h 22m
English
The SQL window allows us to utilize all of the benefits of standard SQL. That includes the ability to create new columns. In this example, we query the entire table and compute the average mass split by high mass (>30), and low mass (<-30).
In this way, we can see that the mean mass is higher at the upper end for diabetes patients than for the non-diabetes patients. The same seems to be true at the low end:
%sql select case when mass > 30 then "BMI_HIGH" else "BMI_LOW" end as BMICAT, outcome,avg(mass) from out_tbl group by 1,2
