How to save MySQL query output to excel or .txt file?

Web Development

How do you save output of a MySQL query to a MS Excel sheet?

Even if it's only possible to store the data in a .txt file, it will be okay.

1
Answers

Replies

Ans:  The below code can be used to save the MySQL query to excel or .text file.


SELECT ... FROM ... WHERE ... 


INTO OUTFILE 'textfile.csv'


FIELDS TERMINATED BY '|'


The above code will export the result to CSV and then export to Excel.

 
 

If you want to unleash your potential in this competitive field, please visit the Web Development course page for more information, where you can find the Web Development tutorials and Web Development frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.