Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
Artificial Intelligence(AI) & Machine Learning(ML) Training in Jaipur
Online Training - Youtube Live Class Link
0 like 0 dislike
in Artificial Intelligence(AI) & Machine Learning by Goeduhub's Expert (3.1k points)

What is an alias command in SQL? How do I create an alias in SQL? How does SQL alias work? How to write comments in SQL? 

Goeduhub's Online Courses @Udemy

For Indian Students- INR 570/- || For International Students- $12.99/-


Course Name

Apply Coupon


Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon


Computer Vision with OpenCV | Deep Learning CNN Projects

Apply Coupon


Complete Machine Learning & Data Science with Python Apply Coupon


Natural Language Processing-NLP with Deep Learning in Python Apply Coupon


Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon


Complete Python Programming from scratch with Projects Apply Coupon

1 Answer

0 like 0 dislike
by Goeduhub's Expert (3.1k points)
edited by
Best answer

SQL Aliases (AS)

In SQL alias is used to improve the readability of queries. We use a SQL alias to give a temporary name to tables and columns. 

Sometimes column's name is not very descriptive and up to the point, In this case, we can give a temporary name to columns using an alias for our convenience.  

Note: Note that it requires double quotation marks or square brackets if the temporary name contains space. 

SELECT column_name AS alias_name (temporary name)
FROM table_name;

For Tables 

SELECT column_name
FROM table_name AS alias_name ; (temporary name)

SQL Self Join

As we already discussed the joints in SQL between tables. A self-join is the same as others but the difference is, the table is joined with itself.

Table b - Table b is same as a but alias name used here

SELECT a.column_name, b.column_name...
FROM table1 a

INNER JOIN table b ON a.matching_coulumn= b.matching_column 


SQL Comments 

Comments are used to describe the queries without disturbing the functionality of queries. 

Single Line Comment

--Selecting whole data of table
SELECT * FROM table_name;

Multiline comment  

/*Multiline comments are used

to describe queries in

more than one line*/
SELECT * FROM table_name;

Our Mentors(For AI-ML)

Sharda Godara Chaudhary

Mrs. Sharda Godara Chaudhary

An alumna of MNIT-Jaipur and ACCENTURE, Pune


Ms. Nisha

An alumna of IIT-BHU

Related questions


About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © Social::   |  |