title: How to reuse a large query without repeating it?
body: <p>If I have two queries, which I will call <code>horrible_query_1</code> and <code>ugly_query_2</code>, and I want to perform the following two minus operations on them:</p>
  
  <pre><code>(horrible_query_1) minus (ugly_query_2)
  (ugly_query_2) minus (horrible_query_1)
  </code></pre>
  
  <p>Or maybe I have a <code>terribly_large_and_useful_query</code>, and the result set it produces I want to use as part of several future queries.</p>
  
  <p>How can I avoid copying and pasting the same queries in multiple places?  How can I "not repeat myself," and follow DRY principles.  Is this possible in SQL?</p>
  
  <p>I'm using Oracle SQL.  Portable SQL solutions are preferable, but if I have to use an Oracle specific feature (including PL/SQL) that's OK.</p>