Greetings.
I am from RDBMS background (MS SQL Server to be specific). I am trying to understand Lookup Join using N1QL but no luck.
I am referring two sample queries:
SELECT airline.name, airline.callsign, route.destinationairport, route.stops, route.airline
FROM `travel-sample` route JOIN `travel-sample` airline ON KEYS route.airlineid
WHERE route.type = "route"
AND airline.type = "airline"
AND route.sourceairport = "SFO"
AND route.stops = 0
LIMIT 4;
In travel-sample bucket, there is no field by name “airlineid” in documents with type = “airline”. Then how route is mapped with airline?
In another example,
select br.name brewery, b.name beer, b.style style
from `beer-sample` b join `beer-sample` br on keys b.brewery_id
where br.name = "Yards Brewing" order by beer, style;
We have brewery_id field in document with type = beer but no mapping field in document with type = brewery.
How Couchbase server does this mapping?
I am trying to get N1QL equivalent of “select * from beer b join brewery br on b.brewery_id = br.brewery_id”
Your help is much appreciated.
Thanks in advance.
Regards,
Satish