Querying files containing MultiValue attributes

Once a D3 file containing MultiValue attributes has been flattened, the result is several SQL tables, such as in the INVENTORY example above. To retrieve the desired data, nested tables must be joined in the WHERE clause of the SQL SELECT statement.

Example:

If the question was to list all the products supplied by company "XYZ" which has the vendor_id 842, the query below is needed:

SELECT productname, vendor_id FROM inventory, inventory_vendor_id
WHERE inventory.product_id = inventory_vendor_id.product_id AND vendor_id = 842

The tables, INVENTORY and INVENTORY_VENDOR_ID are joined using the tables’ primary key, PRODUCT_ID. An additional criteria is included in the WHERE clause using the AND connector.

For the syntax and details of the SELECT statement, see SELECT.