~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/orderby.rst

  • Committer: Lee Bieber
  • Date: 2011-02-16 14:48:10 UTC
  • mfrom: (2172.1.5 build)
  • Revision ID: kalebral@gmail.com-20110216144810-u3w6f3a5s6qwisrz
Merge Stewart - remove unused macros
Merge Olaf - remove old style casts
Merge Stewart remove  unused macros in drizzledump
Merge Andrew - 718657: Several errors in Date/Time docs
Merge Olaf - Move strfunc functions into TYPELIB class

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
The ORDER BY keyword is used to sort the result-set by column; by default, it sorts the records in ascending order.
5
5
 
6
 
SQL ORDER BY Syntax: ::
 
6
SQL ORDER BY Syntax:
 
7
 
 
8
.. code-block:: mysql
7
9
 
8
10
        SELECT column_name(s)
9
11
        FROM table_name
23
25
| 3       | Peterson   | Kari     |30 Mell   | Reno   |
24
26
+---------+------------+----------+----------+--------+
25
27
 
26
 
To select all the persons from the table above, and also sort them by their last name, use the following SELECT statement: ::
 
28
To select all the persons from the table above, and also sort them by their last name, use the following SELECT statement:
 
29
 
 
30
.. code-block:: mysql
27
31
 
28
32
        SELECT * FROM Persons
29
33
        ORDER BY LastName;
40
44
| 2       | Roberts    | Teri     |21 Brown  | Chicago|
41
45
+---------+------------+----------+----------+--------+
42
46
 
43
 
ORDER BY DESC can be used to reverse the order of the result set. ::
 
47
ORDER BY DESC can be used to reverse the order of the result set.
 
48
 
 
49
.. code-block:: mysql
44
50
 
45
51
        SELECT * FROM Persons
46
52
        ORDER BY LastName DESC;