Check out example codes for "define a variable in mysql from select". It will help you in understanding the concepts better.

Code Example 1

SELECT salary INTO @variable1 FROM employee_info WHERE emp_id = 12345678 LIMIT 1;
SELECT salary, salary_group INTO @var1, @var2 FROM employee_info WHERE emp_id = 12345678;

Learn ReactJs, React Native from akashmittal.com