Verify SQL statement or suggest a better way
Posted on 2006-10-20
HI Experts. I need to verify what this statement is doing. We had a situation at work where doubt was cast over query results and I really need to know if this query is good. If it is not can someone assist by suggesting an alternative?
OK I have BIGTABLE and SMALLTABLE. BIGTABLE contains, say 50k rows and smalltable contains say 6k rows. I want to run a query that checks to see if any of smalltable exists in bigtable. I want to search on add1 and postcode This is what I have been doing so far.
select * from smalltable s
from bigtable b
where s.add1 = b.add1 and s.postcode = b.postcode)
Is this query good to return what I want to know, in your expert opinion?