Count ( ) In SQL Database this is a function which return no of rows from a table in Database . Generally this is used in SQL select statement and count the no. of records in a table .
Syntax ->
select count ( expression_name ) from table_name where clause ;
Example ->
Suppose i have a table , name is student
**Student_name** **Student_Age** **Student_Id**
Mukesh 23 1
Ayush 24 2
Suppose i want to count number of records in a table then we can do with the count ( ) function .
select count ( * ) from student ; // Output -> 2
To count distinct column_name
select count ( distinct Student_Age ) from student ; // Output -> 1
0 Comment(s)