Machine-translated by Google. Questions are authored in English.
Top

Discussion

SQL provides the AS keyword, which can be used to assign meaningful column names to the results of queries using the SQL built-in functions.

  • A.
    True
  • B.False

Answer: A

Correct answer: True

AS assigns an alias, and it is particularly useful with aggregates, whose default column names are the expressions themselves - COUNT(*) or worse. SELECT COUNT(*) AS order_count gives the result a name a program or a report can use.

It also aliases tables, as in FROM customer AS c, which is what makes a self-join possible. The keyword is optional in most dialects for both purposes, but writing it makes the intent explicit and avoids a missing comma silently becoming an alias.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.