You can use the Common Table (CTE) expression to create a subquery with aliases:
WITH clean_cte AS
(
SELECT reallyLong.misleading.andAnnoying.columnName1 as cleanCompactAlias1,
reallyLong.misleading.andAnnoying.columnName2 as cleanCompactAlias2
)
SELECT doManipulationStuff(cleanCompactAlias1),
doManipulationStuff(cleanCompactAlias2)
This way you can put all your aliases in the CTE and just forget about it when calling your functions. You still need to do aliases somewhere, but this at least doesn't allow you to execute the main request to make it more readable.
source
share