Create a Table in Postgres
CREATE TABLE persons (
id SERIAL,
first_name VARCHAR(50),
last_name VARCHAR(50),
dob DATE,
email VARCHAR(255),
PRIMARY KEY (id) );
Create or Import csv file
I am creating here...
vi emp.csv
First Name,Last Name, DOB,Email
Abhishek, Yadav,18-Dec-1982,abhishek.yadav@clotatechnology.com
Deepak, Varma,20-Jan-1982,Deepak.Verma@clotatechnology.com
Connect PostgreSQL and execute below command to import the csv file into persons table
COPY persons(first_name, last_name, dob, email) from '/var/lib/pgsql/emp.csv' DELIMITER ',' CSV HEADER;
No comments:
Post a Comment
If you have any doubt or question, please contact us.