January 2012
Intermediate to advanced
542 pages
11h 28m
English
In this recipe, we will see how to count rows, compute min/max aggregates, and use filters in group-by queries.
The following steps will demonstrate the use of count, min/max, and group-by:
SH schema:
CONNECT sh@TESTDB/sh
MIN/MAX query:SET AUTOT TRACE EXP SELECT MAX(CUST_CREDIT_LIMIT) FROM CUSTOMERS; SELECT MIN(CUST_CREDIT_LIMIT) FROM CUSTOMERS;
MIN and the MAX:SELECT MAX(CUST_CREDIT_LIMIT), MIN(CUST_CREDIT_LIMIT) FROM CUSTOMERS;
CUSTOMERS in the column in which we need to aggregate:CREATE INDEX IX_CUST_CREDIT_LIMIT ON CUSTOMERS (CUST_CREDIT_LIMIT);
Read now
Unlock full access