Javatpoint Logo
Javatpoint Logo

SQL SELECT COUNT

The SQL COUNT() function is used to return the number of rows in a query.

The COUNT() function is used with SQL SELECT statement and it is very useful to count the number of rows in a table having enormous data.

For example: If you have a record of the voters in selected area and want to count the number of voters then it is very difficult to do it manually but you can do it easily by using the SQL SELECT COUNT query.

Let's see the syntax of SQL COUNT statement.

Let's see the examples of sql select count function.


SQL SELECT COUNT(column_name)

It will return the total number of names of employee_table. But null fields will not be counted.


SQL SELECT COUNT(*)

The "select count(*) from table" is used to return the number of records in table.


SQL SELECT COUNT(DISTINCT column_name)

It will return the total distinct names of employee_table.

Next TopicSQL Select Top




Please Share

facebook twitter google plus pinterest tumbler

Learn Latest Tutorials