# Pastebin 8KXxMbQm $ perl6 -MRed -e ' model B is table { ... } model A is table { has UInt $.id is serial; has B @.bs is relationship{ .a-id } } model B { has UInt $.id is serial; has UInt $.a-id is referencing{ A.id }; has A $.a is relationship{ .a-id } } my $*RED-DB = database "SQLite"; A.^create-table; B.^create-table; my $a = A.^create; given $a { .bs.create; .bs.create; .bs.create } my $*RED-DEBUG = True; .say for $a.bs.map: *.id ' SQL : SELECT bbb.id as "data_1" FROM bbb WHERE bbb.a_id = ? BIND: [1] 1 2 3