You are given three tables represented as 2D string arrays (each row is a record, no headers). You need to produce a mapping from userId → customerName by matching and joining information across tables.
customersEach row: [customerName, email, productName, quantity]
quantity
is an integer in string form.
productName
per customer).
ordersEach row: [userId, email, orderTotal]
orderTotal
is a number in string form (integer or decimal).
email
may be null
(or an empty string, depending on how the input is represented).
productsEach row: [productName, unitPrice]
unitPrice
is a number in string form.
For each order record, identify which customer placed it, then output userId -> customerName.
Use these matching rules:
orders.email
is present (non-null/non-empty), match the customer by
email
.
orders.email
is missing, match by using the fact that:
orderTotal = quantity * unitPrice
for the customer’s purchased product.
customers.productName
joined to
products.productName
to get
unitPrice
.
Return a mapping/dictionary from userId to customerName for all orders.