May 2017
Beginner to intermediate
328 pages
7h 17m
English
In order to export the data in interactive mode, we first need to connect to the database using psql:
psql -h localhost -p 5434 -U postgres
Then type the following:
\c mastering_postgis
Once connected, we can execute a simple command:
\copy data_import.earthquakes_csv TO earthquakes.csv WITH DELIMITER ';' CSV HEADER
The preceding command exported a data_import. earthquakes_csv table to a file named earthquakes.csv, with ';' as a column separator. A header in the form of column names has also been added to the beginning of the file. The output should be similar to the following:
COPY 50
Basically, the database told us how many records have been exported. The content of the exported file should exactly ...
Read now
Unlock full access