Ask Your Question
0

Export table from base to cvs

asked 2018-10-28 09:33:10 +0200

EasyTrieve gravatar image

How does one export a table from base into a new cvs file?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-10-28 09:33:30 +0200

EasyTrieve gravatar image

updated 2018-10-28 09:37:23 +0200

For MariaDb (and MySQL) use something like this:

SELECT *
FROM `address cities`
INTO OUTFILE '/tmp/test.csv' 
FIELDS ENCLOSED BY '"' 
TERMINATED BY ';' 
ESCAPED BY '"' 
LINES TERMINATED BY '\r\n';

Where in this example, `address cities` is the table to read and then output to CVS (C-omma S-eparated V-alues), and '/tmp/test.csv' is the created cvs pathname.*




Formatting issues that affect the text of the answer above:

(Bold doesn't work very well in ask.libreoffice.org web site. Above I can't bold just the first letter of the word Comma, without it trying to bold the whole word. So that's why you see the 'C dash omma' used as an unfortunate workaround.

Also it seems impossible to include back ticks in code fields (the things in red). I tried back slash and multiple back ticks, but all my attempts to make address cities in backticks and in red failed. Best I could do was to escape the back ticks with a back slash, but this would not allow them to be red in color.)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-10-28 09:33:10 +0200

Seen: 30 times

Last updated: Oct 28 '18