Sunday, 9 October 2011

SQL- Aggregate Functions- COUNT()

nThe COUNT() function returns the number of rows that matches a specified criteria.
Syntax:
üSELECT COUNT(column_name) FROM table_name
üSELECT COUNT(*) FROM table_name
üSELECT COUNT(DISTINCT column_name) FROM table_name
Query:
üSELECT COUNT(EMPname) AS Employee Name FROM EMPtbl1 WHERE EMPname=‘Batista'
üSELECT COUNT(*)  FROM EMPtbl1
üSELECT COUNT(DISTINCT EMPname) AS Employee name FROM EMPtbl1

No comments:

Post a Comment