Subject RE: Re: [firebird-support] SQL standard for sort fields and returned fields
Author Ralf Jansen

What Exception?

Sql92 seems to not state anything in that regard. So this belongs presumably into the implementation specific area.

 

I’m sure if it had been defined there it would not be a clear yes/no thing.

For example, Firebird allows this even when the select clause contains DISTINCT so that some sort of grouping takes place. I have no idea on what info a meaningful sorting should take place then? The column wasn’t part of the grouping. In my (obviously wrong) mental model of what happens the column isn’t there anymore when ordering takes place.

 

Ralf

 

 

From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: Montag, 9. Mai 2016 16:30
To: firebird-support@yahoogroups.com
Subject: ODP: Re: [firebird-support] SQL standard for sort fields and returned fields

 

 

hi,

 

could you explain this exception?

And i also have not sql standard to look into and need some exact confirmation about this (something like Sql92 or sql2013.. say this)

 

regards,

Karol Bieniaszewski



-------- Oryginalna wiadomość --------
Od: "Mark Rotteveel
mark@... [firebird-support]" <firebird-support@yahoogroups.com>
Data: 09.05.2016 13:20 (GMT+01:00)
Do:
firebird-support@yahoogroups.com
Temat: Re: [firebird-support] SQL standard for sort fields and returned fields

 

On 2016-05-09 11:45, liviuslivius liviuslivius@...
[firebird-support] wrote:

> Hi,
>
> This is not specific to Firebird question but:
> is something in SQL standard specification about sorted fields must
> be
> also returned?
> I mean:
>
> SELECT
> [FILM_DATE,]FILM_TITLE
> FROM
> FILMS
> ORDER BY FILM_DATE, FILM_TITLE
>
> is [FILM_DATE] required by SQL standard or it is optional or SQL
> standard tell nothing about this?

I don't have the SQL standard at hand right now, so I can't double
check. As far as I know, the SQL standard allows you to sort on any
field, even if it is not in the select list (with the exception of
course of ordering by column index).

Mark