Check out example codes for "how to store the query result in a variable sql". It will help you in understanding the concepts better.

Code Example 1

SET @anyVariableName = ( yourQuery);

Learn ReactJs, React Native from akashmittal.com