Write a SQL query to flatten hierarchical or nested data into a tabular format.
Assume the input is represented by divisions, teams, and members, where teams belong to divisions and members may belong to teams. Preserve divisions and teams even when their child rows are absent.
Output
- One row per team-member combination, plus rows for divisions or teams without children.
- Return
division_id, division_name, team_id, team_name, member_id, member_name, and member_role.
- Sort by division, team, and member identifiers, placing missing child rows last.