_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › PostgreSQLJSON
|
|
[edit]
1 JSON 一危 #CREATE TABLE posts ( id serial NOT NULL, meta JSON ); レ valid? well-formed? json 伎伎 ル.
INSERT INTO posts (id, meta) VALUES ( 1, '{ "author": "outsider", "authorId": 43434, "sns": { "facebook": "https://facebook.com", "twitter": "https://twitter.com" }, "createAt": "2014-06-14", "category": ["pg", "tech", "dev"] }' ); [edit]
2 json vs jsonb #
[edit]
3 譟壱 #SELECT meta->'author' FROM posts; -- "outsider" SELECT meta->'sns'->'facebook' FROM posts; -- "https://facebook.com" SELECT meta->'sns'->>'facebook' FROM posts; -- https://facebook.com SELECT meta#>'{category, 2}' FROM posts; -- "dev"
鏤
|
轟 蟆 伎 覓語 伎企. (蠏碁殊) |