How To Check The Number Of Record In A MySQL Table

If you are looking for a method to count the number of record held in a MySQL table, here is an example on how to use the “COUNT( )” function.

Below is an example on how to count the number of record in a table using an SQL query.

[sql]SELECT COUNT(*) FROM test WHERE category = “business”[/sql]

The above query will return the number of record held in table “test” when row “category” is equal to “business”

IF you are to use PHP to query the record count, use the below code.

[sql]$sql = “SELECT COUNT(*) FROM test WHERE category = \”business\””;[/sql]

Don’t miss out!
Subscribe to My Newsletter
Invalid email address