The sql AS command does not generate a new column. It serves only to create an alias (shortcut) to some attribute of your table or result of an expression in the query. It is very useful when we have queries in two or more related tables to avoid collision between attributes with the same name. An example:
SELECT C.NOME_PAGINA,CAT.LINK_CATEGORIA,CAT.STATUS,C.ID_CONTEUDO,C.STATUS FROM
CONTEUDO C INNER JOIN CATEGORIAS CAT ON CAT.ID_CATEGORIA = C.ID_CATEGORIA
In the above search, both tables have the STATUS attribute to avoid confusion:
SELECT C.NOME_PAGINA,CAT.LINK_CATEGORIA,CAT.STATUS AS CAT_STATUS
,C.ID_CONTEUDO,C.STATUS AS CONTEUDO_STATUS FROM
CONTEUDO C INNER JOIN CATEGORIAS CAT ON CAT.ID_CATEGORIA = C.ID_CATEGORIA
We created a temporary dummy CAT_STATUS and STATUS_STATUS to access the data return. There are other situations that we also need to use AS .
By placing inside your table there should be the supposed auxiliary attribute mentioned in your question so you can filter the results you want for it. Now if your Auxiliary alias is a conditional result generated by querie and there is no attribute in the table and you want to filter through it. It could solve as in the example below:
SELECT SUBSTRING(Column1, 1, 4) + SUBSTRING(Column1, 4, 3) AS Col1
FROM MyTable
WHERE SUBSTRING(Column1, 1, 4) + SUBSTRING(Column1, 4, 3) = 'MySearch'
Just repeating the expression in the WHERE.