● videoExtraction
Importing the Master Plan

Unlock PostgreSQL Fundamentals
2 hours of SQL video using NASA's Cassini data. See why developers become data pros.
SECTION
Extraction
NEXT UP
Inspecting the Master Plan
COURSE
PostgreSQL Fundamentals
28 lessons
About this lesson
When importing data into Postgres from a CSV, it's imperative that you do not try to alter the data - do that by explicitly transforming the data later on.
That means we need to import everything as text, because that's the core string type in Postgres (as opposed to text etc).
To create our schema and table:
create schema csvs;
create table csvs.master_plan(
start_time_utc text,
duration text,
date text,
team text,
spass_type text,
target text,
request_name text,
library_definition text,
title text,
description text
);
Copying data from a CSV into our new table:
copy csvs.master_plan
from '[Absolute path to]/csvs/master_plan.csv'
delimiter ',' header csv;
Unlock PostgreSQL Fundamentals
2 hours of SQL video using NASA's Cassini data. See why developers become data pros.