Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle count() Function

The Oracle count() function returns the number of rows that matches a specified expression. It is used when you need to count number of rows in atable or number of records of your table.

Oracle COUNT FUNCTION Syntax

To count or calculate number of rows in a table, use the following syntax:

Syntax

SELECT COUNT(col1) 
FROM tablename
WHERE condition;

Parameters:

tablename: The table name from which you want to fetch records.

col1: The column on which you want to perform count. It will count NON-NULL values.

Oracle COUNT FUNCTION example

The following Oracle, calculate the total number of "firstName" in the "tblCustomerLoan" table:

Example

SELECT COUNT(firstName) FROM tblCustomerLoan;

OR

SELECT COUNT(*) AS count FROM tblCustomerLoan;

Note:

In the above example, we are calculating the number of "firstName" from tblCustomerLoan" table.