Last active
February 6, 2024 21:10
-
-
Save aaronmbos/4e2320859251cc3fe570465dda31e18c to your computer and use it in GitHub Desktop.
Script to follow along with "Querying JSON Data in PostgreSQL" blog post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE public.person | |
( | |
id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | |
personb jsonb NOT NULL, | |
person json | |
) | |
insert into person (personb, person) | |
values ( | |
'{"first_name": "Gladys", "last_name": "Perkins", "hobbies": ["Star Gazing", "Coding"]}', | |
'{"first_name": "Gladys", "last_name": "Perkins", "hobbies": ["Star Gazing", "Coding"]}' | |
); | |
insert into person (personb, person) | |
values ( | |
'{"first_name": "Fran", "last_name": "Allen", "pets": [{"name": "Charlie", "type": "dog"}, {"name": "Marshmallow", "type": "cat"}]}', | |
'{"first_name": "Fran", "last_name": "Allen", "pets": [{"name": "Charlie", "type": "dog"}, {"name": "Marshmallow", "type": "cat"}]}' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's missing an
;
in the end of line 6