java - How to apply minus operation if only single query avaliable? -


I am creating a search application where the user can enter his criteria in the form for a search. I am using an internal API to create a query that is similar to the Hibernate Criteria Building. I am supporting the set operation between the selection criterion for better efficiency. Now how should I know how to make my criteria for zero on a single question?

For example

Case 1: In a simple scenario, the user enters the country, name and date of birth areas

Select USER_ID from Table 1 WHERE COUNTRY = "INDIA" AND NAME = "xyz" AND DATE_OF_BIRTH = "01/05/1990"

Case 2: Now users want to search in many countries. In one set will enter the country as "US" and in the second set will be "UK". I will create a union query on them like <1 p>

select USER_ID from Table 1 where COUNTRY = "US" union is selected from USER_ID 1 table where COUNTRY = "UK"

Case 3: Now the user wants "U.K." from the user, but not "UK", then

select USER_ID from the table 1 where COUNTRY = "US" MINUS select USER_ID from Table 1 where COUNTRY = "UK"

Case 4: Now if users want to deny their selection, such as all users except "user" Subject to if he wants to return to minus operation on a single set should I query how to prepare? Case 5: Now if the user wants to deny their selection, like all those users set 1, set 2 set and 3 users want to set apart the conditions?

Update:

Update: In reality, I can have very complex questions. To support multiple DBs, only support "and", "or" operators within the query in the creation of our API and supports "UNION", "INTERSECT" and "MINUS" between questions.

not in "Afghanistan", from where select 1 USER_ID in the country

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -