Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SQL Directives Order of Execution
--Sql Server 2014 Express Edition --Batches are separated by 'go' select @@version as 'sql server version' -- Following is order in which SQL directives get executed FROM clause WHERE clause GROUP BY clause HAVING clause SELECT clause ORDER BY clause -- Examples: -- FROM --Since FROM clause executes first, it is our first opportunity to narrow down possible record set sizes. --Try to put as many of you ON rules (for joins) as possible in this area as opposed to in the WHERE clause: FROM contact c INNER JOIN display_status d ON ( c.display_status_id = d.id AND d.is_active = 1 ) -- WHERE --If we create a column in the SELECT directive: "TotalSales" SELECT Name, SUM(Sales) AS TotalSales FROM SalesDB WHERE TotalSales > 1000 --It will not be available in the WHERE clause because the SELECT clause has not even been executed at the --time the WHERE clause is being run.
run
|
edit
|
history
|
help
0
Sequence object -- New Feature of 2012 sql server
aaa
Orders
bc160400784
Negociosj
Query to remove the string between two indexes of delimiters
a
Mass Insert using Except
search all tables for string
Madelin