"K.Fawcett" <k.*******@mccsoftware.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Thanks for you reply. An 'ORDER BY' clause was never required by this
table until a customer wanted to do something new. I will probably
need to add a new field to support this. I guess what threw me is that
the results of a 'SELECT' query always appear alphabetized (at least
for the queries I performed). From what you are saying I should expect
to see random ordering in my results. I accept this, but is there a
reason that I would never experience it? Here is my query and my
result:
E:\src\univ\bmz>DB2 SELECT DISP_NAME,DISP_SYM FROM MCCTOOLS.DISP_TBLallout.qry
E:\src\univ\bmz>DB2 SELECT PROG_ID,DISP_NAME,DISP_SYM FROM
MCCTOOLS.DISP_TBL WHERE PROG_ID='RX6099B3'
PROG_ID DISP_NAME
DISP_SYM
-------------------------------- --------------------------------
--------
RX6099B3 00_APASS .
RX6099B3 000_APASS .
RX6099B3 01_BUILD B
RX6099B3 02_LBOPA 1
RX6099B3 03_XARRYD 8
RX6099B3 04_LOGIC 7
RX6099B3 05_LBBYP 6
RX6099B3 06_EIDC 5
RX6099B3 07_IOW N
RX6099B3 08_XARRYA Z
RX6099B3 09_WOP1 2
RX6099B3 10_WOP2 3
RX6099B3 11_OLSSD W
RX6099B3 12_POST 9
RX6099B3 13_FAILSTEP K
15 record(s) selected.
I would not say that the results would be totally random, but there is no
guarantee of the order unless you use an ORDER BY. If the rows were
physically stored in a certain order, then DB2 "might" return them in that
order. But there is no guarantee.
Also consider that DB2 sometimes inserts new rows in the middle of a table,
and sometimes at the end, depending on whether there is a clustering index
defined and where space is available (although if append option is used, it
always inserts new rows at the end).
This definition of a relational database is that the user does not know or
care about how the data is physically stored. If the user wants the rows
returned in a particular order, then the user MUST request that order.
A database product is considered to be relational, to the extent to which it
isolates the users from the way the data is physically stored. No database
is completely isolated (and no database is completely relational), but the
physical ordering of rows in an answer set is one aspect where DB2 is fully
relational.