mysql query return excel file

Solutions on MaxInterview for mysql query return excel file by the best coders in the world

showing results for - "mysql query return excel file"
Marsha
04 Nov 2020
1#Before exectue query in sql run following command:
2sudo chmod 755 -R /var/lib/mysql/
3
4#run query in mysql
5SELECT ... FROM ... WHERE ... 
6INTO OUTFILE 'file.csv'
7FIELDS TERMINATED BY ','
8OPTIONALLY ENCLOSED BY '"'
9LINES TERMINATED BY '\n';
10
11#Then Open Excel and click on Data tab, 
12#Click the From Text/CSV button,
13#Navigate to the location of the exported .csv file and click Import
14#Choose appropriate delimiter "comma"and click Transform Data
15#Update column name, Close & Load.
16