Commit 5d056f69 authored by Gaetan Carabetta's avatar Gaetan Carabetta

update json

parent 2ffbb9e0
......@@ -28,11 +28,21 @@ INSERT INTO animal VALUES (
"medicaments":[
{
"nom": "LEVOTHYROX",
"quantité": 4
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 4
}
},
{
"nom": "DOLIPRANE",
"quantité": 3
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 3
}
}
]
},
......@@ -45,15 +55,30 @@ INSERT INTO animal VALUES (
"medicaments":[
{
"nom": "LEVOTHYROX",
"quantité": 4
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 4
}
},
{
"nom": "DOLIPRANE",
"quantité": 3
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 3
}
},
{
"nom": "LEVOTHYROX",
"quantité": 2
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 2
}
}
]
}
......@@ -73,11 +98,21 @@ INSERT INTO animal VALUES (
"medicaments":[
{
"nom": "IMODIUM",
"quantité": 2
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 2
}
},
{
"nom": "FORLAX",
"quantité": 3
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 3
}
}
]
}
......@@ -96,7 +131,12 @@ INSERT INTO animal VALUES (
"medicaments":[
{
"nom": "PLAVIX",
"quantité": 2
"posologie":
{
"debut": "2019-06-17",
"duree": 10,
"quantité": 2
}
}
]
}
......
/*
Exemple de requête pour récupérer des éléments
d'un tableau dans un tableau JSON
*/
select m->>'nom'
from animal a, json_array_elements(a.traitements) t, json_array_elements(t->'medicaments') m;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment