http://www.sqlhacks.com/FAQs/ProcessingLogic
SELECT DISTINCT TOP (list) FROM (LeftTable) (join type) JOIN (RightTable) ON (condition]) WHERE (condition) GROUP BY (list) WITH (CUBE | ROLLUP) HAVING (condition) ORDER BY (list)
Evaluation order:
- FROM (LeftTable)
- ON (condition)
- (join type) JOIN (RightTable)
- WHERE (condition)
- GROUP BY (list)
- WITH (CUBE | ROLLUP)
- HAVING (condition)
- SELECT
- DISTINCT
- ORDER BY (list)
- TOP (list)
- SQL first evaluate the FROM files.
- Then the conditions of the FROMs.
- Then how it will group/summaries...
- Then finally the SELECT statement.
This means that everything has to be defined in the order of evaluation by SQL (ie: aliases, calculated fields...)
'Etc' 카테고리의 다른 글
NoSQL 에 대한 블로그 포스트 모음 (0) | 2011.04.18 |
---|---|
Mongo DB 설치 (윈7) (0) | 2011.03.15 |
DBA 101: Best Practices All DBAs Should Follow (0) | 2009.10.28 |
Mastering DBA Soft Skills (2) | 2009.10.28 |
NULL의 형태? (0) | 2009.06.29 |