[ 
https://issues.apache.org/jira/browse/DERBY-4518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804613#action_12804613
 ] 

Dag H. Wanvik commented on DERBY-4518:
--------------------------------------

One more thing:
In this example:

-- Create an AIRPORTS table and insert into it
-- some of the fields from the CITIES table, with the airport
-- codes sorted alphabetically
CREATE TABLE AIRPORTS (
  AIRPORT VARCHAR(3),
  CITY VARCHAR(24) NOT NULL,
  COUNTRY VARCHAR(26) NOT NULL
);

INSERT INTO AIRPORTS 
  SELECT AIRPORT, CITY_NAME, COUNTRY FROM CITIES
  ORDER BY AIRPORT;

it would probably be prudent to include an auto-generated key (cf. DERBY-4), 
since having rows physically sorted doesn't really help much after the insert 
unless it's somehow related to some other property that Derby knows about: one 
would still need to specify ordering when selecting to be assured of the 
correct order, at least for portability. I think it some verbiage on this is in 
order as well, e.g. "When you want insertion to happen with a specific 
ordering, e.g. in conjunction with auto-generated keys, it can be useful to 
specify an ORDER BY on the result set to be inserted."



> Document ORDER BY and OFFSET/FETCH in subqueries
> ------------------------------------------------
>
>                 Key: DERBY-4518
>                 URL: https://issues.apache.org/jira/browse/DERBY-4518
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>            Reporter: Dag H. Wanvik
>            Assignee: Kim Haase
>         Attachments: DERBY-4518.diff, DERBY-4518.stat, DERBY-4518.zip
>
>
> DERBY-4397 and DERBY-4398 extends the usability of ORDER BY and OFFSET/FETCH 
> to subqueries and view. This should be documented.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to