Which is best?
Select TestColumn TC
or
Select TestColumn AS TC
I prefer the first one but I am not sure if this is a modern way of declaring the alias.
The two are equivalent for most purposes. I prefer the explicit AS notation.
One reason why I use the AS form is because, in the DBMS I use mainly, it provides a measure of protection against new keywords appearing on system upgrades. That is:
SELECT TestColumn KeyWord
where 'KeyWord' becomes a keyword in a future release can cause problems, whereas in the particular system, using:
SELECT TestColumn AS KeyWord
remains valid.
I recently learned (was told) that Oracle does not support AS in table aliases.
FROM TableName T1 -- OK in Oracle
FROM TableName AS T1 -- Not OK in Oracle
If that is accurate (I've not validated it), then I regard that AS a bug.
It's your choice, though; the two notations are equivalent.
I prefer the second one (using "AS"). If it works either way, just use what you prefer and use it consistently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With