SQL > SQL Commands >
The keyword AS is used to assign an alias to the column or a table. It is inserted between the column name and the column alias or between the table name and the table alias.
The syntax for using AS is as follows:
SELECT "table_alias"."column_name1" AS "column_alias"
FROM "table_name" AS "table_alias";
Let's take a look at the same example as we used in the SQL Alias section. Assume we have the following table, Store_Information,
To find total sales by store using AS as part of the table and column alias, we type in:
SELECT A1.Store_Name Store, SUM(A1.Sales) AS "Total Sales"
FROM Store_Information AS A1
GROUP BY A1.Store_Name;
Is there a difference between using an alias without AS and with AS in SQL? The answer is no, there is no functional difference, as both versions will accomplish exactly the same thing. The use of AS is simply a more explicit way of mentioning the alias.