I am trying to export a table from MariaDB to a folder in CSV format. In MariaDB program, I entered the query: MariaDB [testdatabase]> SELECT * from datatable into outfile '/tmp/exportf.csv';
I then managed to locate this exported file. However, on opening the csv file with Excel, I find that the data are all clustered onto one column. These should be organised into 7 columns. How can I modify my query to avoid this issue?
try this,
SELECT * from datatable into outfile '/tmp/exportf.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' ;
I'm trying to select 4 different random data from a table on Mysql but I want some fields unique, for example;
If we have a table T1 with a field named orders have data type as Text