January 2012
Intermediate to advanced
542 pages
11h 28m
English
In this recipe, we will see how to use histograms on tables to provide a detailed estimate of value distribution inside a column.
The following steps will show how to represent our data in the form of histograms:
SH schema:
CONNECT sh@TESTDB/sh
TEST_HIST with some data from ALL_OBJECTS:CREATE TABLE sh.TEST_HIST AS SELECT ROWNUM AS ID, OBJECT_NAME AS NAME, MOD(ROWNUM, 10) AS FIELD1, TRUNC(MOD(ROWNUM, 10)/9) AS FIELD2 FROM ALL_OBJECTS;
FIELD1 and FIELD2 values grouped to see the data distribution:SELECT FIELD1, COUNT(*) FROM TEST_HIST GROUP BY FIELD1 ORDER BY 1; SELECT FIELD2, COUNT(*) FROM TEST_HIST GROUP BY FIELD2 ORDER BY 1;
FIELD1 of the ...Read now
Unlock full access