Blue Yonder's Luminate Planning data team needs to identify distribution centers with the second-highest inventory valuation among active facilities. Write a PostgreSQL query that ranks distinct non-null inventory values and returns every facility tied at rank two.
Requirements
- Join inventory valuations to facilities and include only active facilities.
- Exclude rows where
inventory_value is NULL.
- Use a window function such as
DENSE_RANK so ties at the second-highest distinct value are retained.
- Return the facility name and inventory value, ordered by facility name.