The function COUNT we use to get number of rows in a table.
Select Emp_name, Count(*) from EMP;
This will give Employee names and against each row it gives number of rows.
Select Count(Dept_Name) from EMP where Sex=’M’; This give number of department names having Male employee.
It is similar to the COUNT, except that the result is greater than maximum value of Integer.
Select Count_Big(DISTINCT Emp_name) from emp;
COUNT_BIG(*) – This is also similar to the COUNT(*), except the result is greater than of Integer.
- One more point is we can change the result data type with COUNT_BIG function
- UDF – It can be used in user defined functions