Wednesday, 23 November 2011


The SQL COUNT() aggregate function is use to count numeric of rows in database table.

1.) SQL COUNT(column_Name) Syntax

The COUNT() function count the number of values (NULL values not count) of the specified column. The SQL COUNT() function syntax is very simple and it looks like this
SELECT COUNT(column_name) FROM table_name

2.) SQL COUNT(*) Syntax

The COUNT(*) function cont the number of records in a database table.The SQL COUNT() function syntax is very simple and it looks like this
SELECT COUNT(*) FROM table_name

3.) SQL COUNT(DISTINCT column_name) Syntax

The COUNT(DISTINCT column_name) function count the number of distinct values in specified column.The SQL COUNT() function syntax is very simple and it looks like this
SELECT COUNT(DISTINCT column_name) FROM table_name

SQL COUNT() Example

We have following "Table_1" name table:

S_NoS_NameTotalPercentage
1Jay50777.84
2Ajay48774.92
3Bhavesh46972.15
4Jaimin46371.23
5Dolar42565.38

1.) SQL COUNT(column_Name) Example

Example Statement:
SQL> SELECT COUNT(S_Name) FROM Table_1;
Example Result will look like This:

Count(S_Name)
5


2.) SQL COUNT(*) Example

Example Statement:
SQL> SELECT COUNT(*) FROM Table_1;
Example Result will look like This:

Count(*)
5


3.) SQL COUNT(DISTINCT S_Name) Example

Example Statement:
SQL> SELECT COUNT(DISTINCT S_Name) AS Distinct_S_Name FROM Table_1;
Example Result will look like This:

Distinct_S_Name
5






SQL GUIDE


0 comments:

Post a Comment

TrainingHUB. Powered by Blogger.

Total Pageviews

THE BEST QTP TRAINING INSTITUTE IN HYDERABAD

QTP Training in hyderabad

Sql Tutorial

Popular Posts

Our Facebook Page

TrainingHUB

Followers