Home

Column aliases should be defined using AS

Rule description

  • Column aliases should be defined using AS

 

Non-compliant Code Example

SELECT Id,
       DECODE (statecode, 101, 'New York', 
                             201, 'New Jersey', 
                             301, 'Seattle', 
                             401, 'San Francisco',
                                'Unknown') 
       "Service Center Location" -- Non complaint code (Column aliases defined without using AS)
       FROM cars
       WHERE cars.Id < 1775

Compliant Code Example

SELECT Id,
       DECODE (statecode, 101, 'New York', 
                             201, 'New Jersey', 
                             301, 'Seattle', 
                             401, 'San Francisco',
                                'Unknown') As
       "Service Center Location" (Column aliases defined using AS)
       FROM cars
       WHERE cars.Id < 1775
Visual Expert 2020
 VEPLSQLRULE75