This file contains hidden or 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
PREPARE prep_1 AS SELECT json_agg(r.*) FROM ( | |
SELECT | |
album.title as title, | |
json_agg(track.*) as tracks | |
FROM | |
album | |
LEFT OUTER JOIN | |
track | |
ON | |
(album.id = track.album_id) |
This file contains hidden or 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
{ | |
album (where: {year: {_eq: 2018}}) { | |
title | |
tracks { | |
id | |
title | |
} | |
} | |
} |
This file contains hidden or 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
SELECT json_agg(r.*) FROM ( | |
SELECT | |
album.title as title, | |
json_agg(track.*) as tracks | |
FROM | |
album | |
LEFT OUTER JOIN | |
track | |
ON | |
(album.id = track.album_id) |
This file contains hidden or 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
[ | |
{ | |
"title" : "Album1", | |
"tracks": [ | |
{"id" : 1, "title": "track1"}, | |
{"id" : 2, "title": "track2"} | |
] | |
}, | |
{ | |
"title" : "Album2", |
This file contains hidden or 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
SELECT | |
album.id as album_id, | |
album.title as album_title, | |
track.id as track_id, | |
track.title as track_title | |
FROM | |
album | |
LEFT OUTER JOIN | |
track | |
ON |
This file contains hidden or 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
select id, title from tracks where album_id IN {the list of album ids} |
This file contains hidden or 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
select id,title from album where year = 2018; |
This file contains hidden or 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
select id, title from tracks where album_id = <album-id> |
This file contains hidden or 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
select id,title from album where year = 2018; |
This file contains hidden or 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
{ | |
album (where: {year: {_eq: 2018}}) { | |
title | |
tracks { | |
id | |
title | |
} | |
} | |
} |