Export a SQL database into a CSV file and use it with WEKA

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2012-09-15T15:42:08Z Indexed on 2012/09/15 21:38 UTC
Read the original article Hit count: 326

Filed under:
|
|
|

How can I export a query result from a .sql database into a .csv file? I tried with

SELECT * 
FROM players 
  INTO OUTFILE 'players.csv' 
  FIELDS TERMINATED BY ',' 
  LINES TERMINATED BY ';';` 

and my .csv file is something like:

p1,1,2,3
p2,1,4,5

But they are not in saparated columns, all are in 1 column.

I tried to create a .csv file by myself just to try WEKA, something like:

p1  1  2  3
p2  1  4  5

But WEKA recognizes p1 1 2 3 as a single attribute.

So: how can I export correctly a table from a sql db to a csv file? And how can I use it with WEKA?

© Stack Overflow or respective owner

Related posts about sql

Related posts about database