
You are given transaction data and customer segment metadata from a McKinsey client analytics environment. Write a SQL query to return the second-highest distinct transaction value for each customer segment. If a segment has fewer than two distinct non-null transaction values, it should not appear in the result.
Use the customer-to-segment relationship rather than relying on any segment value stored elsewhere, and return the segment name with the second-highest value.