I have two tables, one of which has a unique ID column and a column which contains arrays which hold zero or more identifiers for unique records in Table B. I'm trying to show the orders each item was used in, but I can't wrap my head around a way to join table A and B in such a way that there's a row not just for every order or item, but for as many items are there are on all the orders
Table A:
OrderID | Items | name
----------+------------------+------------
order1 | {item1,item2} | "Bob's pizza order"
order2 | {item3,item1} | "Alice's breakfast order"
Table B:
itemID | price | name
---------+----------------+------------
item1 | 2.95 | "cheese"
item2 | 3.15 | "tomato sauce"
item3 | 3.50 | "eggs"
Desired output would be something like
ItemID | OrderID | name
---------+----------------+------------
item1 | order1 | "cheese"
item1 | order2 | "cheese"
item2 | order1 | "tomato sauce"
item3 | order2 | "eggs"
Does anyone know how to unnest the array in Table A in such a way that I can then use all the items to join A & B with records for every item of every order?