|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 9:02 AM
Points: 1,196,
Visits: 1,320
|
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 10:53 AM
Points: 1,662,
Visits: 1,709
|
|
This is a very good question, thank you Tom. Today I am the lucky one to be first who answered it correctly. It was not too difficult to deduce correct answer because it was the only one noticeably making perfect sense. The Logical Query Processing Diagram is great, I will definitely print it out and have it posted on the wall by my desk.
Oleg
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 1:49 AM
Points: 10,990,
Visits: 10,540
|
|
Yay! Another point. Found this one quite easy - but only because I happened to re-read Itzik Ben-Gan's Inside Microsoft SQL Server 2008: T-SQL Querying recently. (Chapter 1)
Itzik describes the logical order of processing as:
FROM Cartesian Product ON clause filter Add Outer Rows WHERE GROUP BY HAVING SELECT Evaluate expressions DISTINCT TOP Presentation ORDER BY
I would just add that the physical order of operations performed may differ from the logical order due to query optimisation.
Well done Tom.
edit: added further details after re-reading the question explanation
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 10:25 AM
Points: 18,754,
Visits: 12,337
|
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 10:25 AM
Points: 18,754,
Visits: 12,337
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 1:49 AM
Points: 10,990,
Visits: 10,540
|
|
CirquedeSQLeil (5/6/2010) Though I got this correct, it appears there is a typo in the correct answer. My version had the last two flip-flopped based on the source document provided in the answer. What are you referring to here Jason? It must be hard to spot - I can't see anything wrong...
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, September 17, 2012 7:30 AM
Points: 1,038,
Visits: 679
|
|
Good Question Tom
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 9:02 AM
Points: 1,196,
Visits: 1,320
|
|
Thank-you all.
I've had this data for 10 years now, maybe I copied it from someone's SQL 2000 book - or possibly it came from an SQL 7 course I did (in 1999!), and I found it really useful, But I was slightly unsure that it was still valid, particularly as I had some difficulty in finding a concrete reference.
Thanks Paul for the tip on Itzik's book - I'll be visiting Amazon soon I think (or should I wait for the R2 edition?)
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:53 AM
Points: 1,530,
Visits: 359
|
|
got to learn something new today... thanks
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 8:31 AM
Points: 3,129,
Visits: 4,312
|
|
Had to wrack the grey matter on this one - haven't thought about it for several years... good question.
____________________________________________ Space, the final frontier? not any more... All limits henceforth are self-imposed. “libera tute vulgaris ex”
|
|
|
|