Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between 'end' and 'end as'

Simple question. I noticed it seems I can use them interchangeably, but I wasn't sure if they were the exact same command. I searched online and couldn't find anything? Here an example query that gives me the same result:

select 
case when ID in ('1', '2', '3')
then 'Jack'
else 'Jim'
end as Person
from Table.Names

select
case when ID in ('1', '2', '3')
then 'Jack'
else 'Jim'
end Person
from Table.Names
like image 700
J. J. Jay Avatar asked Aug 03 '17 16:08

J. J. Jay


1 Answers

The as in the statement is aesthetic. It tells the compiler that you are setting a name.

like image 200
Schmocken Avatar answered Oct 11 '22 11:10

Schmocken