a
 
Unlimited Game Rentals Delivered - Free Trial
SQLRef.Com 

            SqlRef.Com


SQL BASIC
DATA QUERY LANGUAGE
BASIC FUNCTION
AGGREGATE FUNCTION
DATA MANIPULATION LANGUAGE
DATA DEFINITION LANGUAGE
DATA CONTROL LANGUAGE
OTHERS

COUNT()

SELECT COUNT(*) FROM <table> [WHERE <conditions>]

COUNT can be used to counts the number of rows and this total is returned in a single column and single row resultset.

Table: Customers
CustID Name Address City Country PostCode Phone Fax
CUST001 Maria Anders Obere Str. 57 Berlin Germany 12209 030-0074321 030-0076545
CUST002 Ernst Handel Kirchgasse 6 Graz Austria 8010 7675-3425 7675-3426
CUST003 Helen Bennett Garden House Crowther Way Cowes UK PO31 7PJ (198) 555-8888 (198) 555-8889
CUST004 Paula Wilson 2817 Milton Dr. Albuquerque USA 87110 (505) 555-5939 (505) 555-5940
CUST005 Liu Wong 55 Grizzly Peak Rd. Butte USA 59801 (406) 555-5834 (406) 555-8083

The following SQL statement returns the the number of rows in the Customers table.

SELECT COUNT(*) FROM Customers

Resultset1
5


 
| Freebies | Free Trial | Add to Bookmark | Search | Link to Us |
Copyright © 2006 SqlRef.com. All rights reserved.