We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Your comment doesn't actually address the problem. The problem is: using the AS keyword when aliasing a table is perfectly valid T-SQL syntax yet the submission produces errors.
I alias tables regardless of necessity because I feel it is a best practice and also does not affect the performance of the query in any negative way. To your second point, consider the following (which fails): SELECT c.ID FROM City AS c. The alias is referenced in the SELECT query-part which, in terms of the T-SQL interpreter, is compiled after the FROM query-part where the alias is defined.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Average Population
You are viewing a single comment's thread. Return to all comments →
Your comment doesn't actually address the problem. The problem is: using the
AS
keyword when aliasing a table is perfectly valid T-SQL syntax yet the submission produces errors.I alias tables regardless of necessity because I feel it is a best practice and also does not affect the performance of the query in any negative way. To your second point, consider the following (which fails):
SELECT c.ID FROM City AS c
. The alias is referenced in theSELECT
query-part which, in terms of the T-SQL interpreter, is compiled after theFROM
query-part where the alias is defined.