Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 08 Jan 2004 @ 15:47:09 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: The ORDER BY clause
From:   Victor Sokovin

  Given you had 4 columns in a table say "T1" and given a query  

  SELECT * FROM T1 order by 1,2,3,4;  

  Can the above query contain the following values in the ORDER BY clause  

  a. null  

  b. <= 0  

  c. > 4  

  d. repeating column specification i.e. ORDER BY 1,2,1  

  Case a. & d. give no error currently, but do they make sense, if so what.  

  Case b. & c. give error (this is correct - isn't it)  

I seem to remember that SQL-92 allowed repeated column positions in ORDER BY, as in d., but did not require the feature to be implemented. Repeated positions should be ignored. TD and Oracle used to follow that suggestion, Sybase did not and gave an error.

The feature might be appreciated by code generators who submit positions as variables and do not want to do a lot of checking.

I don't know about any changes in SQL-99.



  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023