
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Count Rows in a Table Using MySQL SELECT Statement
We need to use COUNT(*) function with SELECT clause to count the total number of rows in a table.
Example
mysql> Select COUNT(*) from Student; +----------+ | COUNT(*) | +----------+ | 4 | +----------+ 1 row in set (0.06 sec)
The query above counts the total number of rows of ‘Student’ table.
We can also use WHERE clause with COUNT(*) function as follows:
mysql> Select COUNT(*) from Student where Address = 'Delhi'; +----------+ | COUNT(*) | +----------+ | 2 | +----------+ 1 row in set (0.00 sec)
Advertisements