10

How do I import a CSV file into postgres and make it skip the first line (it's just column titles).

I try:

\COPY products(sight, department) from 'coy.csv' with (FORMAT CSV);
4

1 回答 1

14

添加 HEADER 行将说明第一行是列标题。

COPY products (sight,department) FROM 'coy.csv' CSV HEADER;

http://www.postgresql.org/docs/current/static/sql-copy.html

于 2013-08-29T15:44:17.693 回答