~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/functions/count.rst

  • Committer: Lee Bieber
  • Date: 2011-02-11 20:30:05 UTC
  • mfrom: (2157.1.3 build)
  • Revision ID: kalebral@gmail.com-20110211203005-757o1y2yf78dxzqr
Merge Stewart - 716848: drizzleimport displays wrong program_name
Merge Stewart - update README file
Merge Andrew and Joe - Exposes the InnoDB SYS_REPLICATION_LOG to data_dictionary so that it is fast and fixes many issues we have been having

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
|6       |10/2/2010          |820         |4               |Smith              |
20
20
+--------+-------------------+------------+----------------+-------------------+
21
21
 
22
 
The SQL COUNT function returns the number of rows in a table satisfying the criteria specified in the WHERE clause. If we want to count how many orders has made a customer with CustomerName of Smith, we will use the following SQL COUNT expression:
23
 
 
24
 
.. code-block:: mysql
 
22
The SQL COUNT function returns the number of rows in a table satisfying the criteria specified in the WHERE clause. If we want to count how many orders has made a customer with CustomerName of Smith, we will use the following SQL COUNT expression: ::
25
23
 
26
24
        SELECT COUNT * FROM Nodes
27
25
        WHERE UserName = "Smith";
28
26
 
29
27
In the above statement, the COUNT keyword returns the number 3, because the user Smith has 3 total nodes.
30
28
 
31
 
If you don’t specify a WHERE clause when using the COUNT keyword, your statement will simply return the total number of rows in the table, which would be 6 in this example:
32
 
 
33
 
.. code-block:: mysql
 
29
If you don’t specify a WHERE clause when using the COUNT keyword, your statement will simply return the total number of rows in the table, which would be 6 in this example: ::
34
30
 
35
31
        SELECT COUNT * FROM Nodes;