Product co-occurrence counts how many times two products appear in the same order. It reveals purchase associations and is the basis for recommendations and cross-selling. It is computed by joining order lines to each other on the same order identifier.
Example
SELECT a.product_id, b.product_id, COUNT(*) FROM order_items a JOIN order_items b ON a.order_id = b.order_id AND a.product_id < b.product_id GROUP BY 1, 2;