0

I have a 1 GB table, I need to output the db to multiple csv files based on column value. For instance:

c1              |   c2                  |   c3

1               |   a                   |   100    
2               |   b                   |   102    
3               |   a                   |   103    
4               |   b                   |   104

to be:

a.csv

1               |   a                   |   100    
3               |   a                   |   103

b.csv

2               |   b                   |   102
4               |   b                   |   104

considering the size of table, what's the most efficient way to do this?

Update: so far I have been able to do select * from table_name order by c2; and .mode csv .out a.csv select * from table_name; on a smaller sample of the dataset. I was wondering what are alternative except looping through all item manually.

2
  • What do you have so far? Commented May 10, 2014 at 2:56
  • First get it working, then run it through explain query plan, have a guess as to what you want, post it here, and people will be more willing to help you Commented May 10, 2014 at 2:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.