How to import CSV file data into PostgreSQL table on Windows

Trabla: How to import CSV file data into PostgreSQL table on Windows 


How to import CSV file data into PostgreSQL table on Windows

Solving:


Watch on YouTube

NOTE: resources used in tutorial:

1. SQL script to create table

CREATE TABLE tbl_users
(
  id bigserial NOT NULL PRIMARY KEY,
  full_name character varying(500),
  email character varying(200),
  birth_date date
);

2. Content of CSV file ( USERS.csv )

full_name,email,birth_date
Tony Johnson,tony.j@mail.com,1986-10-12
Lisa Simphony,lisa123@mail.com,1979-11-01
Alen Lee,alenlee@mail.com,1990-01-20

3. SQL command to copy data from CSV into table

COPY tbl_users ( full_name, email, birth_date )
FROM 'C:\\Users\\Public\\Documents\\USERS.csv' DELIMITER ',' CSV HEADER;



No comments:

Post a Comment