Check out example codes for "mysql insert into select with recursive". It will help you in understanding the concepts better.

Code Example 1

INSERT cte_populated(id)
WITH  RECURSIVE int_seq AS (
SELECT 1 AS val
UNION ALL
SELECT val + 1
FROM int_seq
WHERE val  < 10
)
SELECT int_seq.val FROM int_seq;

Learn ReactJs, React Native from akashmittal.com