When you project a new table, chances are the new table will be ordered as you 
wish, but only because it is a new table.

Trying to force a table to be stored in a certain order is not a good idea.
You are wise to keep a backup because there is risk every time you do this.

Is there a reason why you want the storage forced to a certain order?
It is best to find a way to achieve your goals without resorting to this 
activity.

Dennis

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Bo Franzén
Sent: Friday, October 31, 2008 6:40 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: INSERT



Interesting discussion about where INSERTed rows are placed in a SQL table! I
have often noticed that there is no natural order in R:BASE, because when
opening a table, new rows have been shown at the end of the table in spite of
them been given a primary Key number in the middle of the index.

There have been times when I have wished to have the rows shown in a Primary Key
(index) order without using the ORDER OF parameter (even if this is very easy
today by just clicking at the top of the column!). I have then been using the
PROJECT command at the R>prompt in order to make a copy of the table using the
ORDER OF parameter (R>PROJECT newtable FROM table USING * ORDER OF primaryindex
ASC).

Then I delete the old table followed by renaming the new table etc. Constraints
might be necessary to take away before dropping (deleting) the old table and the
Table Description has to be renewed in the newtable. And I never do this (or
anything!) without a backup of the entire database!

This works fine but if SQL datasets by definition have no natural order, as
Larry writes, what happens in R:BASE when I use the ORDER OF parameter? I'm just
curious!

Bo Franzén
Department of Economic History
Stockholm University

On 2008-10-30, at 21:56, Lawrence Lustig wrote:
> Just had always assumed you could insert a row in the
> middle of the dataset. Kind of like altering the table you
> can insert a column at a given position.
> SQL datasets by definition have no natural order.  Therefore, the idea of
inserting into the "middle" or even at the end of a table is meaningless.  Don't
count on any SQL database giving you back your data in any particular order
(such as order entered) unless you specifically request that order using ORDER
BY.  R:Base _generally_ gives you data back in as-entered order, but not always.
 Other systems _never_ give you data back in as-entered order -- they often
default to ordering by primary key value.
> --
> Larry


Reply via email to