# Data Load and Import

## Loading

#### Multiple rows insert

The `INSERT` statement allows you to insert multiple rows into a table using a single statement as the following:

```sql
INSERT INTO table_name(column1,column2…)
VALUES (value1,value2,…),
       (value1,value2,…),
```

```sql
INSERT INTO shippers(companyName,phone)
VALUES ('UPS','1-800-782-7892'),
       ('DHL','1-800-225-5345')
```

#### Load CSV

Utilizing PostgreSQL's COPY command is recommended when working with extensive data collections.

* The data is imported directly from a file into a table.
* Various file formats can be utilised for transferring data, such as text, CSV, binary, and JSON.

```sql
psql -h DATABASE_URL -p 5432 -d postgres -U postgres \
 -c "\COPY projects FROM './projects.csv';"
```

Additionally use the `DELIMITER`, `HEADER` and `FORMAT` options as defined in the PostgreSQL [COPY](https://www.postgresql.org/docs/current/sql-copy.html) docs.

```sql
psql -h DATABASE_URL -p 5432 -d postgres -U postgres \
  -c "\COPY projects FROM './projects.csv' WITH DELIMITER ',' CSV HEADER"
```

If you encounter the error message "FATAL: password authentication failed for user 'postgres'", it is recommended to reset your database password in the Database Settings and attempt to log in again.

## Importing

The Appizap dashboard offers a convenient interface for importing data, though it may not be the optimal choice for very large datasets due to its 100MB size limitation. This tool is better suited for smaller datasets and expedited data imports. Those dealing with substantial data sets may want to explore alternative approaches such as pgloader for more efficient data importing.

* Locate the table within the Table Editor interface.
* Click on “Insert” then choose "Import Data from CSV" and follow the on-screen instructions to upload your CSV file.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2FyCcWb57mBx2UG8jgDYbG%2Fimage.png?alt=media&#x26;token=7d4f6d6e-1c26-4d3f-b179-b60a19e39364" alt=""><figcaption></figcaption></figure>

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2F36ZAL4viikJQBSoJAFWi%2Fimage.png?alt=media&#x26;token=13c18abe-732c-40d2-a769-fa68e48e2639" alt=""><figcaption></figcaption></figure>
