The COUNT() function is used to count the number of records in a database.
Syntax:
Select COUNT(*) from table_name;
Example:
we have the table stu shown below:
Stu | |||
Name | Section | Roll_No | Subject |
Radha | B | 180 | Science |
Shruti | B | 16 | Science |
Sneha | B | 17 | Science |
Akshita | C | 1 | Commerce |
Bhoomika | C | 16 | Humanities |
1. Check the number of records from the table
Select COUNT(*) from stu;
Output
2. Count the record in the Name column:
Select COUNT(Name) from stu;
Output
- Log in to post comments