Table 2

Proposed sketch for a SELECT statement. $TBL and $COL represent a table and a column, respectively. $AGG is one of {none, max, min, count, sum, avg}, $ARI is one of the arithmetic operators {none, -, +, *, / }, and $COND is one of the conditional operators {between, =, >, <, >=, <=, !=, in, like, is, exists}. $DIST and $NOT are Boolean variables representing the existence of keywords DISTINCT and NOT, respectively. $ORD is a binary value for keywords ASC/DESC, and $CONJ is one of conjunctions {AND, OR}. $VAL is the value for WHERE/HAVING condition; $SEL represents the slot for another SELECT statement.

CLAUSESKETCH
FROM ($TBL)+ 
SELECT $DIST 
( $AGG ( $DIST1$AGG1$COL1$ARI$DIST2$AGG2$COL2 ) ) + 
ORDERBY ( ( $DIST1$AGG1$COL1$ARI$DIST2$AGG2$COL2 ) $ORD ) * 
GROUPBY ($COL)* 
LIMIT $NUM 
WHERE ( $CONJ ( $DIST1$AGG1$COL1$ARI$DIST2$AGG2$COL2
HAVING $NOT$COND$VAL1|$SEL1$VAL2|$SEL2 )* 
INTERSECT $SEL 
UNION  
EXCEPT 
CLAUSESKETCH
FROM ($TBL)+ 
SELECT $DIST 
( $AGG ( $DIST1$AGG1$COL1$ARI$DIST2$AGG2$COL2 ) ) + 
ORDERBY ( ( $DIST1$AGG1$COL1$ARI$DIST2$AGG2$COL2 ) $ORD ) * 
GROUPBY ($COL)* 
LIMIT $NUM 
WHERE ( $CONJ ( $DIST1$AGG1$COL1$ARI$DIST2$AGG2$COL2
HAVING $NOT$COND$VAL1|$SEL1$VAL2|$SEL2 )* 
INTERSECT $SEL 
UNION  
EXCEPT 
Close Modal

or Create an Account

Close Modal
Close Modal