Use of ALIASES operator in SQL

Use of ALIASES operator in SQL:

(1) “ALIASES” operator is used to give a temporary name to column and table. Aliases are mostly used to make column names more readable.

(2) Syntax of “ALIASES” statement is:

SELECT column1 AS alias_name, column2 AS alias_name, …
FROM table_name

(3) Let’s take an example to give a temporary name to a column in the table as shown.

(4) Select the database in SQL server and click on “New Query” button as shown.

Select the database in SQL server and click on the New Query

(5) After that new query editor open as shown.

SQL new query editor open

(6) After doing the above steps, write a query in the editor, as shown.

ALIASES operator Query

Source Code:

–// Without “ALIASES” operator in Vendor table
Select [No_],[Name],[Address] from dbo.[CRONUS India Ltd_$Vendor$437dbf0e-
84ff-417a-965d-ed2bb9650972]
–// Without “ALIASES” operator in Vendor table

–// With “ALIASES” operator in Vendor table
Select [No_] AS [Vendor No.],[Name] AS [Vendor Name],[Address] AS [Vendor
Address]
from dbo.[CRONUS India Ltd_$Vendor$437dbf0e-84ff-417a-965d-ed2bb9650972]
–// With “ALIASES” operator in Vendor table

(7) After writing the query, then execute the query (Shortcut keys is F5) as shown.

Execute ALIASES operator Query

(8) After executing the two queries in the same editor, SQL gives two results. Note: Recommended write and execute query one by one for reporting.


Use of BETWEEN Operator in SQL
Use of OR Operator in SQL
Use of Begin-End in BC D365
Use of REPEAT-UNTIL in Dynamics 365
Understanding the General Ledger and the COA– Microsoft

Leave a Reply