Overview
A delimiter is a character that separates text strings. Common delimiters are:- Commas (,)
- Semicolon (;)
- Quotes ( ”, ’ )
- Dash (-)
- Pipes (|)
- Slashes ( / \ ).
Syntax
The syntax for COPY FROM is as follows:table_name
: the table that will receive data from the file.file_path
: a link to the file location in the server.DELIMITER 'delimiter'
: the delimiter used in the CSV file.
Example
Let’s have a look at the step-by-step below:Step #1: Create a CSV File
First, you should create a CSV file and store it on your local computer. In this case, we use Dash ( - ) character to separate the text.create a table - 1.0 modify a table - 1.2 drop a table - 2.2 rename a table - 2.0
Step #2: Import FIle from Local to Server
You can use the syntax below for importing the file to the server:Step #3: Connect to Oxla Server
Connect to the Oxla server using the command below:Step #4: Create a Table
Before creating a table, check for duplicate tables with the statement below:Ensure you are not creating duplicate tables.