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.countryFROM orders o INNER JOIN customer cON o.customerId = c._key/*city orderNumber country totalAmount lastName firstNameNew York 1 USA 200.5 Smith CraigNew York 2 USA 813 Smith CraigLeeds 3 UK 625.2 Anthony WilliamRio De Janeiro 6 Brazil 444.8 de Ellis MarquisHouston 5 USA 440 Milton JosephLondon 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: