Check out example codes for "mysql export query result to csv". It will help you in understanding the concepts better.

Code Example 1

SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/var/lib/mysql-files/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Learn ReactJs, React Native from akashmittal.com