On Mon, Jun 10, 2002 at 09:37:21AM -0600, Ian Harisay wrote:
> (1) should not be valid either.  first_name is not part of your select 
> statement.  So, how would you be able to order your result set with it? 

The columns in an order by clause do not need to be included in the result
set.  Neither do the columns in a where clause or group by clause.

e.g., this is perfectly valid SQL:

SELECT user_id
FROM   user_table
ORDER BY user_name


If there is a group by clause, it must include all columns from the result
set and order by clause that are outside an aggregate function, however.


Ronald

Reply via email to