SQL Oracle PHP Java JSP JDBC MORE

SQL COUNT() function with Example


The SQL COUNT() function is used to count number of rows in a table.

SQL COUNT() Syntax

SELECT COUNT(column_name)
FROM table_name
WHERE condition;

SQL COUNT() Example

In this example we count how many Rollno in the students_data table.

RollNo Name Address ContactNo
1 Divya Mumbai 9437911966
2 Hritika Pune 9887454545
3 Amit Delhi 7766888888

SQL Query

SELECT COUNT(RollNo)
FROM students_data;

Output

3