PostgreSQL copy command with examples

In this article, we will see PostgreSQL copy command with examples.
PostgreSQL COPY command moves data between PostgreSQL tables and standard file-system files. COPY TO copies the contents of a table to a file, while COPY FROM copies data from a file to a table (appending the data to whatever is in the table already). COPY TO can also copy the results of a SELECT query.

COPY FROM syntax:
Continue reading PostgreSQL copy command with examples

How to export PostgreSQL data to csv or excel file

In this article, we will see how to export PostgreSQL data to csv or excel file. COPY command is used to copy data between a file and a table in PostgreSQL.

Syntax to export data from a table to csv or excel or any other file formats:
Continue reading How to export PostgreSQL data to csv or excel file

How to import CSV file data into PostgreSQL table

In this article, we will see How to import CSV file data into PostgreSQL table. It is nothing but loading data from a spreadsheet.

1. Create table

CREATE TABLE student(sno int primary key, sname varchar(50), sage int, dob date);

Continue reading How to import CSV file data into PostgreSQL table