April 11th, 2013, 09:36 AM
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..
April 15th, 2013, 11:46 AM
For Count , you have to use Count Function like this
" select Count(user_accounts) AS UserAccts
To Find AVERAGE
hope this will help let me know ok
April 16th, 2013, 04:23 AM
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....