SELECT a=1,b=2
vs
SELECT 1 AS a, 2 AS b
what approach should i use ? (by best practice decisions)
Is there any advantages of one vs the other ?
SELECT a=1,b=2
vs
SELECT 1 AS a, 2 AS b
what approach should i use ? (by best practice decisions)
Is there any advantages of one vs the other ?
Personally I use AS
- it is more explicit and used elsewhere (table aliases).
It is also standard - using the =
syntax will not work on some databases.
I don't believe there are any performance implications for using one over the other.
I dont think where is a difference. But i would prefer the second approach. I think its more logical than the first.
So, i use the AS
approach.
AS temporarily assigns a table column a new name. This grants the SQL developer the ability to make adjustments to the presentation of query results and allow the developer to label results more accurately without permanently renaming table columns. Source