How to write very complex SQL in a clean and maintainable way? : <p>I'm in the database migration project.</p>

<p>I have to write very complex SQL in a maintainable way. The previous query is almost spaghetti.</p>

<p>I wanna make a view in the database but I have no authority. </p>

<p>So what I am thinking about is making a bridged database that is from the query result of the database. </p>

<p>After that, I made views in the bridged database. </p>

<p>is it inefficient? or is there any nice way to deal with a complex database queries?</p>
