Exercise: The COPY Command
Practice using the COPY command to load data into a PostgreSQL database.
In this exercise, we’ll practice using the COPY
command to load data into a PostgreSQL database. Our task is to create a table named cars
and a function that loads a CSV file into it.
This function will be a part of the load step in an ETL pipeline that uses full loads. Therefore, we need to truncate the table each time we load new data.
Create a table
The CSV file called cars.csv
contains a million records, and has the following format:
Get hands-on with 1400+ tech skills courses.