title: Can queries on views be fully tested?
body: <p>So I have a query:</p>
  
  <pre><code>select
    c.STRING,
    a.STRING,
    b.STRING,
    b.STRING3,
    a.STRING2,
  from TABLE_A a,
    VIEW_B b,
    TABLE_C c
  where b.STRING2 = a.STRING2
    and a.INT = #value#
    and c.INT = a.INT
    and c.STRING IN ('string1', 'string2')
  </code></pre>
  
  <p>VIEW_B is a view and TABLE_A and TABLE_C are normal tables. I am trying to unit test this query. The way I saw it was that because it is a select, I need to make some dummy data, insert it into the tables, and then run the above query and make sure it returns the same data I put in. However, VIEW_B is a view, and cannot be inserted into. So I need to get some real data from VIEW_B and its corresponding data in the other 2 tables. However, by that point I'm just running the same query, plus I have to grab an a.INT. So my conclusion is that if I have a query that uses views, it can't be fully tested. </p>
  
  <p>Is this true? Regardless, what is the best way to test this query?</p>
  
  <p>Keep in mind that this is a work project and that I can't change the schema of the tables or the query itself, and I have to run my tests against the actual database.</p>