With these tables in place, join them to get more information about an order by combining it with the customer information found in the customer table:
SELECT
o._key AS orderNumber
, o.amount AS totalAmount
, c.firstName
, c.lastName
, c.city
, c.country
FROM orders o INNER JOIN customer c
ON o.customerId = c._key
/*
city orderNumber country totalAmount lastName firstName
New York 1 USA 200.5 Smith Craig
New York 2 USA 813 Smith Craig
Leeds 3 UK 625.2 Anthony William
Rio De Janeiro 6 Brazil 444.8 de Ellis Marquis
Houston 5 USA 440 Milton Joseph
London 4 UK 730 Wilde C. J.
*/
Lateral Joins
With lateral joins, Lenses allows you to combine records from a table with the elements of an array expression.
We are going to see in more detail what lateral joins are with an example.
Create a batched_readings table and insert some data into it: