Count function in mysql

By | January 18, 2014

counting the number of records in a table.

Example:

Select * from mydoubts_table;

————————————
|firstname | lastname | address |
————————————
|vasanthan | pv | india |
|nazar | gt | texas |
|raju | raina | sreelanka|
|gt | nazar | texas |
|Martin | jacob | Dubai |
|mydoubts.in | | newyork |
|wordsgallery| | Frankfurt|
————————————-

Select COUNT(*) from mydoubts_table;

————
| COUNT(*) |
————
| 7 |
————

Select COUNT(*) from mydoubts_table where firstname=’vasanthan’;

————
| COUNT(*) |
————
| 1 |
————