When you export data from a table to a CSV file using the COPY TO
command, you can include or skip the header. Oxla provides three options for handling headers: HEADER OFF
, HEADER ON
, and HEADER MATCH
.
The syntax for COPY TO
with HEADER
is as follows:
Parameters in the syntax include:
table_name
: The table containing the data to be exported.file_path
: The CSV file location where the data will be saved.Header_Syntax
: The specified header options.This option will not skip the header of the CSV file. The available syntax is:
HEADER
is not provided.This option skips the header of the CSV file and follows only the previously specified columns. The available syntax is:
First, create a “personal_details” table.
The table and data were created successfully.
Now, let’s explore some cases of COPY TO
with different header options:
personalinfo
file without considering the first row as a header.HEADER ON
option.When you export data from a table to a CSV file using the COPY TO
command, you can include or skip the header. Oxla provides three options for handling headers: HEADER OFF
, HEADER ON
, and HEADER MATCH
.
The syntax for COPY TO
with HEADER
is as follows:
Parameters in the syntax include:
table_name
: The table containing the data to be exported.file_path
: The CSV file location where the data will be saved.Header_Syntax
: The specified header options.This option will not skip the header of the CSV file. The available syntax is:
HEADER
is not provided.This option skips the header of the CSV file and follows only the previously specified columns. The available syntax is:
First, create a “personal_details” table.
The table and data were created successfully.
Now, let’s explore some cases of COPY TO
with different header options:
personalinfo
file without considering the first row as a header.HEADER ON
option.