Archive for October, 2013

ROLLUP, CUBE, and GROUPING SETS

Oct 15 2013

The ROLLUP, CUBE, and GROUPING SETS operators are extensions of the GROUP BY clause. The GROUPING SET is the union of the aggregates based on the columns specified in each set in the grouping set. Multiple columns that are in inner parentheses in the GROUPING SETS list are treated as a single set. The following […]

START WITH CONNECT BY SQL

Oct 15 2013

The START WITH… CONNECT BY clause can be used to select data that has a hierarchical relationship such as manager to employee relationships. The root of the hierarchy is selected with the START WITH condition. In the example below from Oracle, the top level manager has an employee_id of 100. The output is sorted by […]