-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Brumm
committed
Aug 2, 2024
1 parent
3095791
commit 09eb406
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
JSON | ||
*/ | ||
|
||
--SQL 01 | ||
CREATE TABLE test_json ( | ||
id INTEGER, | ||
some_data JSON | ||
); | ||
|
||
--SQL 02 | ||
INSERT INTO test_json (id, some_data) | ||
VALUES (1, '{"color":"blue"}'); | ||
|
||
--SQL 03 | ||
SELECT id, some_data | ||
FROM test_json; | ||
|
||
--SQL 04 | ||
CREATE TABLE test_jsonb ( | ||
id INTEGER, | ||
some_data JSONB | ||
); | ||
|
||
--SQL 05 | ||
INSERT INTO test_jsonb (id, some_data) | ||
VALUES (1, '{"color":"blue"}'); | ||
|
||
--SQL 06 | ||
SELECT id, some_data | ||
FROM test_jsonb; | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
JSON Objects | ||
*/ | ||
|
||
--SQL 01 | ||
INSERT INTO test_jsonb (id, some_data) | ||
VALUES (3, '{"color":"blue", "size":"large"}'); | ||
|
||
--SQL 02 | ||
SELECT id, some_data | ||
FROM test_jsonb; | ||
|
||
--SQL 03 | ||
INSERT INTO test_jsonb (id, some_data) | ||
VALUES (3, '{"color":"white", "in_stock":"true"}'); | ||
|
||
--SQL 04 | ||
INSERT INTO test_jsonb (id, some_data) | ||
VALUES (4, '{"color":"white", "in_stock":"false", "supplier":{"supplier_name":"ABC Corp", "email":"[email protected]"}}'); |
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