Database Reference
In-Depth Information
Table 1. Symbol representations
T1 table1
T2 table2
A SELECT i..s FROM T1
B SELECT r..s FROM T2
W1 SELECT A FROM T1 WHERE (..)
W2 SELECT B FROM T2 WHERE (..)
The following symbols denote their corresponding query entity in bold. These will be used in the
rewrite templates in the next sections.
Count Method Rewrite
The above query G1a can be rewritten to a template using the partition-and-count method such as the
following (Brantner et al., 2007; Hung et al., 2005). Note that quantities in square brackets require
evaluation beforehand.
R0: SELECT [A-B]
FROM [T1]
WHERE [W1]
AND [A∩B] IN
(SELECT [B]
FROM [T2]
WHERE [W2])
GROUP BY [A-B]
HAVING COUNT (*) =
(SELECT COUNT(*)
FROM [T2]
WHERE [W2]);
By replacing the entities in square brackets with their appropriate values, a single divide grammar
can be rewritten in a straightforward manner.
Not Exists/Not Exists Method Rewrite
This is the original so-called classic division (originally from Matos (Brantner, 2007) which borrows
from Date (Codd, 1972)) which has been transformed into a rewrite template. Prefix letters must be
fixed to each of the select attributes.
R1: SELECT DISTINCT x.[A-B]
FROM [T1] AS x
WHERE NOT EXISTS
Search WWH ::




Custom Search