SQL

What are alias in SQL

Alias in SQL is used to attribute a temporary name for a Table to reduce the amount of coding.

Alias in SQL is supported by most database management systems.

Example:

Input Data: 

Product_id P_name Price section
210 Keyboard 50.88 Computers
250 Mouse 15.50 Computers
220 Mouse Pad 20.30 Computers
320 Iphone 1080.99 Phones

Create Table Products (Product_id int, P_name varchar, Price float, section varchar(30));

insert into Products values (210, ‘Keyboard’, 50.88, ‘Computers’),

(250, ‘Mouse’, 15.50, ‘Computers’),

(220, ‘Mouse Pad’, 20.30, ‘Computers’),

(320, ‘Iphone, 1080.99, ‘Phone);

SQL command: 

select P.Price, P.P_name from products as P

where Price<60;

 

 

 

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button