On 2/16/07, Laura Stewart <[EMAIL PROTECTED]> wrote:

1. The type of expressions that are allowed. My impression is that
they are the Boolean expressions (as opposed to TableExpressions or
SelectExpressions)?

ORDER BY expression is not limited to boolean expression only.  It can contain
common value expression such as numeric, string, datetime, etc.  It can also
have row value expression such as a scalar subquery, case expression, etc.


2. I need to understand how the Syntax for ORDER BY should appear.
Should it just be "Expressions" added immediately after ColumnPosition
(in both places in the Syntax? Or should it be specific type of
expression (TableExpression, SelectExpression, Boolean Expression).
Are there limitations as to the types of expressions allowed? Boolean,
concatenation?

Perhaps the name sort-key expression would be more appropriate?
Adding it after Column Position is fine.

3. Description of the expressions allowed (will appear below the
syntax) This will depend on what type of expressions are allowed, but
one thing that the other parameters mention is if the column needs to
be in the select list. I need help describing the expressions
parameter.


4. Whatever type of expressions are allowed, that topic in the Derby
Ref Guide needs to be updated too. Are there any limitations for ORDER
BY? For example, the Boolean expressions topic mentions that there are
limitations with check constraints.


Yes, there are restrictions.  If SELECT DISTINCT is specified or the
SELECT statement contains a GROUP BY clause, the ORDER BY columns need
to appear in the SELECT list.

I think there is a bug in Derby in the DISTINCT with ORDER BY case and
I have filed a jira for this.  See DERBY-2351 for further details.

Hope this helps.

Regards,
Yip Ng

Reply via email to