SQL COUNT Function
The COUNT function returns the number of rows of the resultset.
SQL COUNT Syntax
SQL COUNT Explanation
Here is how sqldemo.test_tab_t looks like.
|SQL COUNT: We will count the number of rows using the SQL COUNT function.|
- The first query takes * or all columns as the parameter.
- The second query takes tname i.e. one of the columns as the parameter to SQL count function.
- The third one takes a constant. It counts one 1 per row.
What we learned?
- The COUNT function takes a row, a column name, constant as the input parameter.
- It returns the number of rows n the resultset based on where condition.