Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> comp.databases.theory -> Re: boolean logic expressed in RDBMS rows
>> My question is - is there a 'standard' way to store the query
criteria inside a table(s) of any shape or form and what would that
table or tables look like? <<
You use a table of search values. If you want to OR them, then use a simple
SELECT ...
FROM Foobar
WHERE x IN (SELECT search_x FROM SearchList);
If you want to AND the search list, use a relational division. There is Exact Division and division with a remainder. That is, does the item returned have exactly that set of values or does it have at least that set of values? Here is one way to write exact relational division. The dividend table must match exactly to the values of the divisor without any extra values.
SELECT …
FROM Foobar AS F1
LEFT OUTER JOIN SearchList AS S1 ON F1.x = S1.serch_x
AND COUNT(S1.search_x) = (SELECT COUNT(search_x) FROM SearchList);
You can play with the equality test to get a remainder division. Received on Sat May 10 2003 - 22:28:18 CDT