How to check if a SQL SELECT query is a subset of other query -


i trying find way determine whether or not sql select query a prone return subset of results returned query b. furthermore, needs acomplished queries alone, without having access respective result sets.

for example, query select * employee salary >= 1000 return subset of results of query select * employee. need find automated way perform validation 2 queries a , b, without accessing database stores data.

if unfeasable achieve without aid of rdbms, can assume have access local, empty rdbms, data stored somewhere else. in addition, check must done in code, either using algorithm or library. language using java, other language do.

many in advance.

i don't know how deep want parsing queries, can there 2 general ways of making subset of query (given source table , projection(select) staying same):

  • using clause add condition row values
  • using having clause add conditions aggregated values

so can if have 2 objects represent queries , close this:

 {     'select': { ... },     'from': {},     'where': {},     'orderby': {}  } 

and have select, from , orderby same, 1 have condition in where clause , have subset.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -