Using Copy to import

suggest change

To Copy Data from a CSV file to a table

COPY <tablename> FROM '<filename with path>';

To insert into table user from a file named user_data.csv placed inside /home/user/:

COPY user FROM '/home/user/user_data.csv';

To Copy data from pipe separated file to table

COPY user FROM '/home/user/user_data' WITH DELIMITER '|';

Note: In absence of the option with delimiter, the default delimiter is comma ,

To ignore header line while importing file

Use the Header option:

COPY user FROM '/home/user/user_data' WITH DELIMITER '|' HEADER;

Note: If data is quoted, by default data quoting characters are double quote. If the data is quoted using any other character use the QUOTE option; however, this option is allowed only when using CSV format.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents