#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    SQL query for db2


    Please help urgent required for my project...
    1.SQL Query to COUNT NUMBER OF USERS for db2

    2.SQL Query to find AVERAGE TABLE SIZE for db2

    Please give me answer fast..I am new to db2...very urgent..pls pls

    thanks in advance..
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0

    Solution


    For Count , you have to use Count Function like this
    " select Count(user_accounts) AS UserAccts
    from DB2

    and

    To Find AVERAGE

    Select AVG(Tablename)
    from Tablename

    hope this will help let me know ok
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0
    Hi thanks for replying....
    SQL> bhr= ' SELECT TOTAL_HIT_RATIO_PERCENT FROM SYSIBMADM.BP_HITRATIO ORDER BY DBPARTITIONNUM ' ;

    Buffer Hit Ratio = 97.75

    this is the sql query i used to find buffer hit ratio....when i executed your query i got following error...

    db2 => select Count(user_accounts) AS UserAccts from db2
    SQL0204N "DB2ADMIN.DB2" is an undefined name. SQLSTATE=42704

    here i guess in place of "db2" there may be any word...not getting help me..


    and in AVG table size...i got following error...

    db2 => Select AVG(Tablename) from Tablename
    SQL0204N "DB2ADMIN.TABLENAME" is an undefined name. SQLSTATE=42704

    above was a table name error..so i have created a table by name "student1" but i still got following error...

    db2 => Select AVG(student1) from student1
    SQL0206N "STUDENT1" is not valid in the context where it is used.SQLSTATE=42703


    my database name is "student"..even i executed the qery u ve given my changing to database name...but i got following error..
    db2 => Select AVG(student) from student
    SQL0204N "DB2ADMIN.STUDENT" is an undefined name. SQLSTATE=42704


    pls help me out...to get exact query..
    thanks..waiting for your reply....

IMN logo majestic logo threadwatch logo seochat tools logo