Check out example codes for "mysql Can't create/write to file '/home/results.csv' (Errcode: 13 "Permission denied")". It will help you in understanding the concepts better.

Code Example 1

-- If you are using linux,

SELECT id, filename
INTO OUTFILE '/tmp/results.csv'
FROM attachments
-- and find the csv file /tmp

Learn ReactJs, React Native from akashmittal.com