eHow launches Android app: Get the best of eHow on the go.

How To

How to Count The Number of Rows in a Database Table

Member
By surefirehire
User-Submitted Article
(1 Ratings)

After you complete this article, you will be able to run a sql query that will return the number of rows in a relational database table.

Difficulty: Easy
Instructions
  1. Step 1

    The first step is access the database. Most database have a facility to run sql queries. I will count the number of rows of a table on MySQL, using MyPhpAdmin.

  2. Step 2

    After you have logged in, identify the table that you need access to. This article assumes you already have a table in mind. The table I will use for the example is "jos_users". "jos_users" contains the users in my user table.

  3. Step 3

    After you have identified the table. You will need to write the sql statement. The sql statement for this query will contain the select list, in combination with a sql function. What the sql statement will not contain, is a where clause. This is because we want to know the total number of rows in the table.

  4. Step 4

    The sql statment looks like this (upper or lower case is fine):

    SELECT count(*) FROM jos_users

    Result is: 7

  5. Step 5

    The result of the query is "7"; however, if you run into any errors, verify the table name is correct or you have not misspelled "SELECT" or "COUNT(*)".

    If you run into any issues or the job is bigger than what you originally thought, consider hiring a freelancer at surefirehire.

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

eHow Computers
eHow_eHow Technology and Electronics