DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: pl/sql for calculating min, max, avg....

  1. #1
    Join Date
    Sep 2002
    Posts
    12

    pl/sql for calculating min, max, avg....

    Hi,
    I looking for a program that can calculate the min, max,avg, unique, null and so on and in addition calculate the values in histogram type...

    for example: if i have a table t1 with columns c1, c2, c3
    and if c1 has values like: 2, 7, 15, 24, 29, 38
    i want it to calculate the values like

    c1:
    1-10: 2
    11-20: 1
    21-30: 2
    31-40: 1

    like histogram. in addition, if i can invoke something to have it like a html output with some nice graphs that will be awesome.

    i guess the min, max and stuff can be gotten from the system tables after analyze.

    please advice.
    ks

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    tahiti.oracle.com under "basic understanding of SQL"
    Jeff Hunter

  3. #3
    Join Date
    Jun 2001
    Posts
    20
    >>in addition, if i can invoke something to have it like a html output with some nice graphs that will be awesome.

    I would recommend looking into Crystal reports or some equivalent, it will greatly simplify yer task.

  4. #4
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    For Frequency chart, a simple SQL can do.
    Ex:
    14:26:21 H8DEVW3>SELECT * FROM T1 ;

    C1
    ----------
    10
    33
    22
    24
    35
    2
    7
    8
    38

    9 rows selected.

    select DECODE(FREQ,10,'1-10',20,'11-20',30,'21-30',40,'31-40') INT,
    COUNT(*)
    from (select ( case
    when (c1 between 1 and 10 ) then 10
    when (c1 between 11 and 20 ) then 20
    when (c1 between 21 and 30 ) then 30
    when (c1 between 31 and 40 ) then 40
    else 0
    end ) FREQ
    from t1)
    GROUP BY DECODE(FREQ,10,'1-10',20,'11-20',30,'21-30',40,'31-40')
    /

    INT COUNT(*)
    ----- ----------
    1-10 4
    21-30 2
    31-40 3


    Tamil

  5. #5
    Join Date
    May 2002
    Posts
    2,645
    Same question posted at dbaclick.com and ks was told to read the documentation. Did not, so sk came here. And how is this related to certification?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width