The main statement used to retrieve data in T-SQL is the SELECT statement. Following are
the main query clauses specified in the order that you are supposed to type them (known as
“keyed-in order”):
1. SELECT
2. FROM
3. WHERE
4. GROUP BY
5. HAVING
6. ORDER BY
But as mentioned, the logical query processing order, which is the conceptual interpretation
order, is different. It starts with the FROM clause. Here is the logical query processing
order of the six main query clauses:
1. FROM
2. WHERE
3. GROUP BY
4. HAVING
5. SELECT
6. ORDER BY
1.What is the difference between the WHERE and HAVING clauses?
The WHERE clause is evaluated before rows are grouped, and therefore is evaluated
per row. The HAVING clause is evaluated after rows are grouped, and therefore
is evaluated per group.
2. Why are you not allowed to refer to a column alias defined by the SELECT
clause in the WHERE clause?
Because the WHERE clause is logically evaluated in a phase earlier to the one
that evaluates the SELECT clause.
3. Why are you not allowed to refer to a column alias defined by the SELECT
clause in the same SELECT clause?
Because all expressions that appear in the same logical query processing phase
are evaluated conceptually at the same point in time.
Subscribe to:
Post Comments (Atom)
Search This Blog
DAX - Grouping on multiple columns and the count
Please go thorugh the below URL for entire soultion. http://community.powerbi.com/t5/Desktop/DAX-Grouping-on-multiple-columns-and-the-cou...
-
Synchronous vs Asynchronous The SSIS dataflow contain three types of transformations. They can be non-blocking, semi-blocking or full...
-
SSRS 2008 R2 allows us to execute reports in 3 modes: 1. On Demand. 2. From Cache 3. From Snapshots On demand: This is normal approach tha...
-
---Fibonacci numbers declare @fib table(fib_id bigint,fib_val bigint) declare @current_val bigint,@previous_val bigint,@new_val bigint in...
No comments:
Post a Comment