Aliases in Apache Impala

You can apply an alias to tables, columns, or column expressions when you enter their names in a query. When making further references to the table or column in the same statement, you can use the alias instead of the original name. You usually choose aliases that are either shorter or easier to recall than the original names. Because the aliases are printed in the query header, they can be used to self-document output.

In the SELECT list or FROM list of a query, add the AS alias clause directly after any table, column, or expression name to create an alias. You can specify the alias straight after the original name without using the AS keyword.

— The below command helps to make the column headers of the result set easier to understand.
StudentName AS Name,
AddressDetails AS Address,
ContactInfo AS Phone
FROM tbStudentDetails;

SUM(Salary + Commission) AS TotalIncome
FROM tbEmployee;

— The AS keyword is optional.
SELECT StudentName “Name”, Contactinfo “Mobile” FROM tbStudentDetails;

Hope you find this article helpful.

Please subscribe for more interesting updates.

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s