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: { ...