Import .csv Into Psql

I had to import the list of the students of my school into Postgresql, so I converted xlsx files to a csv file and imported into psql.

Log in DB and type the follwing line:

1
\copy students(grade, class, number, name) from '/home/bombwhale/Downloads/list/students.csv' delimiter ',' csv header;

\copy is client-side command. Lots of posts were told me to use COPY command, but the COPY command brought file access permission denied error.

students which is next to \copy is a table name. You may specify columns in a csv file like the example command. There were 4 columns that I wrote in the csv file: grade, class, number, name.

댓글을 불러올까요?