eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak


Introduction to Databases for Web Developers
Counting Records  
It is also very easy to count the number of records that meet a certain criteria. This function is performed with the COUNT operator and follows the syntax:

    SELECT COUNT (column_name)
    FROM table_name
    WHERE where_clause [optional];

In other words, to count the number of employees in the EMPLOYEES table, you would use:


which would return the following:


Note that sometimes, it is preferable to use SELECT COUNT(*) instead of specifying a column_name. This is because the COUNT operator does not consider columns with null values. Thus, if you specified a column_name and one of the rows in that table had a null value for column_name, your count would be off. Using "*" assures that all rows are counted even if they include null values. And by the way, most implementations of SQL will also require you to use the DISTINCT operator if you specify a column_name

Previous | Next | Table of Contents