Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: boolean logic expressed in RDBMS rows

Re: boolean logic expressed in RDBMS rows

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 10 May 2003 20:28:18 -0700
Message-ID: <c0d87ec0.0305101928.1da48742@posting.google.com>


>> 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 &#8230;
  FROM Foobar AS F1

       LEFT OUTER JOIN
       SearchList AS S1
       ON F1.x = S1.serch_x

 GROUP BY F1.pilot
HAVING COUNT(F1.x) = (SELECT COUNT(search_x) FROM SearchList)

   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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US