Example: group the employee tuples based on their values for the sex attribute:
Example: suppose we only want to consider groups where the size of the group is at least 2:
Group condition:
|
|
Note:
|
SELECT grouping-attributes or set-functions FROM relation-list WHERE tuple-boolean-condition GROUP BY grouping-attribute-list HAVING SetFunction( .. ) RelOp ... <---- Group condition |
RelOp is a a relational operator (such as <, ≤, > ≥, =, ≠)
|
The employee relation: +--------+---------+-----+ | fname | lname | dno | +--------+---------+-----+ | James | Borg | 1 | | Alicia | Zelaya | 4 | | Jennif | Wallace | 4 | | Ahmad | Jabbar | 4 | | John | Smith | 5 | | Frankl | Wong | 5 | | Ramesh | Narayan | 5 | | Joyce | English | 5 | +--------+---------+-----+ |