Friday, June 25, 2010

Count In Oracle / SQL

Assume table name is EMPLOYEE and it has E_NAME Field 


Count All Records In Table
SELECT COUNT(*) FROM EMPLOYEE;
Count All Records In Table with Head Name
SELECT COUNT(*) AS EMPLOYYE_COUNT FROM EMPLOYEE;
Count Column Records In Table
SELECT COUNT(E_NAME) FROM EMPLOYEE;
Count Distinct Column Records In Table
SELECT COUNT(DISTINCT E_NAME) FROM EMPLOYEE;
Count Selected Records In Table
SELECT COUNT(*) FROM EMPLOYEE WHERE CONDITION E_NAME = 'BOND';
Count Selected Records with Head Name
SELECT COUNT(*) FROM EMPLOYEE NAME_BOND WHERE CONDITION E_NAME = 'BOND';
Post a Comment