Introduction to NoSQL
Jake Roach
Data Engineer
INSERT INTO students (school, age, address, parent_meta) VALUES (
'GP',
18,
'U',
'{\"guardian\": \"mother\", ... \"P2\": \"at_home\"}}'
);
Populate a table with contents of a file using COPY ... FROM
COPY students FROM 'students.csv' DELIMITER ',' CSV, HEADER;
row_to_json
function
JSON
row()
function, and pass column namesSELECT
row_to_json(row(
school,
age,
address
))
FROM students;
json_object_keys
function
JSON
SELECT
json_object_keys(parent_meta)
FROM students;
DISTINCT
to find all unique keysSELECT
DISTINCT json_object_keys(parent_meta)
FROM students;
SELECT
row_to_json(row(
<column-1>,
<column-2>,
...
))
FROM <table-name>;
SELECT
DISTINCT json_object_keys(parent_meta)
FROM <table-name>;
Introduction to NoSQL