Sequece to know which syntax execute first

  • Hello all,

    I want to know order for below syntax .

    means

    which condtion is satified first.

    Can Any one correct the order to execute sequece by sql server/

    1. where

    2. group by

    3. having

    4. order by

    5.from

    6 select

    SELECT Column1, Column2, Aggreate function

    FROM TableName

    WHERE predicates

    GROUP BY Column1, Column2

    HAVING Aggreate function Condition

    ORDER BY Column ASC / DESC

    Thanks

    BHavesh

  • Google - logical query execution.

    Or get a copy of Inside SQL Server 2005: T-SQL Querying.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank you so much:-)

  • this is one question I used to ask when I was interviewing, I didnt know it until I attended one of Itzik Ben-Gan's training courses in London and now its stuck with me ever since.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply