SQL COUNT(*) Function
The COUNT(*) function returns the number of selected rows in a selection.
Syntax
SELECT COUNT(*) FROM table
|
Example
With this "Persons" Table:
| Name |
Age |
| Hansen, Ola |
34 |
| Svendson, Tove |
45 |
| Pettersen, Kari |
19 |
This example returns the number of rows in the table:
SELECT COUNT(*) FROM Persons
|
Result:
Example
Return the number of persons that are older than 20 years:
SELECT COUNT(*) FROM Persons WHERE Age>20
|
Result:
Use a web development platform that will help you save a lot of time and bring excitement to your daily development work.
It will also create professional best-practices around your code development and team collaboration.
Try Springloops now, the web development platform
|