SELECT table content to file
SELECT table content to file in Mysql:
Using SELECT … INTO OUTFILE query,We can SELECT and writes the selected rows to a file. The file is created on the server host, so you must have the FILE privilege to use this syntax. you should use a command such as mysql -e “SELECT …” > file_name to generate the file on the client host.
Syntax:
[SELECT query] INTO OUTFILE [file_name];
Example:
1. SELECT * from students where mark1>75 INTO OUTFILE “first_class.txt”;
2. mysql -u root -p -h 192.168.0.9 school -e “SELECT * from students where mark1 > 75″ > “first_class.txt”;
